Re: Host header with an empty value?

Thanks Roy. So "Host" is not so much a mechanism for virtual hosting,
it's just one part of the URI (the other part is Request-URI).

On Tue, Mar 19, 2013 at 12:44 PM, Roy T. Fielding <fielding@gbiv.com> wrote:
> On Mar 16, 2013, at 9:26 AM, Zhong Yu wrote:
>
>> Quoting http://tools.ietf.org/html/draft-ietf-httpbis-p1-messaging-22#section-5.4
>>
>>   A client MUST send a Host header field in all HTTP/1.1 request
>>   messages.
>>
>>   If the target URI includes an authority component, then
>>   the Host field-value MUST be identical to that authority component
>>   after excluding any userinfo (Section 2.7.1).
>>
>>   If the authority
>>   component is missing or undefined for the target URI, then the Host
>>   header field MUST be sent with an empty field-value.
>>
>> Can someone elaborate on the last sentence and give an example? Thanks.
>
> HTTP can be used with any URI as a request target.  The sentence
> tells the client what to do if that URI has no authority component.
>
>   GET urn:ietf:rfc:2616.txt HTTP/1.1
>   Host:
>
> Without that sentence, a reasonably sane person might conclude that
> no Host header field would be sent, but that would result in a 400
> error due to the IESG-imposed requirement in the first sentence.
>
> ....Roy
>

Received on Tuesday, 19 March 2013 19:08:49 UTC