Closed
Bug 367446
Opened 18 years ago
Closed 17 years ago
nsIEffectiveTLDService could use some helpers
Categories
(Core :: Networking, defect)
Tracking
()
VERIFIED
DUPLICATE
of bug 368989
People
(Reporter: dcamp, Unassigned)
Details
Attachments
(1 file)
(deleted),
patch
|
Details | Diff | Splinter Review |
I imagine that when using the tld service people generally want either the effective tld as a string ("org"), or they want the full domain ("mozilla.org").
Comment 1•18 years ago
|
||
If you want both the effective domain and the remaining subdomains as two strings, something like getEffectiveDomainLength would be nice as well.
Comment 2•18 years ago
|
||
Comment on attachment 251996 [details] [diff] [review] add getEffectiveTLD and getEffectiveDomain methods GetEffectiveTLDLength can be 0, which should be handled as a special case in GetEffectiveDomain. See bug 364129.
Reporter | ||
Comment 3•18 years ago
|
||
yeah, I'll update this patch if/when the other patch is taken
Comment 4•18 years ago
|
||
from bug 366797 comment #44: > Turns out the effectiveTLD service takes the UTF-8 list and normalizes it on > load. Having the data pre-normalized might save a smidgen of time for any > non-ascii domains but is not necessary, and having the .dat file more readable > is a win. > > You also don't have to give the service punycode, it'll take IDN and normalize > it before comparing to the domain list. But the "number of characters" answer > will be based on the normalized string so the answer might not match the string > you have if yours is not already normalized. A bit confusing, all the more > reason for the string-returning helper methods I proposed.
Comment 5•18 years ago
|
||
For my purposes, it would be exceedingly handy to be able to retrieve the ETLD+1, and I suspect that many other consumers would also find that handy.
Comment 6•18 years ago
|
||
Err, sorry, I just realized that ETLD+1 is exactly what the getEffectiveDomain method provides.
Comment 7•18 years ago
|
||
btw, here's what I doing currently to handle IDN:
> var effectiveDomain = host.split(".");
> var subdomainCount = effectiveDomain.length -
> asciiHost.slice(asciiHost.length -
> tldService.getEffectiveTLDLength(asciiHost))
> .split(".").length - 1;
> if (subdomainCount > 0) {
> var effectiveSubdomain = [];
> while (subdomainCount--)
> effectiveSubdomain.push(effectiveDomain.shift());
> effectiveSubdomain = effectiveSubdomain.join(".") + ".";
> } else
> var effectiveSubdomain = "";
> effectiveDomain = effectiveDomain.join(".");
Comment 8•17 years ago
|
||
These would still be helpful helper methods to have - and I'm reluctant to write patches which stringhack around with getEffectiveTLDLength if these helpers are on the way. Is there anything blocking this patch from going to review other than 0 handling (which could be added as part of bug 364129 instead of here)?
Comment 9•17 years ago
|
||
Another patch is in bug 368989.
Comment 10•17 years ago
|
||
Dave: can you and Wladimir (bug 368989) cooperate to work out what we need to do? Note that the "+1" in ETD+1 needs to be variable (our current initial plan is to use +2, but that might change, and we want people to test with other values), so I suggest the interface should take that number as a parameter. Gerv
Comment 11•17 years ago
|
||
duping per Dave.
Status: NEW → RESOLVED
Closed: 17 years ago
Resolution: --- → DUPLICATE
Updated•17 years ago
|
You need to log in
before you can comment on or make changes to this bug.
Description
•