Politeness keys do not collapse IDN host spellings (unicode vs punycode)

Open Beginner friendly
#2,145 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
74/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Active
Tech stack
java
Domain
backend

Research direction

Start at URLUtil.getCanonicalHost and compare the canonical keys produced for the Unicode and punycode host examples in the issue. Check how okhttp handles IDN.toASCII and preserve the raw host for invalid labels. Done means both valid spellings produce one key while invalid hosts still retain their raw value; add or update focused tests for these cases.

Written by the indexing model from the issue text.

Description

Follow-up from #2122 (review by rzo1).

okhttp punycodes the host when it parses a URL: IDN.toASCII("ExAmpleé.org") gives xn--exampl-gva.org. URLUtil.getCanonicalHost (introduced in #2122 for politeness queues and the robots.txt cache) lowercases and percent-decodes the host but does not punycode it, so the Unicode and punycode spellings of one server still get separate politeness queues and separate robots.txt cache entries:

  • http://ExAmpleé.org/ → host ExAmpleé.org → key examplé.org
  • http://xn--exampl-gva.org/ → key xn--exampl-gva.org

Suggested fix: apply IDN.toASCII in getCanonicalHost (falling back to the raw host when the label is not a valid IDN), so both spellings collapse the way okhttp collapses them at connect time.

Dominant language
Java
Stars
996
Forks
292
Avg merge
2d 6h
Merged PRs (30d)
72

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from apache/stormcrawler

All issues in apache/stormcrawler

Similar issues

More Java issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.