On 12.11.2011 22:44, Konstantin Kolinko wrote:
> 2011/11/13 Daniel Shahaf <d.s_at_daniel.shahaf.name>:
>> Konstantin Kolinko wrote on Sat, Nov 12, 2011 at 23:34:49 +0400:
>>> 2011/11/12 Daniel Shahaf <d.s_at_daniel.shahaf.name>:
>>>> While we're on this topic: is there an HTTP URL syntax that sets the
>>>> "Host:" header of the HTTP request?
>>>>
>>>> curl -H "Host: foo" http://bar/percent_s
>>>>
>>>> (Well, what I really want is a way to tell $BROWSER to make such
>>>> requests, so I don't have to use curl | less each time I want to do
>>>> them.)
>>> Note, that "http://bar/percent_s" is not set through HTTP (unless you
>>> are talking through proxy, but that is a different use case).
>>>
>>> It just connects to "bar" and sends
>>> GET /percent_s HTTP/1.1
>>>
>>> Well, HTTP/1.1 added the Host header.
>>>
>>> If you need http://foo/ to be sent to server bar, configure your DNS
>>> (e.g. by editing /etc/hosts) so that "foo" resolves to bar's IP
>>> address.
>> No. I need the behaviour of that curl command, namely:
>>
>> [[[
>> % telnet bar 80
>> GET /percent_s HTTP/1.1
>> Host: foo
>>
>> ]]]
> You have to explain your reasons and find a different approach. You
> are trying to cheat.
Huh? How is that cheating? It's perfectly legitimate. Apache HTTPD, for
example, uses the Host: header to select the virtual host, and you can
have any number of those on a server.
-- Brane
Received on 2011-11-13 08:19:44 CET