Groups | Blog | Home
all groups > dotnet sdk > november 2005 >

dotnet sdk : HttpWebRequest Host header


barbutz
11/24/2005 8:33:05 AM
Hi,
I use HttpWebRequest to send http requests. I use http version 1.0.
The problem is that for each http 1.0 request the framework automatically
adds the "Host" header. This header is a must for http 1.1 but NOT for http
1.0 (rfc 1945)! I need to send a http 1.0 request without this header. I
tried to delete the header but no success. Is there a way to get rid of it ?

[i use .net framework 2.0]

Joerg Jooss
11/24/2005 1:44:43 PM
[quoted text, click to view]

No. The framework sets the host header implicitly. Is it harmful for
your destination server?

Cheers,
--
http://www.joergjooss.de
barbutz
11/25/2005 6:00:03 AM
Not for web server but for proxy server. I have a proxy server that acts
differently when it gets Host header and when it doesn't. I need to test it
both ways of course so right now i can only do one way. Is there anything i
can do? if not than i guess i won't continue to use HttpWebRequest class.

[quoted text, click to view]
Joerg Jooss
11/25/2005 10:42:19 AM
[quoted text, click to view]

I'm afraid not. It's one of the more annoying limitations of
HttpWebRequest :-(

OTOH, that proxy shouldn't choke on a Host header either...

Cheers,

--
http://www.joergjooss.de
Feroze [msft]
12/19/2005 5:21:10 PM
You can craft your own HTTP request and send it using a Socket client...

GET /default.htm HTTP/1.0\r\n
Host: <host hdr value>\r\n
\r\n
\r\n

And you can repeat that request without the Host header line. And see what
the difference is in the proxy's response.

what proxy is this, btw?
--
feroze

-----------------
This posting is provided as-is. It offers no warranties and assigns no
rights.

See http://blogs.msdn.com/feroze_daud for System.Net related posts.
----------------

[quoted text, click to view]

AddThis Social Bookmark Button