On http principle and message header

On the basis of the principles http
http: Hypertext Transport Protocol Hypertext Transfer Protocol
classic has proposed ISO OSI seven-layer model
Here Insert Picture Description
client browser Browser, the server for the http server
and html http is transmitted in text format.
Hypertext Markup
page may contain multiple pages objects. We define each URI with a resource on the Internet
URL: Uniform Resource Identifier Uniform Resource Identifier
URI: Uniform Resource Locator Uniform Resource placeholder
: Example http://www.wang.com:80/images
version http protocol:
http / 0.9: only transmit text information (html). There are design flaws,
HTTP / 1.0: support for multimedia data processing, keep-alive (remain connected) with a cache function
http / 1.1: more requests approach, finer buffer space, persistent connection
MIME: Multipurpose Internet Mail Extension ( multifunctional multipurpose Mail extensions)
Base64: prohibit the two transmission data is encoded into text, and the recipient can be restored back to the original format.
http message:
http transaction: a request and a corresponding response
http method: the GET, the PUT, the HEAD, the POST, the DELETE
http requests: Request
http response: responce
Wherein the http request packet format is as follows:
---- start line (request line)
- the request method, the operation of service execution section desired, such as GET, HEAD, POST, etc.
- resource request may be a relative path, it may be complete the URL of
- the version number of the protocol
-http header
......
body of the request
http response message format

- The version number of the protocol
- status code
- the reason phrases, numbers, status codes readable information
......
response message
headers:
the Name: value
Content-Type: ImagesRF Royalty Free / GIF
divided into three categories:
common header
request header
response headers
http protocol is a species statusless (stateless) protocol: http ended after a transaction, i.e. the line connection is disconnected, is inefficient
and therefore accelerate http two ways: 1. request 2. parallel persistent connection
http request method: GET, HEAD, PUT, pOST , DELETE, OPTIONS, TRACE
extension method: LOCK, COPY, MOVE, MKCOL
gET: request a resource, requires the server to send
hEAD: similar with gET, but it does not require the server to send resources and only transmit the response headers
POST: support html form submission, form has filled the user data, which are sent to the server. Stored by the server to its location (for example, send handler)
PUT: and GET Instead, the document is written to the server, and announcement
DELETE: delete request URL specified resource
OPTIONS: request method for detecting a resource server supports
TRACE: trace request to go through the firewall proxy or gateway
http status code:
1XX: informational status code
2XX: success status code
200 is: the OK 201: Created
3XX: redirect status 301-307
301: Moved Permanently use permanent redirection header in the respective packets "Location: the URL"
302: Found use temporary redirection header "Location respective packets: URL "temporary position
304: not Modified conditional expression used in the request
4XX: client error class
403: Forbidden request is rejected by the server
404: not found request the server can not find the URL
405: method, this method does not allow the allowed not corresponding to the request the URL of
5XX: server class error
500: error internal internal server server error
502: Bad Gateway proxy server received from upstream a spurious response
503: service unavailable server at this time can not provide services, but the future may be useful
headers http:
common headers: request and the response can be used
headers request:
response header:
header entity: specifies an entity attribute
extension header: non-standard header may be created by the program developer
common header:
Connection: defines the response about between the C / S / about the options requested.
For HTTP / 1.0 Connection: Keep-Alive
Via: shows the intermediate node through which packets
cache-control: Cache indication
request headers:
Client-IP:
Host: requested host name and port number, virtual host environment for different hosts
referer: specifies the URL contains the original resources currently requested
User-Agent: User Agent, What tools issued a request
Accept header: user identify customers more love for support is the use of means or ability
Aceept: header specifies the type of server can send the
Accept-Chartset: supports character set
Accept-encoding: support is the encoding used
Accept-language: supports the use of language
conditional request header of
the Expect
the if-modified-since: whether or not modified this resource since the designated time
if-None-Match:
associated with safety request headers:
the Authorization: the client to the authentication data service side such as account number and password.
Cookie: Client Services in distribution of full identity.
Response headers:
Age: duration of response
Server: indicate the name and version of the server program to the client
negotiation headers:
the scope of the current resource in terms of the type of server can accept: Accept-Range.
vary: head of the list, the server will be selected based on the content of the list of the most suitable version, sent to the customer segment
header with security-related:
Set-cookie: server in a client initiates a request is sent to the first token
www-authentication: challenge and require customers to provide account password code.
Headers entities:
the Location: The new location of the resource
Allow: allows clients to request the method
content header:
Content-Encoding
Content-Language
Content-Lenth
Content-the Location
Content-the Range
Content-Type
cache headers:
Etag: entity tag
Expires: expired deadline
Last a modification time: -modifide

Published 56 original articles · won praise 1 · views 10000 +

Guess you like

Origin blog.csdn.net/weixin_41363156/article/details/84485865