April 11, 2014 - 3:33am, 1148 views
How can I do a HTTP post such that if I'm posing a body with more than 2048 bytes that chunked encoding is not used?
I assume you're using HTTP POST Internet Service over AT interface on EHx family. As you've noticed although the hcContLen parameter is mandatory, the module switches mode to chunked transfer encoding when larger amount of data is sent. It erases Content-Length header property and changes the format of the body. In practice when up to 2016 bytes is sent, it remains in fixed length mode.
This behavior can't be changed, so if you really need to post fixed length content, you'll have to create your own socket-based Http implementation. I assume you wish to change this, because the server doesn't interpret the request properly. It should be more reasonable to adjust the server side to handle chunked encoding, especially as it is part of HTTP 1.1 standard specification.
© 2013-2014 Gemalto M2M GmbH