HTTP protocol request and request messages, response and response messages

Source: Internet
Author: User
Tags webp

HTTP protocol

HTTP protocol, the Hypertext Transfer Protocol (Hypertext Transfer Protocol). Is a rule that specifies the communication between the browser and the server

The HTTP protocol specifies the criteria for requests and responses

request and request messages

Request message for GET request detailed

--------------------------the request line--------------------------------
GET Request Mode
/day02/01.php?username=pp&password=123456 Request Path + parameters (note points)
http/1.1 version number of HTTP
GET/Day02/01.Php?Username=Pp&Password=123456HTTP/1.1
?
--------------------------Request Header--------------------------------
Host:Www.Study.Com
Connection:Keep-Alive
Upgrade-Insecure-Requests:1
User-Agent:Mozilla/5.0 (WindowsNt10.0;WOW64)AppleWebKit/537.36 (Khtml,LikeGecko)Chrome/58.0.3029.96Safari/537.36
Accept:Text/HtmlApplication/Xhtml+XmlApplication/xmlQ=0.9,Image/Webp`*/*`;Q=0.8
accept-Encoding: gzip, deflate, SDCH
accept-language: zh< Span class= "Cm-operator" >-cn,zh; Q=0.8,en; Q=0.6
?
//----------------------------request body-------------------------------------
//get request does not have a request body, but the parameters are stitched into the request line

Request message for POST request


-----------------------the request line---------------------------------------------
POST/Day02/01.PhpHTTP/1.1
?
-----------------------Request Header--------------------------------------------
Host:Www.Study.Com
Connection:Keep-Alive
The length of the passed parameter.
Content-Length:29
Cache-Control:Max-Age=0
Origin:httpWww.study.com
Upgrade-Insecure-Requests:1
User-Agent:Mozilla/5.0 (WindowsNt10.0;WOW64)AppleWebKit/537.36 (Khtml,LikeGecko)Chrome/58.0.3029.96Safari/537.36
Content type: Form data, this property must be specified if it is a POST request.
Content-Type:Application/X-Www-Form-urlencoded
Accept:Text/HtmlApplication/Xhtml+XmlApplication/xmlQ=0.9,Image/Webp`*/*`;Q=0.8
Referer:httpWww.study.com/day02/01-login.html
Accept-Encoding:Gzipdeflate
accept-language: zh- Cn,zh; Q=0.8,en; Q=0.6
?
//------------------------request body------------------------------------------
username=pp &password= 123456

Get request vs. POST request

    • The GET request has no request body because the GET request parameters are stitched into the address bar

    • The POST request has a request body, which is the passed parameter

    • The POST request needs to specify the Content-type property.

Response and response messages

---------------------Status line (response line)-------------------------------
http/1.1 HTTP Version
200 Status of the response
200 indicates success
304 means read cache
404 means the resource cannot be found
500 indicates server-side error
HTTP/1.1200Ok
?
----------------------Response Header-----------------------------------------------
Date:Thu,22June201716:51:22Gmt
Server:Apache/2.4.23 (WIN32)Openssl/1.0.2JPhp/5.4.45
X-Powered-By:Php/5.4.45
Content-Length:18
Keep-Alive:Timeout=5,max=100
connection: keep- alive
//content type, telling the browser how to parse the response result
content-type: text< Span class= "Cm-operator" >/html; Charset=utf- 8
//----------------------- Response Body------------------------------------------------
hello world

HTTP protocol request and request messages, response and response messages

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.