Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Method of HTTP request message in HTTP protocol and HTTP response message and response status code

2025-03-31 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/03 Report--

Today, I will talk to you about the method of HTTP request message in HTTP protocol and the HTTP response message and response status code, which may not be well understood by many people. In order to make you understand better, the editor summarized the following content for you. I hope you can get something according to this article.

I. introduction of HTTP protocol

1.1 the HTTP protocol is a stateless protocol

This request from the same client does not correspond to the last request.

1.2 the position of HTTP protocol in the TCP/IP protocol stack

HTTP is hosted on the TCP protocol. Port: 80

HTTPS is hosted on the TLS/SSL protocol. Port: 443

1.3 request response model for HTTP

HTTP is always the client initiates the request and the server responds.

When the client does not initiate a request, the server pushes the message to the client.

II. HTTP request message

2.1 request message format

Request line

General information header | request header | entity header

CRLF (enter to change the line)

Physical content

Example:

POST / client_security_conf HTTP/1.1

Host: sconf.f.360.cn

Accept: * / *

Connection: Keep-Alive

Cache-Control: no-cache

Content-Length: 185

Content-Type: application/x-www-form-urlencoded

[CRLF]

2.2 request line format

Method to request the URI version number [enter to break the line]

Example: POST / client_security_conf HTTP/1.1\ r\ n

2.3 HTTP request method

GET-request to get the resource identified by the Request-URI.

POST-appends new data to the resource identified by the Request-URI.

HEAD-request to get the response message header of the resource identified by the Request-URI.

PUT-requests the server to store a resource and use Request-URI as its identity.

DELETE-request the server to delete the resource identified by Request-URI.

OPTIONS-request to query the performance of the server, or query options and requirements related to resources.

TRACE-request the server to send back the request information received, mainly for testing or diagnosis.

CONNECT-reserved for future use.

3. HTTP response message

3.1 response message format

Status line

General message header | response header | entity header

CRLF (enter to change the line)

Physical content

Example:

HTTP/1.1 200 OK

Server: nginx/0.6.39

Date: wed, 04 Sep 2013 02:25:05 GMT

Content-Type: text/plain

Content-Length: 118

Connection: close

Vary: Accept-Encoding

[CRLF]

3.2 status line format

Reason for version number status code [enter to change lines]

Example: HTTP/1.1 200OK\ r\ n

3.3 HTTP status response Cod

1XX: indication message-indicates that the request has been received and continues processing.

2XX: success-indicates that the request has been successfully received, understood, and accepted.

3XX: redirect-- further operations must be taken to complete the request.

4XX: client error-the request has a syntax error or the request cannot be fulfilled.

5XX: server side error-the server failed to fulfill the legitimate request.

After reading the above, do you have any further understanding of the method of HTTP request message in HTTP protocol and the HTTP response message and response status code? If you want to know more knowledge or related content, please follow the industry information channel, thank you for your support.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report