jueves, 14 de junio de 2012

HTTP POST request with telnet

So I keep writing here all this things I'm force to do in order to tests things.

So this time I was require to reproduce an error in an environment other than local, and the only way was to send a HTTP request over telnet client.

Long story short this is the form of the request you should type after you are connected to the server:



POST /some-path-to-a-server-resource HTTP/1.1Cache-Control: no-cacheConnection: trueContent-Type: application/atom+xml;type=entryKeep-Alive: trueTransfer-Encoding: chunked
5;ext-name=ext-val012340
Now, the parts in red are the important ones.
Please note that this particular request is using HTTP 1.1. The HTTP 1.1 specification defines two ways to post information. The first one is the same as in HTTP 1.0 which require a content length parameter in the header.
The other one is Transfer Encoding chunked this tells the server that the content is going to be sent in waves of information.
Bear in mind this last thing otherwise the web server may answer your request with an error code other that the old and nice 200.

Not much this but, toke me a good half hour to find how to do it.
Enjoy it.

No hay comentarios:

Publicar un comentario