专栏首页游戏杂谈HTTP权威指南_摘录

HTTP权威指南_摘录

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

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

table {border-collapse:collapse; border:none !important; margin:20px 0 !important; display:block;} th, td {border:1px solid #ddd; padding:5px;} th {background-color:#dde; border:1px solid #ccc; color:#36c;} tr:hover {background-color:#eee;} caption {text-align:left; font-size:18px; padding: 5px 0;} pre {margin:30px;}

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 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.

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.

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

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).

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

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 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
(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

本文参与腾讯云自媒体分享计划,欢迎正在阅读的你也加入,一起分享。

我来说两句

0 条评论
登录 后参与评论

相关文章

  • 勿乱动arguments对象

    此题是看到51js论坛上有人提出这个问题:求解arguments对象的内部实现原理

    meteoric
  • as3翻牌动画

    ----------------------------------------------------

    meteoric
  • 【转】Itunes Connect新版本如何提交应用

    5) Enter the following new iOS app information:     a) Company Name: If this...

    meteoric
  • 第十四届浙江财经大学程序设计竞赛重现赛--A-A Sad Story

    Enterprise_
  • numpy.geomspace

    版权声明:本文为博主原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明...

    于小勇
  • 对称排序

    In your job at Albatross Circus Management (yes, it's run by a bunch of clowns),...

    书童小二
  • gcc命令

    在Linux底下搞开发,不可避免的要使用到gcc,gcc选项众多,下面记录下常见的一些选项,网上好多博客也说这个但是很多的都是不对的,我的博客记录参见man g...

    GavinZhou
  • Flexbox 练习和总结

    练习地址: http://flexboxfroggy.com/ Welcome to Flexbox Froggy, a game where you help...

    SmileSmith
  • Kotlin 函数编程详解函数Kotlin 开发者社区

    Functions in Kotlin are declared using the fun keyword:

    一个会写诗的程序员
  • Code Forces 645B Mischievous Mess Makers

    It is a balmy spring afternoon, and Farmer John’s n cows are ruminating about li...

    ShenduCC

扫码关注云+社区

领取腾讯云代金券