Saturday, November 26, 2005

The illogic thickens..

3rd part of a frustrating technical rant:

I ran tcpdump on the server side, and what difference do I see between requests coming from J2ME client and a J2SE program?

The J2ME request has Transfer-Encoding: chunked at the header, and the body is cut into a few chunks, while the J2SE request is in one smooth body. Not that it should matter, because Tomcat 5.0.28 is supposed to be HTTP 1.1-compliant.

I didn't call OutputStream.flush(), but i suspect it'd have been called anyway because the request is more than 2048 bytes long.

It frustrates because I don't understand why it happens. Why can't Tomcat accept both requests and obtain the value for the getParameter(...) request in the same way? It's illogical. It defies common sense. What's next? Use StreamConnection? Just how does HttpServletRequest's getParameter(...) work anyway? How does it get parameters from a connection?

A few weird observations:
1. Content-Length != -1, despite the presence of chunking. Normally chunking would reset this header value.

2. A different source says 'do not set Content-Length' when using chunking... I wonder..

Unsere dame, Maria Knotenlöserin, Beten Sie für uns.

No comments: