protocol violation - httpwebrequest

P

piotrek

Hi.
I have problem : The server committed a protocol violation.
Section=ResponseStatusLine - exeption.
in code:

--------------------------------------------------------------------------------------------------<code>
String server = "http://nyc.etn.fm:80/stream/1077";
request = (HttpWebRequest)WebRequest.Create(server);
request.Headers.Clear();
request.ProtocolVersion = new Version("1.0");
request.Headers.Add("Icy-MetaData", "1");
request.UserAgent = "WinampMPEG/5.09";
request.KeepAlive = false;
response = (HttpWebResponse) request.GetResponse();
---------------------------------------------------------------------------------------------------
</code>


The server requests with ICY 200 so everything should be ok i guess:
here is the answer:


GET /stream/1077 HTTP/1.0
Icy-MetaData: 1
User-Agent: WinampMPEG/5.09
Host: nyc.etn.fm

ICY 200 OK
icy-notice1: <BR>This stream requires <a
href="http://www.winamp.com/">Winamp</a><BR>
icy-notice2: SHOUTcast Distributed Network Audio Server/SolarisSparc
v1.9.5<BR>
icy-name: ETN.FM Progressive Channel
icy-genre: Progressive Trance, House, Dance, Chill Out, Ambient
icy-url: http://www.etn.fm
icy-pub: 1
icy-metaint: 8192
icy-br: 192
icy-irc: #shoutcast
icy-icq: 0
icy-aim: N/A


WINAMP correct request is similar:


GET /stream/1077 HTTP/1.0
Host: 64.236.34.196
User-Agent: WinampMPEG/5.09
Accept: */*
Icy-MetaData:1
Connection: close

ICY 200 OK
icy-notice1: <BR>This stream requires <a
href="http://www.winamp.com/">Winamp</a><BR>
icy-notice2: SHOUTcast Distributed Network Audio Server/SolarisSparc
v1.9.5<BR>
icy-name: ETN.FM Progressive Channel
icy-genre: Progressive Trance, House, Dance, Chill Out, Ambient
icy-url: http://www.etn.fm
icy-pub: 1
icy-metaint: 8192
icy-br: 192
icy-irc: #shoutcast
icy-icq: 0
icy-aim: N/A


Why the exception occurs?
For any help - thanks.
PK
 
P

piotrek

Ok i figured it out.

For others:
<system.net>
<settings>
<httpWebRequest useUnsafeHeaderParsing = "true" />
</settings>
</system.net>
in application config file.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top