A, http protocol combat
1.URL(Uniform Resource Located)
(1) using the URL FFTP, for example: ftp: //rtfm.mit.edu
(2) using the HTTP URL, such as: http: //www.baidu.com
2.HTTP works
(1) Analysis of Over browser URL link in the i
(2) browser requests the IP address of the site to resolve DNS
(3) DNS to resolve the IP address back to the browser
(4) the browser establishes a TCP connection (port 80) and the server
(5) browser requests the document: GET / index.html
(6) the server response is given, the document will be sent to the browser index.html
(7) the release of a TCP connection
(8) the browser displays the contents of index.html
3. Non-persistent connections and persistent connections
4. stateless
Refers to the same client (browser) second visit to the same Web service, the server can not know the client had visited. HTTP is stateless server simplifies the design, making it easier to support a large number of concurrent HTTP request.
5.HTTP packet structure: (1) request packet; (2) returns the message; (3) the packet request method; and (4) response packet status code; (5) a message header or header field; (6) examples of message structure.
6. Request message: All fields ie from the client (browser) sends a request message to a Web server, the message is ASCII code
{
Methods URL version CRLF
Header field name value CRLF
Header field name value CRLF
.....
.....
Header field name value CRLFsho
CRLF
Entity body (Entity body)
} The first row is a request row, for example: GET / index.html / 1.1
Header line: some of the information used to illustrate the browser, server, or message subject /
Such as:
HOST: www.sxtyu.com
Connection:close
User:Agent:Mozilla/5.0
Accept-Language:cn
7. received message
{
Version status code phrase CRLF
Header field name value CRLF
Header field name value CRLF
.....
.....
Header field name value CRLFs
CRLF
Entity body (Entity body)
}
The first row is the status line, such as: HTTP / 1.1 200 OK
Header line: used to illustrate the browser, some of the information server Hu sum message body. Such as:
Date :Wed 08 May 2008 22
Sever:Apach/1.3.2(Unix)
Content0Length:
DateDaDat4096
Content-Type:text/html
The method request header
The method of operation is performed for all objects of the requests, i.e. commands, the requested operation packets are:
GET request to read a Web page header HEAD request to read a Web page
POST attach a named resource (such as a Web page)
PUT request to store a Web page
DELETE Delete Web page
TRACE request for testing, requires the server to return the received
CONNECT to the proxy server
OPTION query for a specific election
8. Response Status Code message
1xx Meaning: notification information; for example: 100 = server is processing client requests
Meaning 2xx: Success; for example: 200 = request succeeded (OK)
Meaning 3xx: Redirection; for example: the position of page change = 301
Meaning 4xx: Client error; for example: 403 = Disable pages; 404 = Page Not Found
Meaning 5xx: Server Error; for example: internal server error = 500; try again later = 503
The respective meanings of the status code, refer to RFC2616 the W3C standards HTTP1.1
http://www.w3.org/Protocols/rfc2616/rtc2616.html
Fifth, the source code
2.CSDN: https: //blog.csdn.net/weixin_44630050 (Xi Jun Jun Moods do not know - Rui)
3. Park blog: https: //www.cnblogs.com/ruigege0000/
4. Welcomes the focus on micro-channel public number: Fourier transform public personal number, only for learning exchanges, backstage reply "gifts" to get big data learning materials