Asp.net-http Response Headers

Source: Internet
Author: User
Tags time zones

Reponse Headers

In theory, all response header information should be in response to the request header. But for the sake of efficiency, security, and other considerations, the corresponding response header information is added, which can be seen from:

  1. Cache-control:must-revalidate, No-cache, private. This value tells the client that the server does not want the client to cache the resource, and the next time the resource is requested, it must be re-requested and cannot get the resource from the cached copy.
    Cache-control is an important information in the response header, when the client request header contains a cache-control:max-age=0 request that explicitly indicates that the server resource is not cached, Cache-control as the response information, Usually returns No-cache, meaning, "No cache does not cache Bai", when the client does not contain Cache-control in the request header, the server will often be determined, different resources of different cache policies, For example, Oschina's strategy for caching image resources is cache-control:max-age=86400, which means that from the current time, in 86,400 seconds, the client can read the resource directly from the cached copy without having to request it from the server.
  2. Connection: keep-alive, this field responds to the client's connection:keep-alive, telling the client server that the TCP connection is also a long connection, The client can continue to send HTTP requests using this TCP connection. For more information on long connections, I'll talk about them later.
  3. content-encoding : gzip, tell the client that the resources sent by the server are gzip encoded, and the client should use GZIP to decode the resources after seeing this information.
  4. content-type: Text/html;charset=utf-8, tells the client, the type of the resource file, and the character encoding, the client decodes the resource through Utf-8, and then parses the resource in HTML. Usually we will see some of the website is garbled, often is the server side did not return the correct encoding.
  5. Date : Sun, Sep 06:18:21 GMT, this is the server time when the service sends resources, at first I do not know GMT is Greenwich Place Standard Time, thought is the server time is wrong, also went to the server to see the time. The time sent in the HTTP protocol is GMT, which is mainly to solve the problem of time confusion on the internet and in different time zones when requesting resources from each other.
  6. Expires:sun , 1 01:00:00 GMT, this response header is also related to the cache, telling the client that at this time, can directly access the cache copy, it is obvious that the value of the problem, because the client and server time is not necessarily the same, if the time is different will cause problems. So this response head is not cache-control:max-age=*** This response header is accurate, because the max-age=date in the date is a relative time, not only better understanding, but also more accurate.
  7. Pragma: No-cache, this meaning is equivalent to Cache-control.
  8. Server: tengine/1.4.6, this is the server and the corresponding version, just tell the client server information, no more meaning.
  9. transfer-encoding: chunked, this response header tells the client that the way the server sends the resources is chunked sent. General chunked send the resources are dynamically generated by the server, at the time of sending is not aware of the size of the sending resources, so the use of chunked send, each piece is independent, independent blocks can be labeled their length, the last piece is 0 length, when the client read this 0-length block, you can determine that the resources have been transmitted.
  10. Vary: accept-encoding, tell the cache server, cache compressed files and uncompressed files two versions, now this field is not very useful, because the browser is now supported compression.

The above describes the access to Oschina, the server sends back the response header information, but not all, the following are also often appear, are important:

  1. Content-leng: Resource length, if the server response header does not have transfer-encoding:chunked, that is, if the resource is not chunked transmission, then this field is necessary, Because if the server side does not tell the length of the client resource, then in Connection:keep-alive, that is, the client and the server side is a long connection, the client cannot determine when the resource ends. So this response header is necessary for static resources.
  2. Content-range : Tells the client which department bytes are being sent for the resource, usually the value: bytes 100-1000/5000.
  3. cookies: Used to identify clients, track clients, store user information, and user behavior.
  4. Location : The server puts the real destination of the resource in the response header, directs the client to redirect to this address, and if it returns 302, the value is required, usually this value is a complete url:www.oschina.net.
  5. www-authenticate : This field is mainly used in server resources have access restrictions, usually when the client accesses the server resources, the server will return 401, requiring the client to send authentication information, but also tells the client how to encode the authentication information. The value of this response header is the way the storage server tells the client to encode, usually Basic-64 encoding.



From for notes (Wiz)

Asp.net-http Response Headers

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.