chunk length was not valid in HttpWebRequest class

  • Thread starter Thread starter Eric Larson
  • Start date Start date
E

Eric Larson

Chunk length was not valid in HttpWebRequest class

I've seen a lot of people getting this problem and I've done a lot of
reading, but I can't seem to find much about my particular instance...

Background: I connect my PocketPC (iPAQ 3835) via SynCE (an open source
equivilant to ActiveSync for Linux --
http://sourceforge.net/projects/synce/). The PocketPC connects to the
Linux machine and tries to browse to a website on an Apache server
(1.2.23) residing on this machine.

Most of the requests made by the PPC are dynamic content so they come
back with chunked-encoding. When a request is a certain size, it fails
(3928 bytes is one example). It also can happen when the request is
larger and individual chunks are some particular range of size (that's
harder to pin down).

This is not a public server so I can't give you any URLs. If need be, I
have a VB6 app that makes similar requests via Winsock and I can send
you the raw data back from it.

This isn't https, just http and the Apache server isn't putting white
spaces in the chunk sizes.

If I connect the PPC to a Windows machine through ActiveSync it works
just fine. So either ActiveSync is helping the PPC out or SynCE is
corrupting the data.

I tried the fix of changing the protocol to HTTP/1.0 and that did work.
However, it makes requests so much slower than before. With HTTP/1.1 we
could make 6-7 requests per second but with HTTP/1.0 it ranges from 1-4
requests every two seconds. We could settle for 1 request ever second,
but 1 request every two seconds is too slow.

NETCF 1.0
- did not work

NETCF 1.0 SP1
- did not work
NETCF 1.0 SP2 beta
- did not work at all -- requests would go out, but no data would
come back. Multiple Webexceptions were raised where
WebException.Message was simply "Webexception" when the following line
of code was executed:
Dim streamResponse As Stream = myHttpWebResponse1.GetResponseStream()

If you have any questions, let me know, I'm looking for any suggestions!

Thanks,
Eric
 
You are not setting the ContentLength field for the HttpWebRequest object
right? I was also told to set the AllowWriteStreamBuffering to true. That
with the SP2 beta worked for me...

Young.

Eric Larson said:
Chunk length was not valid in HttpWebRequest class

I've seen a lot of people getting this problem and I've done a lot of
reading, but I can't seem to find much about my particular instance...

Background: I connect my PocketPC (iPAQ 3835) via SynCE (an open source
equivilant to ActiveSync for Linux --
http://sourceforge.net/projects/synce/). The PocketPC connects to the
Linux machine and tries to browse to a website on an Apache server
(1.2.23) residing on this machine.
<...truncated...
 
Thanks for the reply...

[You are not setting the ContentLength field for the HttpWebRequest
object right?]
Correct, unless I do a POST, but when I'm getting this error, it's a GET

[I was also told to set the AllowWriteStreamBuffering to true.]
Adding this line to SP2 prevented the exception, but it still runs just
as slow as HTTP/1.0 did. I was hoping that SP2 would fix this chunk
problem but still let me run quickly.

Any other suggestions?
 
I am assuming that you did comment out or removed the line that set the
ProtocolVersion property to Version10? You could check on your web server
side to see if you are indeed using HTTP 1.1 with the chunking enabled.

If both of those are true and you're seeing slow performance, then I'm not
sure what it could be. Do you have a performance requirement as well? You
also could post to and ask one of the Microsoft guys to see what the "under
the hood" fix in SP2 was...

Young.
 
Back
Top