473,800 Members | 2,404 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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.IOExc eption]: {System.IO.IOEx ception}
HelpLink: Nothing
InnerException: Nothing
Message: "Cannot close stream until all bytes are written."
Source: "System"
StackTrace: " at System.Net.Conn ectStream.Close Internal(Boolea n
internalCall, Boolean ignoreShutDownC heck)"
TargetSite: {System.Reflect ion.RuntimeMeth odInfo}

Is there any way around this issue?
Jul 21 '05 #1
1 3521
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.IOExc eption]: {System.IO.IOEx ception}
HelpLink: Nothing
InnerException: Nothing
Message: "Cannot close stream until all bytes are written."
Source: "System"
StackTrace: " at System.Net.Conn ectStream.Close Internal(Boolea n
internalCall, Boolean ignoreShutDownC heck)"
TargetSite: {System.Reflect ion.RuntimeMeth odInfo}

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
1838
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 Apache would send by default it that file was requested via HTTP. Is there a way to do this? -Josh
7
1971
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 with the form data. Under Windowx XP SP2 the IE6 "Information Bar" has the message: "To help protect your security, Internet Explorer has restricted this
17
2184
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 "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DT¬D/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
1
1350
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 object but I am looking towards a .Net complaint solution, which is part of default .Net framework.(No third party component please). I am using C# with visual studio 2003 .Net framework 1.1 on windows XP OS.
2
1148
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
1109
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 (as always) some day i''m gona pay this forum back for all the help i''m getting kes
1
2473
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 Content-Encoding header does not get set at all in the response. Therefore, a browser that advertises itself as supporting gzip compression (Accept-Encoding: gzip,deflate) receives compressed content but does not know it is compressed.
2
3022
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 access Google Maps (not secured). The map is embedded in the page and does not open in a separate window. What solution do you recommend? Use iframes? If so, how?
0
1811
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 variants of Chinese language tags(ie zh-TW) point to English-suffix pages. Our site currently has content negotiation set up for several other languages, and we have the corresponding html files for those languages being properly served. After...
4
2579
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 someone uses the enter key to make 2 lines in the text area when it is submitted it is stored in mysql database with (i guess) a line break \n? When i pull the data out of mysql to put back into the textarea i use the javascript function...
0
9551
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10275
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10253
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10033
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
6811
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5471
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5606
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3764
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2945
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.