zoukankan      html  css  js  c++  java
  • HTTP权威指南_摘录

    以下内容是摘录自《HTTP 权威指南》(HTTP The Definitive Guide),目前没有中文版,可在google中阅读部分章节。有兴趣想购买的可以在亚马逊上购买:RMB 323.5

    书中详细介绍了网络基础、HTTP的架构、HTTP的安全/认证、编码和国际化等。(最后截取了百度首页与谷歌首页的请求以供分析)

    Common media types
    Media type Description
    text/html Entity body is an HTML document
    text/plain Entity body is a document in plain text
    image/gif Entity body is an image of type GIF
    image/jpeg Entity body is an image of type JPEG
    audio/x-wav Entity body contains WAV sound data
    model/vrml Entity body is a three-dimensional VRML model
    application/vnd.ms-powerpoint Entity body is a Microsoft PowerPoint presentation
    multipart/byteranges Entity body has multiple parts, each containing a different range (in bytes) of the full document
    message/http Entity body contains a complete HTTP message (see TRACE)
    Content-encoding tokens
    Content-encoding value Description
    gzip Indicates that the GNU zip encoding was applied to the entity.
    compress Indicates that the Unix file compression program has been run on the entity.
    deflate Indicates that the entity has been compressed into the zlib format
    identity Indicates that no encoding has been performed on the entity. When a Content-Encoding header is not present, this can be assumed.
    Cache-Control header directives
    Directive Message type Description
    no-cache Request Do not return a cached copy of the document without first revalidating it with the server.
    no-store Request Do not return a cached copy of the document. Do not store the response from the server.
    max-age Request The document in the cache must not be older than the specified age.
    max-stale Request The document may be stale based on the server-specified expiration information, but it must not have been expired for longer than the value in this directive.
    min-fresh Request The document's age must not be more than its age plus the specified amount. In other words, the response must be fresh for at least the specified amount of time.
    no-transform Request The document must not be transformed before being sent.
    only-if-cached Request Send the document only if it is in the cache, without contacting the origin server.
    public Response Response may be cached by any cache.
    private Response Response may be cached such that it can be accessed only by a single client.
    no-cache Response If the directive is accompanied by a list of header fields, the content may be cached and served to clients, but the listed header fields must first be removed. If no header fields are specified, the cached copy must not be served without revalidation with the server.
    no-store Response Response must not be cached.
    no-transform Response Response must not be modified in any way before being served.
    must-revalidate Response Response must be revalidated with the server before being served.
    proxy-revalidate Response Shared caches must revalidate the response with the origin server before serving. This directive can be ignored by private caches.
    max-age Response Specifies the maximum length of time the document can be cached and still considered fresh.
    s-max-age Response Specifies the maximum age of the document as it applies to shared caches (overriding the max-age directive, if one is present). This directive can be ignored by private caches.
    Conditional request types
    Request type Validator Description
    If-Modified-Since Last-Modified Send a copy of the resource if the version that was last modified at the time in your previous Last-Modified response header is no longer the latest one.
    If-Unmodified-Since Last-Modified Send a copy of the resource only if it is the same as the version that was last modified at the time in your previous Last-Modified response header.
    If-Match ETag Send a copy of the resource if its entity tag is the same as that of the one in your previous ETag response header.
    If-None-Match ETag Send a copy of the resource if its entity tag is different from that of the one in your previous ETag response header
    Delta-encoding headers
    Header Description
    ETag Unique identifier for each instance of a document. Sent by the server in the response; used by clients in subsequent requests in If-Match and If-None-Match headers.
    If-None-Match Request header sent by the client, asking the server for a document if and only if the client's version of the document is different from the server's.
    A-IM Client request header indicating types of instance manipulations accepted.
    IM Server response header specifying the type of instance manipulation applied to the response. This header is sent when the response code is 226 IM Used.
    Delta-Base Server response header that specifies the ETag of the base document used for generating the delta (should be the same as the ETag in the client request's If-None-Match header).
    IANA registered types of instance manipulations
    Type Description
    vcdiff Delta using the vcdiff algorithm
    diffe Delta using the Unix diff -e command
    gdiff Delta using the gdiff algorithm
    gzip Compression using the gzip algorithm
    deflate Compression using the deflate algorithm
    range Used in a server response to indicate that the response is partial content as the result of a range selection
    identity Used in a client request's A-IM header to indicate that the client is willing to accept an identity instance manipulation
    Accept headers
    Header Description
    Accept Used to tell the server what media types are okay to send
    Accept-Language Used to tell the server what languages are okay to send
    Accept-Charset Used to tell the server what charsets are okay to send
    Accept-Encoding Used to tell the server what encodings are okay to send
    Accept and matching document headers
    Accept header Entity header
    Accept(ex:image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, image/png, */*) Content-Type(ex:text/html)
    Accept-Language(ex:zh-cn) Content-Language(ex:fr, de, zh-cn)
    Accept-Charset(ex:iso-8859-1, *, utf-8) Content-Type(ex:;charet=utf-8)
    Accept-Encoding(ex:gzip, deflate) Content-Encoding(ex:gzip)
    (Request-Line)	GET / HTTP/1.1
    Accept	image/gif, image/jpeg, image/pjpeg, image/pjpeg, application/x-shockwave-flash, application/vnd.ms-excel, application/vnd.ms-powerpoint, application/msword, application/x-ms-application, application/x-ms-xbap, application/vnd.ms-xpsdocument, application/xaml+xml, */*
    Accept-Encoding	gzip, deflate
    Accept-Language	zh-cn
    Connection	Keep-Alive
    Cookie	PREF=ID=314fbae1650bde00:FF=2:LD=zh-CN:NW=1:TM=1320735923:LM=1320735923:S=oSSPDnEPbXYbWbsp
    Host	www.google.com.hk
    User-Agent	Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.1; Trident/4.0; QQDownload 677; Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1) ; InfoPath.2; .NET CLR 2.0.50727; .NET CLR 3.0.4506.2152; .NET CLR 3.5.30729)
    
    
    (Status-Line)	HTTP/1.1 200 OK
    Cache-Control	private, max-age=0
    Content-Encoding	gzip
    Content-Type	text/html; charset=UTF-8
    Date	Tue, 08 Nov 2011 07:05:23 GMT
    Expires	-1
    Server	gws
    Set-Cookie	NID=52=xxxxxxxxxxxxxx; expires=Wed, 09-May-2012 07:05:23 GMT; path=/; domain=.google.com.hk; HttpOnly
    Transfer-Encoding	chunked
    X-Frame-Options	SAMEORIGIN
    X-XSS-Protection	1; mode=block
    image 
    (Request-Line)	GET / HTTP/1.1
    Accept	*/*
    Accept-Encoding	gzip, deflate
    Accept-Language	zh-cn
    Connection	Keep-Alive
    Cookie	BAIDUID=CEDBBF526CC8742529C8FDDA98EA859F:FG=1
    Host	www.baidu.com
    User-Agent	Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.1; Trident/4.0; QQDownload 677; Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1) ; InfoPath.2; .NET CLR 2.0.50727; .NET CLR 3.0.4506.2152; .NET CLR 3.5.30729)
    
    
    (Status-Line)	HTTP/1.1 200 OK
    Cache-Control	private
    Connection	Keep-Alive
    Content-Encoding	gzip
    Content-Length	3092
    Content-Type	text/html;charset=gb2312
    Date	Tue, 08 Nov 2011 07:07:31 GMT
    Expires	Tue, 08 Nov 2011 07:07:31 GMT
    Server	BWS/1.0

    image

  • 相关阅读:
    浅谈树的重心
    倍增的奇妙用处
    KMP——从入门到不会打题
    万能的进制哈希
    浅谈扫描线算法的应用
    无需Flash录视频——HTML5中级进阶
    一个模仿微信群聊的H5页面
    关于建议
    前端技术学习线路
    Kurento安装与入门02——运行示例前的准备
  • 原文地址:https://www.cnblogs.com/meteoric_cry/p/2243567.html
Copyright © 2011-2022 走看看