request.Headers.Clear() doesnt work correctly?

  • Thread starter Thread starter piotrek
  • Start date Start date
P

piotrek

Hi

I have a problem with http headers.
Iam creating:
private HttpWebRequest request = null;

and:

request = (HttpWebRequest)WebRequest.Create(server);

request.Headers.Clear();

request.Headers.Add("GET", serverPath + " HTTP/1.0");

request.Headers.Add("Icy-MetaData", "1");

request.UserAgent = "WinampMPEG/5.09";



When i try to connect to the 'server' my port sniffer show me in request
unwanted header:

GET / HTTP/1.1 <--- where does is come from?????

GET: /stream/1077 HTTP/1.0

Icy-MetaData: 1

User-Agent: WinampMPEG/5.09

Host: nyc.etn.fm

Connection: Keep-Alive



ICY 404 Resource Not Found

icy-notice1:SHOUTcast Distributed Network Audio Server/posix v1.8.1<BR>

icy-notice2:The resource requested was not found<BR>



Server rejects request because cant see stream in path "/". But i have
specified different path?!?!?!

Can someone help me and tell where does the unwanted header come from?



I Use VS2005 beta.

PK
 
PK,

That is not considered part of the HTTP Header. GET is the method, /
is the resource, HTTP/1.1 is the protocol and its version. You can
certainly change these, take a look at the API doc.

HTH,
Alex
 
That is not considered part of the HTTP Header. GET is the method, /
is the resource, HTTP/1.1 is the protocol and its version. You can
certainly change these, take a look at the API doc.

HTH,
Alex

What is not considered? I added header. When i use request.headers.set
method for GET header, same thing happens.
PK
 
Sorry for the confusion, this line "GET / HTTP/1.1" is part of the
header, but not the meta info like the others...
From the API doc, use .Method to change the method, use
..ProtocolVersion to change the protocol version. As simple as that.

Alex
 
.ProtocolVersion to change the protocol version. As simple as that.

Alex

I only wanna change '/' to my '/path'. Dont wanna change the method couse i
dont exactly know how other method should look like.
Good news is i changed the version - thx for that. If you could only tell me
how to change the path it would be very nice for me.
 
Back
Top