Problems with http.post and http.headers

23 Apr 2010

1. PROBLEM: --------------------------------------------------------------------------------------

I noticed if i do a simple POST request to a web page the page dosnt get the post data, so i created a custom html page that loggs the requests data when it occurs, and the log says that the post request includes the length of the postable data (HTTP_CONTENT_LENGTH:12) but not the data itself. The posted data was "Comm=hello11" and if the page would get it there will be one more key field in the asp.net page.request class extract like this (this was extracted from a simple testpost caused by a button in the webpage) :

Key: Comm
Value:hello11

but there isnt.

Here is all what the server get when the httpclient post a request(extracted from asp.net page.request object):

Method: POST
Headers: Close xxx.xom

Key: ALL_HTTP
Value:HTTP_CONNECTION:Close HTTP_CONTENT_LENGTH:12 HTTP_HOST:xxx.com

Key: ALL_RAW
Value:Connection: Close Content-Length: 12 Host: xxx.com

Key: APPL_MD_PATH
Value:/LM/W3SVC/2/ROOT

Key: APPL_PHYSICAL_PATH
Value:C:\VSProjects\MBedWeb\

Key: AUTH_TYPE
Value:

Key: AUTH_USER
Value:

Key: AUTH_PASSWORD
Value:

Key: LOGON_USER
Value:

Key: REMOTE_USER
Value:

Key: CERT_COOKIE
Value:

Key: CERT_FLAGS
Value:

Key: CERT_ISSUER
Value:

Key: CERT_KEYSIZE
Value:

Key: CERT_SECRETKEYSIZE
Value:

Key: CERT_SERIALNUMBER
Value:

Key: CERT_SERVER_ISSUER
Value:

Key: CERT_SERVER_SUBJECT
Value:

Key: CERT_SUBJECT
Value:

Key: CONTENT_LENGTH
Value:12

Key: CONTENT_TYPE
Value:

Key: GATEWAY_INTERFACE
Value:CGI/1.1

Key: HTTPS
Value:off

Key: HTTPS_KEYSIZE
Value:

Key: HTTPS_SECRETKEYSIZE
Value:

Key: HTTPS_SERVER_ISSUER
Value:

Key: HTTPS_SERVER_SUBJECT
Value:

Key: INSTANCE_ID
Value:2

Key: INSTANCE_META_PATH
Value:/LM/W3SVC/2

Key: LOCAL_ADDR
Value:xxx.xxx.213.34

Key: PATH_INFO
Value:/command.aspx

Key: PATH_TRANSLATED
Value:C:\VSProjects\MBedWeb\command.aspx

Key: QUERY_STRING
Value:

Key: REMOTE_ADDR
Value:xxx.xxx.212.4

Key: REMOTE_HOST
Value:xxx.xxx.212.4

Key: REMOTE_PORT
Value:4097

Key: REQUEST_METHOD
Value:POST

Key: SCRIPT_NAME
Value:/command.aspx

Key: SERVER_NAME
Value:xxx.com

Key: SERVER_PORT
Value:80

Key: SERVER_PORT_SECURE
Value:0

Key: SERVER_PROTOCOL
Value:HTTP/1.1

Key: SERVER_SOFTWARE
Value:Microsoft-IIS/7.5

Key: URL
Value:/command.aspx

Key: HTTP_CONNECTION
Value:Close

Key: HTTP_CONTENT_LENGTH
Value:12

2.PROBLEM ------------------------------------------------------------------------------

Does anyone know a method to not overwrite but add some strings to the http.headers object, because i think if i modify(overwrite) the headers data the http api will not send some important data to the webpage and it causes problems, like the http request goes wrong and the cant get any data back from the server.

+++++++++++++++++++++++++++++++++++++++++

If somebody know a solution to any of my problems please help.

Thanks

24 Apr 2010

Hi Gabour,

Do you have some example code you are having problems with? It'd probably help people identify your problem.

Also, http://mbed.org/users/donatien/ is working on an improved version of the stacks, so the feedback would be good. The new version is much more stable and flexible.

Simon

24 Apr 2010

I used the slightly modified version of "post nothing" code from here:

http://mbed.org/projects/cookbook/wiki/HTTPClient

So i just changed the url to an aspx page and the post data.

27 Apr 2010

I have found a solution.

The modified version of this code is capaple of posting:

http://mbed.org/projects/cookbook/wiki/EMAC/purehttpc

You simply need to write the http get/post requests yourself or copy outand modify from an another post request from fiddler2 raw data.

Fiddler2 is a http monitoring program what is capable of monitoring the outbound http requests.