c# - HttpWebRequest and Transfer-Encoding -


HTTP WebBurst used to download files from ASP.NET site with original authentication is. In many cases everything works fine, but the response to some proxies is cold and HttpWebRequest.GetResponse () throws an exception if the answer is given with 401 status code is. The exception is:

  System.Net.WebException: The server has violated a protocol. Section = Answer System: The answer to System.Net.HttpWebRequest.GetResponse () is trace: & lt; Pre & gt; "HTTP / 1.1 401 Authority Required \ r \ n Date: Fri, 26 June 2009 04:45:18 GMT \ r \ nServer: Microsoft-IIS / 6.0 \ r \ nx-power-by: ASP.NET \ r \ NX-esponet-version: 2.0.50727 \ r \ nWWW-authentication: Original realm = \ "iis-server \" \ r \ nCache-control: private \ r \ nContent-type: text / html; charset = ISO-8859-1 \ R \ n Via: 1.1 Server \ r \ n Keep-Elevation: Timeout = 15, Max = 100 \ r \ n Connection: Keep-Elive \ r \ n Transfer-Encoding: Chunked \ r \ n Content -language: n \ r \ n \ r \ n0 \ r \ n \ r \ n0 \ r \ n \ r \ n  

m Tested and found that transfer-encoding: selected is the only reason for the exception. Is this a bug for the .NET Framework 2.0 or any RFCs say that the 401's answer should not be cooled ?

I think the error is not that the selected transfer encoding (CTE) is not allowed , I think this server is doing wrong to CTE. If you have a reaction body If you see, it looks like this:

  Language: n \ r \ n \ r \ n 0 \ r \ n \ r \ n 0 \ r \ n \ r \ N  

If you notice, the response body has length of two lengths. CTE RFC requires that the last part of the message be part of a length of 0, and, in detail, no back part can be zero length. In this message, you have 0 zero length sections which violate the CTE protocol is.

This is like setting a content length header for a message, and then the content length is like sending more data than allowed by the length header.


Comments

Popular posts from this blog

c++ - Linux and clipboard -

What is expire header and how to achive them in ASP.NET and PHP? -

sql server - How can I determine which of my SQL 2005 statistics are unused? -