host names: allow trailing dot in name resolve, then strip it

Delays stripping of trailing dots to after resolving the hostname.

Fixes #3022
Closes #3222
This commit is contained in:
Tobias Hintze 2018-11-02 21:24:14 +01:00 committed by Daniel Stenberg
parent 2366697806
commit 5b4cce2e36
No known key found for this signature in database
GPG key ID: 5CC908FDB71E12C2
3 changed files with 61 additions and 33 deletions

View file

@ -167,7 +167,8 @@ problems may have been fixed or changed somewhat since this was written!
When given a URL with a trailing dot for the host name part:
"https://example.com./", libcurl will strip off the dot and use the name
without a dot internally and send it dot-less in HTTP Host: headers and in
the TLS SNI field.
the TLS SNI field. For the purpose of resolving the name to an address
the hostname is used as is without any change.
The HTTP part violates RFC 7230 section 5.4 but the SNI part is accordance
with RFC 6066 section 3.
@ -186,10 +187,10 @@ problems may have been fixed or changed somewhat since this was written!
Our current approach allows a knowing client to send a custom HTTP header
with the dot added.
It can also be noted that while adding a trailing dot to the host name in
most (all?) cases will make the name resolve to the same set of IP addresses,
many HTTP servers will not happily accept the trailing dot there unless that
has been specifically configured to be a fine virtual host.
In a few cases there is a difference in name resolving to IP addresses with
a trailing dot, but it can be noted that many HTTP servers will not happily
accept the trailing dot there unless that has been specifically configured
to be a fine virtual host.
If URLs with trailing dots for host names become more popular or even just
used more than for just plain fun experiments, I'm sure we will have reason