RE: Sending compressed HTTP requests to Apache server:Content-Length I

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance

From: PerryG (PerryG_at_discussions.microsoft.com)
Date: 12/07/04


Date: Tue, 7 Dec 2004 10:59:19 -0800

I was able to come up with an 'ugly' workaround for now. I can ignore the
below raised error, reset the content length to the compressed length, and
continue processing. Doing this will send the content-length of the
uncompressed message, but still allow me to write to the stream, send the
request, and receive the response. If anyone has a better suggestion I'd
still love to hear it.

Thanks

"PerryG" wrote:

> We have a .NET 1.1 client which is sending a gzipped soap request using
> HttpWebRequest to an Apache server. The Apache server is using a the
> 'mod_deflate' server to decompress the incoming message, and to also compress
> the response (GZIP).
>
> The mod_deflate filter requires the 'Content-Length' header contained within
> the incoming request to specify the number of UNCOMPRESSED bytes being sent
> and not the actual bytes of the body of the compressed HTTP request itself.
> The problem we have is .NET requires that you specify the number of actual
> bytes written to the request stream as specified in the Content-Length header
> of the request message. The exception we receive when attempting to close
> the stream to send the request is:
>
> [System.IO.IOException]: {System.IO.IOException}
> HelpLink: Nothing
> InnerException: Nothing
> Message: "Cannot close stream until all bytes are written."
> Source: "System"
> StackTrace: " at System.Net.ConnectStream.CloseInternal(Boolean
> internalCall, Boolean ignoreShutDownCheck)"
> TargetSite: {System.Reflection.RuntimeMethodInfo}
>
> Is there any way around this issue?
>
>



Relevant Pages

  • Sending compressed HTTP requests to Apache server:Content-Length I
    ... We have a .NET 1.1 client which is sending a gzipped soap request using ... HttpWebRequest to an Apache server. ... The problem we have is .NET requires that you specify the number of actual ... bytes written to the request stream as specified in the Content-Length header ...
    (microsoft.public.dotnet.general)
  • Sending compressed Web Service requests to Apache server
    ... We have a .NET 1.1 client which is sending a gzipped soap request using ... HttpWebRequest to an Apache server. ... The problem we have is .NET requires that you specify the number of actual ... bytes written to the request stream as specified in the Content-Length header ...
    (microsoft.public.dotnet.general)
  • Re: gzip,deflate: ignored.
    ... But I dont't understand if this approach works either to compress data ... Dim request As HttpWebRequest = CType,_ ...
    (microsoft.public.dotnet.framework.compactframework)
  • Dynamically served compressed (gzip/packed) JavaScript.
    ... It intercepts all browser request of JS files, compress this files ... compress it with gzip and send back. ...
    (comp.lang.javascript)
  • Disk Cleanup Help!
    ... It is hanging at "Compress Old Files". ... the http: website you listed and it says "Bad Request" - ...
    (microsoft.public.windowsxp.general)