HttpWebRequest Accept-Encoding: gzip Header

  • Thread starter Thread starter nelson.carvalho
  • Start date Start date
N

nelson.carvalho

Hi,
I've developed a solution to call a webservice via HTTPWebRequest
The IIS is configured to allow compression (gzip).

The client application add to the request header the accept-
encoding:gzip

request.AllowWriteStreamBuffering = true;
request.SendChunked = false;
request.KeepAlive = true;
request.Method = "POST";

// tell the HTTP server that the client accept compressed
data
request.Headers.Add("Accept-Encoding: gzipr\n");

I've tested with success the code on my laptop, but on my pocket Pc
this does not work. I mean, i can successfully call the webservice but
i never receive the contents compressed.

In order to demystify this issue I've placed an http sniffer and came
to the conclusion that when i run the code into my laptop the header
accept-encoding is sent and from Pocket PC is not (this way the IIS
cant know if the client allows compression).

Investigating a little more i did the following:
request.Headers.Add("Accept-Encoding: gzipr\n");
request.Headers.Add("TestHeader: okr\n");

Running this code in pocket PC i saw that he sends the "TestHeader"
Header. He only omits the Accept-Encoding. Why is that?

Note: This behaviour occurs on Compact Framework 1.1 and 2.0; on
pocket pc 2003 mobile edition and on WinCE 5.0

What is happening? Can you help me?

Thanx
 
Just to add that the code was tested with pocket pc connected through
activesync/USB
Thanx
 
Back
Top