Skip to main content

Chunked Transfer Coding in JavaME

No replies
hsirges
Offline
Joined: 2010-01-20
Points: 0

Hi,

I'm currently developing a JavaME Application which connects to a
webservice running on a GlassFish appserver. For one particular mobile device
i get an IOException with "invalid chunked header" message.
I wonder if the error is on the client or server side.
The mobile device first sends a http request header with these properties
where the chunked transfer encoding is set:

User-Agent: Profile/MIDP- 2.0 Configuratio n/CLDC-1.1 UNTRUSTED/1.0
Transfer-Encoding: chunked
Content-Length: 0
Connection: Keep-Alive
Cache-Control: no-cache

The next tcp-frame sent by the mobile device contains only the chunk-size field of the first chunked body part:

...TCP-Header ...86
CRLF

Frame #3 contains the data:
...TCP-Header...
mydata
CRLF

and finally frame #4:
0
CRLF
CRLF

This is a hexdump of the second packet which is refused
by the server:

0000 00 19 99 27 84 55 00 1d 71 9b e9 c0 08 00 45 00 ...'.U..q.....E.
0010 00 2c 02 ab 40 00 70 06 1b 8d 50 bb 6d d7 d5 a5 .,..@.p...P.m...
0020 58 5c 84 50 04 ca 04 a0 b4 b0 1b ba c2 6c 50 18 X\.P.........lP.
0030 80 52 e0 0f 00 00 35 36 0d 0a 00 00 .R....56....

I'm wondering if it is valid, that the client splits the chunked body over muliple frames. Shouldn't at least the chunk-length and chunk-data field be sent in one tcp-packet?

I would be grateful if someone could tell me if this is http-message is valid.

greetings,

Hendrik

Message was edited by: hsirges