|
dev
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
webHttpRequest doesn't like my netgear routermy wireless connection goes down. I have no control over the webserver installed on this machine (which is apparently violating the HTTP protocol standard). I cannot snoop packets on this HTTP connection because it forces an SSL-encrypted connection. I have already made the config file change useUnsafeHeaderParsing="true", which does not change the error message. (I also tried changing other things in the config file to make sure it was being read). Basically, I try to connect and I get the message "The underlying connection was closed: The server commit ted an HTTP protocol violation." What is odd is that I can connect and pull down the main index page fine, but when I try to access the login page, I get the error. If anyone has any other thoughts besides the useUnsafeHeaderParsing option, it would be greatly appreciated. -DL Here is my code: // open new web client WebClient client = new WebClient(); try { Stream data = client.OpenRead("https://192.168.x.x/login.tri"); StreamReader reader = new StreamReader(data); string s = reader.ReadToEnd(); Console.WriteLine(s); data.Close(); reader.Close(); } catch (WebException ex) { Console.WriteLine(client.ResponseHeaders); Console.WriteLine(ex.ToString()); } And the error message: System.Net.WebException: The underlying connection was closed: The server commit ted an HTTP protocol violation. at System.Net.HttpWebRequest.CheckFinalStatus() at System.Net.HttpWebRequest.EndGetResponse(IAsyncResult asyncResult) at System.Net.HttpWebRequest.GetResponse() at System.Net.WebClient.OpenRead(String address) at ping.Program.Main(String[] args) System.Net.WebException: The underlying connection was closed: The server commit ted an HTTP protocol violation. at System.Net.HttpWebRequest.CheckFinalStatus() at System.Net.HttpWebRequest.EndGetResponse(IAsyncResult asyncResult) at System.Net.HttpWebRequest.GetResponse() at System.Net.WebClient.OpenRead(String address) at ping.Program.Main(String[] args) Thus wrote dl,
Show quote > I'm trying to create a program to auto-reboot my netgear router when It would be interesting to see an actual HTTP message to understand what > my wireless connection goes down. I have no control over the > webserver installed on this machine (which is apparently violating the > HTTP protocol standard). I cannot snoop packets on this HTTP > connection because it forces an SSL-encrypted connection. I have > already made the config file change useUnsafeHeaderParsing="true", > which does not change the error message. (I also tried changing other > things in the config file to make sure it was being read). > > Basically, I try to connect and I get the message "The underlying > connection was closed: The server commit > ted an HTTP protocol violation." What is odd is that I can connect > and pull down the main index page fine, but when I try to access the > login page, I get the error. > If anyone has any other thoughts besides the useUnsafeHeaderParsing > option, it would be greatly appreciated. causes the protocol violation. Note that you can always code your own dirty litte HTTP client using Sockets or TcpClient. Cheers, -- Joerg Jooss news-re***@joergjooss.de On Fri, 17 Mar 2006 17:38:00 +0000 (UTC), Joerg Jooss
<news-re***@joergjooss.de> wrote: > Is there a way to make WebClient dump that debug info? It doesn't>It would be interesting to see an actual HTTP message to understand what >causes the protocol violation. > load anything into ResponseHeaders before the error happens, and because of the SSL encryption I can't read anything in Ethereal. >Note that you can always code your own dirty litte HTTP client using Sockets I guess I'm kind of worried how long it would take to get SSL>or TcpClient. implemented if I went this route. Do sockets or tcpclient handle this? Show quote > >Cheers, Thus wrote dl,
> On Fri, 17 Mar 2006 17:38:00 +0000 (UTC), Joerg Jooss Sorry, I really missed the SSL part. You can always do it with a browser > <news-re***@joergjooss.de> wrote: > >> It would be interesting to see an actual HTTP message to understand >> what causes the protocol violation. >> > Is there a way to make WebClient dump that debug info? It doesn't > load anything into ResponseHeaders before the error happens, and > because of the SSL encryption I can't read anything in Ethereal. plugin like LiveHttpHeaders for Firefox -- it runs after decryption. >> Note that you can always code your own dirty litte HTTP client using ..NET 2.0 comes with SslStream. For .NET 1.1 you have to use a third party >> Sockets or TcpClient. >> > I guess I'm kind of worried how long it would take to get SSL > implemented if I went this route. Do sockets or tcpclient handle > this? solution like Mentalis.org. Cheers, -- Joerg Jooss news-re***@joergjooss.de On Fri, 17 Mar 2006 18:52:22 +0000 (UTC), Joerg Jooss
<news-re***@joergjooss.de> wrote: Show quote >Thus wrote dl, Thank you for the reference to LiveHttpHeaders. I realized by looking> >> On Fri, 17 Mar 2006 17:38:00 +0000 (UTC), Joerg Jooss >> <news-re***@joergjooss.de> wrote: >> >>> It would be interesting to see an actual HTTP message to understand >>> what causes the protocol violation. >>> >> Is there a way to make WebClient dump that debug info? It doesn't >> load anything into ResponseHeaders before the error happens, and >> because of the SSL encryption I can't read anything in Ethereal. > >Sorry, I really missed the SSL part. You can always do it with a browser >plugin like LiveHttpHeaders for Firefox -- it runs after decryption. at the post data that I was overlooking some javascript code that does some MD5 calculation before posting back to the server. It still throws a ServerProtocolViolation exception, but the post occurs and access is granted to the administrative pages of the router. -DL |
|||||||||||||||||||||||