You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Nov 6, 2023. It is now read-only.
Repository navigation
This repository was archived by the owner on Nov 6, 2023. It is now read-only.
Trailing dots in hostnames are legal, for example see this StackOverflow discussion. c2cpicdw.qpic.cn and c2cpicdw.qpic.cn. are effectively the same.
In #7229 the test is failing because c2cpicdw.qpic.cn. doesn't pass XML validation. However, even if it did pass XML validation, I would then expect an error because of duplicate targets c2cpicdw.qpic.cn and c2cpicdw.qpic.cn..
@renyouguo What is a specific use case where c2cpicdw.qpic.cn. is needed and c2cpicdw.qpic.cn won't work?
I think it would be a valid enhancement to add support for trailing dots. @fuglede@Hainish@J0WI Thoughts?
Note: depending on how the HTTP server handles the Host header, http(s)://www.example.com may not serve the same site as http(s)://www.example.com..
Take http://www.libssh.org. as an example. This returns a 400 response code, as opposed to the 200 returned by leaving off the trailing dot. This means that if we really wanted to be thorough, we'd test with and without the trailing dot, and add or remove hosts as appropriate. If we did this for every ruleset, this may double the size of hosts in the ruleset - each one of which is loaded into memory and delivered to users at download time.
Considering the above, the cost of being thorough here is too high for the benefit of supporting a strangely formatted, but technically valid, hostname.
I get 200 for http://www.libssh.org. from both Firefox and curl, not 400.
Also, from the StackOverflow discussion I linked in #7231 (comment) , my understanding is that all full domain names have the trailing dot, and using the domain name without the dot is just an extremely common shortcut. So browsers consider them the same thing, and if they behave differently then something is misconfigured or explicitly customized somewhere along the chain.
Browsers do not treat them the same in that the Host header passed by both Firefox and Chrome in the above request is www.libssh.org. If a web server is configured to differentiate based on the trailing ., we could see wildly different results, regardless of what the standards state. It'd be interesting to see how many of the Alexa Top 1M sites have differing results for the trailing .. Just looking at the top 20, we get:
I can confirm the 400 in Firefox for https://www.libssh.org./ , but not in curl. That's fine.
I see what you mean about Host now. My knee-jerk reaction is to say that these sites are handling Host poorly, though I'm surprised to see that at such major sites. Funny enough though, my own tiny personal site https://jeremynation.me also gets a 400 with a trailing dot. It's just static content served with Apache so it must be easy to mess trailing dot handling up.
I agree that trying to match every target with and without a trailing dot is too much. But it would be nice if HTTPS Everywhere could match targets that explicitly had a trailing dot, which is what this issue was originally about.
Activity
numismatika commentedon Sep 30, 2016
is .cn. really the intended target?
I would expect either a trailing wildcard or a simple .cn instead of aa trailing dot
ivysrono commentedon Sep 30, 2016
Yes, whether you believe it or not.
Probably the wrong programmers, but it is in normal operation.
jeremyn commentedon Sep 30, 2016
Trailing dots in hostnames are legal, for example see this StackOverflow discussion.
c2cpicdw.qpic.cnandc2cpicdw.qpic.cn.are effectively the same.In #7229 the test is failing because
c2cpicdw.qpic.cn.doesn't pass XML validation. However, even if it did pass XML validation, I would then expect an error because of duplicate targetsc2cpicdw.qpic.cnandc2cpicdw.qpic.cn..@renyouguo What is a specific use case where
c2cpicdw.qpic.cn.is needed andc2cpicdw.qpic.cnwon't work?I think it would be a valid enhancement to add support for trailing dots. @fuglede @Hainish @J0WI Thoughts?
gloomy-ghost commentedon Sep 30, 2016
Therefore, I think this is not a problem.
Append: For complicated rules, we do need to add support for trailing dots
ivysrono commentedon Oct 1, 2016
@jeremyn @gloomy-ghost Thank you!
Hainish commentedon Oct 11, 2016
Note: depending on how the HTTP server handles the
Hostheader,http(s)://www.example.commay not serve the same site ashttp(s)://www.example.com..Take
http://www.libssh.org.as an example. This returns a400response code, as opposed to the200returned by leaving off the trailing dot. This means that if we really wanted to be thorough, we'd test with and without the trailing dot, and add or remove hosts as appropriate. If we did this for every ruleset, this may double the size of hosts in the ruleset - each one of which is loaded into memory and delivered to users at download time.Considering the above, the cost of being thorough here is too high for the benefit of supporting a strangely formatted, but technically valid, hostname.
jeremyn commentedon Oct 11, 2016
I get
200forhttp://www.libssh.org.from both Firefox and curl, not400.Also, from the StackOverflow discussion I linked in #7231 (comment) , my understanding is that all full domain names have the trailing dot, and using the domain name without the dot is just an extremely common shortcut. So browsers consider them the same thing, and if they behave differently then something is misconfigured or explicitly customized somewhere along the chain.
Hainish commentedon Oct 12, 2016
I'm now only getting a
400response from https://www.libssh.org./Browsers do not treat them the same in that the
Hostheader passed by both Firefox and Chrome in the above request iswww.libssh.org.If a web server is configured to differentiate based on the trailing., we could see wildly different results, regardless of what the standards state. It'd be interesting to see how many of the Alexa Top 1M sites have differing results for the trailing.. Just looking at the top 20, we get:http://baidu.com./
https://twitter.com./
http://live.com./
http://linkedin.com./
http://instagram.com./
http://weibo.com./
http://360.cn./
jeremyn commentedon Oct 12, 2016
I can confirm the
400in Firefox forhttps://www.libssh.org./, but not in curl. That's fine.I see what you mean about
Hostnow. My knee-jerk reaction is to say that these sites are handlingHostpoorly, though I'm surprised to see that at such major sites. Funny enough though, my own tiny personal site https://jeremynation.me also gets a400with a trailing dot. It's just static content served with Apache so it must be easy to mess trailing dot handling up.I agree that trying to match every
targetwith and without a trailing dot is too much. But it would be nice if HTTPS Everywhere could matchtargets that explicitly had a trailing dot, which is what this issue was originally about.