473,398 Members | 2,404 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,398 software developers and data experts.

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 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?
Jul 21 '05 #1
1 3495
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?

Jul 21 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Joshua Beall | last post by:
Hi All, Is there a way in PHP to know what all the content-types that Apache knows about are? Basically, what I want to be able to do is look at an extension, and then know what content-type...
7
by: McKirahan | last post by:
What is "active content"? My ASP page just returns HTML.... I have a page with an .htm extension that has a form whose action is an ASP page which generates a report after updating a database...
17
by: ccdrbrg | last post by:
This is a rather general subject, I apologize. I am new to XHTML, CSS, et al and I am having trouble understanding the DTD and xml namespace declarations. For example: <!DOCTYPE html PUBLIC...
1
by: Shahzad Atta | last post by:
Hi there, My web server needs to get html source of a web page from a remote web server . This html will be rendered to client browser after some processing. I know it can be done via XMLHTTP...
2
by: gemel | last post by:
Is there any way in VS that I can examine the constructed HTTP request or response packets? John L
1
by: WebBuilder451 | last post by:
Quick question. What is the correct way to get the text from a web page into a string variable. then use the normal string functions to get to the information? thanks (as always) kes -- thanks...
1
by: Leif Wessman | last post by:
I enabled automatic gzip compression with the following lines in ..htaccess: php_value zlib.output_compression On php_value zlib.output_compression_level 5 The problem is that the...
2
by: Daniel Frechette | last post by:
Hi, Is it possible to have secured (SSL/HTTPS) and non-secured (HTTP) content in the same page without breaking the security? I am developing a secured reservation system in which the user can...
0
by: alexsink | last post by:
I am trying to get apache content negotiation to redirect only zh-CN(mainland China, where Simplified Chinese translations are available) language types to Chinese web pages, and have all other...
4
by: Nate12o6 | last post by:
Mabee you guys can help me with this. I have a form with enctype="multipart/form-data" that has a textarea in it as well as file upload. The text area is for a description of the file. If...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.