HTTP basic knowledge

Source: Internet
Author: User

  • HTTP connection Process
  • Request method
  • Request Header
  • HTTP Request Header Headers
      • Status code
      • Message structure
      • Cookie, session and Token
        • Cookies
        • Session
        • Token

    Http://www.runoob.com/http/http-messages.html

    HTTP connection Process

    ?

    Request method
    Request Method Type Description
    GET Requests the specified page information and returns the entity principal.
    POST Submits data to the specified resource for processing requests (such as submitting a form or uploading a file). The data is included in the request body. A POST request may result in the creation of new resources and/or modification of existing resources.
    OPTIONS Allows clients to view server performance.
    HEAD Similar to a GET request, except that there is no specific content in the returned response to get the header
    PUT Supersedes the contents of the specified document from the data that the client sends to the server.
    DELETE Requests that the server delete the specified page.
    CONNECT The http/1.1 protocol is reserved for proxy servers that can change connections to pipelines.
    TRACE echo the requests received by the server, primarily for testing or diagnostics.
    Request header HTTP Request Header header Header
    Request headers type explain Example
    Accept Specify what types of content clients can receive Accept:text/plain, text/html
    Accept-charset The set of character encodings that the browser can accept Accept-charset:iso-8859-5
    Accept-encoding Specifies the Web server to which the browser can support return content compression encoding type Accept-encoding:compress, gzip
    Accept-language Browser-acceptable language Accept-language:en,zh
    Accept-ranges You can request one or more child range fields for a Web page entity Accept-ranges:bytes
    Authorization Authorization Certificate for HTTP Authorization Authorization:basic qwxhzgrpbjpvcgvuihnlc2ftzq==
    Cache-control Specify the caching mechanism that requests and responses follow Cache-control:no-cache
    Connection Indicates whether a persistent connection is required. (HTTP 1.1 defaults to persistent connection) Connection:close
    Cookies When an HTTP request is sent, all cookie values stored under that request domain are sent to the Web server. Cookie: $Version = 1; Skin=new;
    Content-length The requested content length content-length:348
    Content-type The requested MIME information corresponding to the entity content-type:application/x-www-form-urlencoded
    Date Date and time the request was sent Date:tue, 08:12:31 GMT
    Expect The specific server behavior of the request Expect:100-continue
    From Email from the user who made the request From: [email protected]
    Host Specify the domain name and port number of the requested server Host:www.zcmhi.com
    If-match Only valid if the request content matches the entity If-match: "737060cd8c284d8af7ad3082f209582d"
    If-modified-since If the requested part is modified after the specified time, the request succeeds, and the 304 code is returned without modification If-modified-since:sat, Oct 19:43:31 GMT
    If-none-match If the content does not change the return 304 code, the parameter is the server's previously sent ETag, and the server responded to the ETag comparison to determine whether the change If-none-match: "737060cd8c284d8af7ad3082f209582d"
    If-range If the entity does not change, the server sends the missing portion of the client, otherwise the entire entity is sent. The parameters are also ETag If-range: "737060cd8c284d8af7ad3082f209582d"
    If-unmodified-since Request succeeds only if the entity has not been modified since the specified time If-unmodified-since:sat, Oct 19:43:31 GMT
    Max-forwards Limit the time that information is transmitted through agents and gateways Max-forwards:10
    Pragma Used to include implementation-specific instructions Pragma:no-cache
    Proxy-authorization Connect to an authorization certificate for the agent Proxy-authorization:basic qwxhzgrpbjpvcgvuihnlc2ftzq==
    Range Request only part of an entity, specify a range range:bytes=500-999
    Referer The address of the previous page, which is immediately followed by the current request page, Referer:http://www.zcmhi.com/archives/71.html
    TE The client is willing to accept the transfer encoding and notifies the server to accept the trailing header information te:trailers,deflate;q=0.5
    Upgrade Specify some kind of transport protocol to the server for the server to convert (if supported) upgrade:http/2.0, shttp/1.3, irc/6.9, rta/x11
    User-agent The content of the user-agent contains the user information that made the request user-agent:mozilla/5.0 (Linux; X11)
    Via Notifies the intermediary gateway or proxy server address, communication protocol via:1.0 Fred, 1.1 nowhere.com (apache/1.1)
    Warning About warning messages for message entities warn:199 Miscellaneous Warning
    Status code
    Status Code Status Description
    $ OK indicates that the request is handled properly by the server
    204 No Content means the request has been processed successfully, but no content is returned, that is, there is no message entity in the returned response message, and the browser page does not update
    301 Moved permanently Permanent Reset To, indicates that the requested resource has been permanently moved to another location, meaning that the resource has been assigned a new URI
    302 Found temporary redirection indicating that the requested resource was temporarily moved to a resource requested by another location is temporarily provisioned to the new URI
    . Bad Request indicates that the request message has a syntax error or parameter error and the server does not understand that the server should not repeat the request.
    401 Unauthorized indicates that the request sent requires HTTP authentication information or authentication failed. The response that returns 401 must contain a www-authe that applies to the requested resource Nticate header to challenge user information
    403 Forbidden indicates that access to the requested resource was rejected by the server
    404 not Found indicates that the server could not find the resource you requested
    $ Internal server Error indicates The server made an error while executing the request, possibly a bug in the Web app or a temporary failure.
    503 Service unavailable indicates server overload or shutdown maintenance, cannot process please Request
    Message structure

    ?

    Cookies, session and Tokencookie

    Cookies are divided into ' sessions ' and ' persistent 'cookies

    • Session Cookie: is a temporary cookie that has no expiration time and is deleted as the user exits the browser. cannot be shared by the browser. (often used to save SessionID)
    • Persistent Cookie: A cookie that is stored on a hard disk, usually with an expiration time and, if it expires, the cookie is deleted. Can be shared by the browser

    The cookie principle is as follows:

    ?

    Advantages:

      • Save on the client, without consuming server resources.

    Disadvantages:

      • Security level is the lowest of the three, easy to be hijacked and exploited
      • Restricted by the browser is very large
      • Storage is limited in size and quantity
      • cannot be used where cookies are disabled
    Session

    Session: Also known as "conversation control". is the properties and configuration information required to store a specific user session. When a user jumps between the application's Web pages, the variables stored in the session object are not lost, but persist throughout the user's session.

    The session principle is as follows:

    ?

    Advantages:

      • Relative cookies are more secure.
      • The storage object can be flexibly controlled.

    Disadvantages:

      • There is a distributed system session sharing problem. Require Redis and other ways to resolve.
      • Because the session is in a cookie, it also inherits the drawbacks of the cookie.
    Token

    https://my.oschina.net/jamesfancy/blog/1613994 This article explains the token in great detail.

    HTTP basic knowledge

    Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.