17 Apr 07 9:46
The HTTP 1.1 Compliance / “Transfer-Encoding: Chunked” POST request problem.
Please note: I’m developing across a number of platforms and Perl isn’t my strong point.
J2ME client (a) sends a simple HTTP POST request to a Perl server script (b).
The J2ME API (HTTP 1.1) forces “Transfer-Encoding: Chunked” and will automatically strip out any “Content length” headers when sending messages longer than the buffer on the handset. The legacy (HTTP 1.0) Perl CGI modules will throw an error when a request comes without a “Content length” header or when “Transfer-Encoding” is set to “Chunked”. Chunked data also contains a number of extra control characters that need to be filtered out.
This functionality works transparently for both images and text in PHP when sending “multipart/form-data” formatted data.
An example Perl script that can:
(1) Cope with no “Content length” header.
(2) Strip out the extra control characters.
(3) Run on an Apache test server and on an IIS deployment server. Please include any server configuration details as I’m assuming that the implementation will require an additional Perl module that I am not currently aware of.
Any help appreciated as I can’t find any example scripts for other CGI modules on the web.