HTTP POST request fail with different operators

Hi Everybody,

I have to upload some data to a server using HTTP POST method.

Everything seems good, however with some operators, the data are not uploaded correctly. The server
replies 200 OK but no data is uploaded.

I use these HTTP headers when open HTTP client (I use WIP library).

WIP_COPT_HTTP_HEADER, "Accept", "*/*",
																		WIP_COPT_HTTP_HEADER, "Accept-Encoding", "gzip,deflate,sdch",
																		WIP_COPT_HTTP_HEADER, "Accept-Language", "it,it-IT;q=0.8,en-US;q=0.6,en;q=0.4",
																		WIP_COPT_HTTP_HEADER, "Connection", "close",
																		WIP_COPT_HTTP_HEADER, "Content-Length", conlen,
																		WIP_COPT_HTTP_HEADER, "Content-Type", "text/plain;charset=ISO-8859-1",
																		WIP_COPT_HTTP_HEADER, "Host", "www.xxxxxxx.yyy",

I tried with WIP library version 5.43.1 and 5.56.0 but nothing changes.

However with another operator (and using different sim cards) everything works great.

This is my configuration:

“DWL”,“V08b13”,"",“Sierra Wireless”,55344,“111611 18:03”,“dda36757”,“00010000”
“FW”,“FW_SRC_747_8_F4_3.Q2687G”,“R7.47.4.201208311102.Q26CL702”,“Sierra Wireless”,2221264,“083112 11:02”,“6aa633a2”,“00020000”
“OAT”,“03.00.20131028095152”,“Mobi”,“Contrive srl”,680512,“102813 09:52”,“a8c14bfb”,“00260000”
-“Developer Studio”,“2.3.1.201306241059-R11859”
-“Open AT OS Package”,“6.37.0.201202060950”
-“Firmware Package”,“7.47.4.201208311102”
-“ExtendedATApplication Library Package”,“1.11.0.201209041207”
-“Internet Library Package”,“5.56.0.201305170830”
“ROM”,“800000”
“RAM”,“200000”
“DWLNAME”,“Q26CL702”

What could be the reason? Someone has encountered sucha a problem?

Thank you for help.

Hiya,

I’ve had some cases where the server (or intermediate proxy) doesn’t accept HTTP chunked transfer encoding (i.e. where the length of the message is determined as the message is produced, rather than using the content-length header).

The WIP HTTP implementation uses chunked transfer encoding unless you explicitly set the content-length header.

Try the following:
Don’t use chunked transfer encoding
Try not to use (g)zipped (or other) data compression in case there is a broken proxy somewhere in the network.

Hope this helps.

ciao, Dave

Thanks davidc,

in the end I’m not using HTTP client to do the POST request, but I open a TCP socket client and I give the header and data as
in a “telnet” session. I follow your suggestion and I eliminate transfer-encoding header. The problem is that I have to parse the
server reply for obtaining status and other stuff, but that’s not a great problem.

I know that this is a step back respect to use the HTTPclient API, but it works, so I’m fine…

Thank you very much for help.

Ciao!

Hiya,

Good to hear that you’ve managed to get your project going.

Glad that I could help.

ciao, Dave

I am having different responses to HTTP POST requests as described here.
Is it possible to explicitly set the content-length header somehow using AT+WIPOPT,… ?

So what responses, exactly, are you getting :question:

Hi:

With a POST sent to a HTTP Post Dumping Server, I can get a 200 (OK) response. I’m using simple payloads or no payload at all.

But with the server I want to POST messages to, I get a 400 (Bad Request) response. The chunks of the message look like they are more or less formed properly BUT the test payload chunk is terminated with CR LF LF, which does not seem to be correct (some reading tells me that all chunks are to be terminated with CR LF). The last chunk in the message always ends properly with … 30h CR LF.

I have been using Terminal 1.9b to send macros/scripts. I’m going to try writing a serial script with a different program to see if my results are better.

Can you view the server’s logs to see why, exactly, it feels that the syntax is malformed :question:

By pure coincidence, I’ve just been sent a link in an email which, when I click it, gets a 400 (Bad Request) response. And this is what the server says:

Hi, I am not trying to send to an SSL server. The server I am sending to is HTTP (Microsoft IIS).
It seems like the Sierra Wireless Internet Application cannot properly create HTTP POST requests.

The server logs were vague about the error, essentially repeating the “Bad request” comment. I tried using a sniffer to look at the HTTP requests and responses, and the first thing that looked out of place was messages that did not end in CR LF (0x0D 0x0A). I don’t have detailed knowledge of HTTP, so I’m not sure how to unravel this.
I hoped to hear if anyone was able to get HTTP POST requests working properly. I guess the alternative would be to try FTP.

Yes, I have had POST requests working

Hiya,

I too have http post transactions working ok - both from the wipsoft library and from open at.

As mentioned above, the only grief I’ve ever run into was a server that didn’t accept content that was sent using ‘Chunked-encoding’.

If you’re new to HTTP, then I strongly recommend that you read HTTP made really easy

Ciao, Dave

Seconded :exclamation:

Thanks for your reply.
Do you know of any way to avoid the chunked encoding?

I forgot to mention, HTTP GET requests work properly, the problems show up when I try to HTTP POST.

Hiya,

Sounds like you’ve got a badly formed HTTP transaction - probably missing headers, or not encoding the data properly.

I REALLY recommend reading HTTP made really easy.

I would also try targeting a different server on a different host - in case there is something strange happing between the module & IIS. I’ve only ever used Apache or Lighthttpd as servers.

ciao, Dave

eg, https://forum.sierrawireless.com/t/orange-uk-chunked-transfer-encoding-forbidden/2016/1

Hello guys,

I have a problem.
Hope you can help me.

I have a HTTPS connection to a testserver.
With HTTP 1.0 I can post data to the server, but with HTTP 1.1 it isn’t working any more.

I found this topic in the forum … [url]https://forum.sierrawireless.com/t/http-and-post-problems/3419/1] and they have the same problem

thanks

tom