Network Transport Protocol 1, common protocols
1, HTTP, HTTPS Hypertext Transfer Protocol
2. FTP File Transfer Protocol
3. SMTP Simple Mail Transfer Protocol
2. HTTP protocol
Hypertext Transfer Protocol (Http,hypertext Transfer Protocol) Web site is based on the HTTP protocol, such as the site's pictures, CSS, JS, etc. are based on the HTTP protocol for transmission.
HTML Hypertext Markup Language
The HTTP protocol is constrained and regulated by requests from the client to the server (request) and responses from the server to the client (Response).
That is, the HTTP protocol is primarily composed of requests and responses.
Common Request Methods POST,GET, PUT, DELETE
We debug via browser plugin FireFox Httpfox. CTRL SHIFT F2 Call
2.1. Request and Request messages
The request is initiated by the client, and its canonical format is: Request line, request header, request principal.
Consists of the request method, the request URL, and the protocol version
GET /day01/code/login.php?username=123&password=123 HTTP/1.1POST /day01/code/login.php HTTP/1.1
Host:localhost the requested host
Cache-control:max-age=0 Control Cache
Accept:/ accepted document MIME type
User-agent: It's important.
Referer: from which URL to jump over
Accept-encoding: Acceptable compression format
If-none-match: Records the ETag value of the server response to control the cache
This value is automatically generated by the server
If-modified-since: Record the last-modified value of the server response
This value is automatically generated by the server
Data that is passed to the server
Note: When a form is submitted as a post, the request header is set
content-type:application/x-www-form-urlencoded, in get form when not needed
2.2. Response and response messages
The response is issued by the server in the canonical format: status line, response header, response body.
Consists of the protocol version number, status code, and status information http/1.1 OK
Date: Response time
Server: Servers information
Last-modified: Resource Last modified time is automatically generated by the server
ETag: Unique identity generated after resource modification
Automatically generated by the server
Content-length: Response Body length
Content-type: Type of response resource
The content that the service side returns to the client;
Common 200 for success, 304 document unmodified, 403 no permissions, 404 Not Found, 500 server error
Network Transport Protocol