current position:Home>HTTP format

HTTP format

2022-05-15 02:40:50Fat muscle duality

understand

be based on TCP/IP, Default port number 80

There is no connection , One question one answer mode
Do not remember previously transmitted messages
Media independence , Can transfer any class content

Use uniform resource identifiers (URI,Uniform Resource Identifiers) To transfer data and establish connections

Format

client

Request method | Space |URL| Space | Protocol version | Carriage returns
Request header |:| value | Carriage returns
···
Request header |:| value | Carriage returns
Carriage returns
Text ...

Request method

GET Request specific page information , And return the entity body
HEAD
POST Submit data to the specified resource for processing request , Such as submitting user name 、 password
PUT
DELETE
CONNECT
OPTIONS
TRACE
PATCH

URL

scheme://host.domain:port/ route & file

Protocol version

HTTP/1.0
HTTP/1.1

Request header

accept
accept-encoding
accept-language
cookie
user-agent
···

value

ASCII Code description string

Text

Server side

Protocol version | Space | Status code | Space | Status code description
Response head |:| value | Carriage returns
···
Response head |:| value | Carriage returns
Carriage returns
Text ...

Protocol version

HTTP/1.0
HTTP/1.1

Status code

1xx
2xx
3xx
4xx
5xx

Commonly used :
200: The request is successful
404: The requested resource does not exist
500: Internal server error

Status code description

A brief description of the status code , Such as OK

Response head

content-encoding
content-length
content-type
set-cookie
···

value

ASCII Code description string

Text

Text 、 Image and other entities , The specific types are as follows content-type Value representation ,
Such as content-type: text/html; charset=UTF-8
The text is a html Rich text

copyright notice
author[Fat muscle duality],Please bring the original link to reprint, thank you.
https://en.qdmana.com/2022/135/202205142119555195.html

Random recommended