Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
270 views
in Technique[技术] by (71.8m points)

http post request difference from firefox and example

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!

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

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:

enter image description here

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?).


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...