Introduction to HTTP
1. The full name is Hypertext Transfer Protocol (HTTP), a transport protocol used to transfer hypertext from a World Wide Web server to a local browser.
2. is an application layer protocol, based on the TCP/IP communication protocol to transfer data.
3. Work process: the client sends a request, the server replies to the response, a send a receipt.
HTTP request
HTTP GET, POST, PUT, DELETE corresponding to the network resources of the check, change, add, delete 4 operations
methodologies | clarification |
---|---|
GET | Access to resources, search for information |
POST | transporting entity subject |
PUT | Transmission of documents |
HEAD | Get the first part of the message |
DELETE | Delete file |
I. GET requests
Way:
(1) Entering the URL (web address) directly into the browser
(2) HTML page in some special tags, link (the introduction of CSS), img (images), script (the introduction of JS) in front of the page load are triggered, a (hyperlink) user clicks on the trigger GET request.
(3) from form
Passing a parameter with GET: after the ? followed by the name of the variable, separated by &. For example, add /?a=1 to the url to send a get request.
II. POST requests
Mostly used to submit user-entered data to the server
(1) Parameters are generally passed through the body
(2) Use the plugin hackbar: copy the get url, select postdata, fill in the pass parameters, and click execute.
(3) Through the system () comes with the curl command curl -X POST -d "a=1" http://*****(this part is url)/?a=1
III. Request header
The overall format is a key-value pair structure, where each key-value pair occupies one line, and the key and value are separated by a colon + space.
(1) HOST: value indicates the address and port of the server host (address can be a domain name or IP port number can be omitted or manually specified)
(2) Content-Length: indicates the data length of the body.
(3) Referer: indicates the page from which the page jumped to.
(4) Cookies: an ability provided by the browser to store data locally (the classic application is to keep the client logged in)
(5) User-Agent: Indicates the attribute of the browser or operating system.
(6) Content-Type: indicates the data format of the body.
HPPT response
1. Status Code
(1) 403 Indicates access denied
(2) 405 The server accessed cannot support the method in the request or cannot use the method in the request.
(3) 500 Internal server error