http post request difference from firefox and exam

2019-09-23 05:50发布

问题:

I'm new bie. I need send data to sever by post requet method. This is example POST:

POST /bin/login HTTP/1.1
Host: 127.0.0.1:8000
Accept: image/gif, image/jpeg,
Referer: http://127.0.0.1:8000/login.html
Accept-Language: en-us
Content-Type: application/x-www-form-urlencoded
Accept-Encoding: gzip, deflate
User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)
Content-Length: 37
Connection: Keep-Alive
Cache-Control: no-cache

User=Peter+Lee&pw=123456&action=login

I read an example about http post method. I try.... but have some problems.

this is my problem:

when i use firefox to see "post request" but it does not like result of example. (about struct of request in firefox) It's only Graphic of firefox. I don't knonw have any "new line" between header and body in this picture. (sorry i can't upload picture to here!)

https://drive.google.com/file/d/0B7hpo_7GsGHtdzhhajRjbnNQNTQ/view?usp=sharing

Because i use a divice which send per line of headers and body to server. Thank you!

回答1:

I think that's just the way Firefox displays the request headers, it separates the regular headers from the ones that describe the body content, even though they're not actually separate in the request. When I use the Web Developer tool, my display is slightly different from yours:

It shows the Content-Type and Content-Length headers in a section titled "Request headers from upload stream". Maybe you're using a different version of FF, or different developer tools (maybe you're using Firebug?).



标签: http post