Search code examples
httppostnetwork-programminghttp-proxy

Where will the content begin in a post request?


I'm creating a proxy server for class, and I'm currently parsing the client request. When I get a POST request, how do I know where the headers end and the content begins? Is there a header that always comes last?


Solution

  • It should be after the blank line (CRLF = carriage return, line feed, i.e. blank lines). There should be two of these after the last header, one to go to next line and another to create a blank line. Then the content will begin.

    POST /enlighten/rest HTTP/1.1
    Host: api.opencalais.com
    Content-Type: application/x-www-form-urlencoded
    Content-Length: length
    
    licenseID=string&content=string&/paramsXML=string
    

    got from: http://www.opencalais.com/HTTPexamples