HTTP POST

cpghost cpghost at cordula.ws
Tue Feb 12 00:07:56 UTC 2008


On Mon, Feb 11, 2008 at 05:43:23PM +0100, Wojciech Puchar wrote:
> i have no problems with GET and HEAD. with POST i have.
> 
> page is simple form just to upload image. it has one field TYPE=file NAME=P 
> and submit button.
> 
> my program gets from the browser:
> 
> 
> all browser data etc.. hostname
> POST URL HTTP/1.1
> <empty line here>
> P=<filename>

Hmmm, this is not really HTTP/1.1 compliant! At least the Host
header is missing! According to RFC 2616 (HTTP/1.1):

  9. The Host request header field (section 14.23) MUST
  accompany all HTTP/1.1 requests.

This is because most web servers do virtual domain hosting
on a single IP and use the Host header to disambiguate between
hosts/domains.

Try adding Host, and if that's not enough, you may need to add
more headers, like, say:
  Connection: close
  Content-length: <length of message in bytes>
  Content-type: <some mime type>

Good luck!

> i have HTTP RFC, but possibly didn't RTFM right.

Regards,
-cpghost.

-- 
Cordula's Web. http://www.cordula.ws/


More information about the freebsd-questions mailing list