整理 HTTP协议:头定义

2012年4月2日 发表评论 阅读评论

HTTP头定义介绍

1 Accept 指示能够接受的返回数据的范围 request-header

语法:
Accept = "Accept" ":" #( media-range[accept-params] )
media-range    = ( "*/*"
                 | ( type "/" "*" )
                 | ( type "/" subtype )
                 ) * ( ";" parameter )
accept-params = ";" "q" "=" qvalue *( accept-extension )
accept-extension = ";" token [ "=" ( token | quoted-string ) ]
例如:Accept: */*

2 Accept-Charset 指示返回数据的字符集 request-header

Accept-Charset = "Accept-Charset" ":"
              1#( ( charset | "*" )[ ";" "q" "=" qvalue ] )
Accept-Charset: iso-8859-5, unicode-1-1;q=0.8

3 Accept-Encoding 有点类是Accept request-header
Accept-Encoding = "Accept-Encoding" ":"
                          1#( codings [ ";" "q" "=" qvalue ] )
codings          = ( content-coding | "*" )
Accept-Encoding: *

4 Accept-Language request-header
Accept-Language = "Accept-Language" ":"
                         1#( language-range [ ";" "q" "=" qvalue ] )
language-range = ( ( 1*8ALPHA *( "-" 1*8ALPHA ) ) | "*" )

5 Accept-Ranges 指明服务器能接受的请求资源范围 response-header
Accept-Ranges     = "Accept-Ranges" ":" acceptable-ranges
acceptable-ranges = 1#range-unit | "none"
Accept-Ranges: bytes

6 Age 在第一次请求服务到下次服务器之间时间内,如果内容没有改变并且Age没有过期,
将传回缓存回发数据。response-header
Age = "Age" ":" age-value
age-value = delta-seconds

7 Allow 指示资源能被请求的形式 entity-header
Allow   = "Allow" ":" #Method

Allow: GET, HEAD, PUT

8 Authorization 用户授权
Authorization = "Authorization" ":" credentials

9 Cache-Control 指定必须遵循缓存机制 general-header
Cache-Control   = "Cache-Control" ":" 1#cache-directive
    cache-directive = cache-request-directive
         | cache-response-directive
    cache-request-directive =
           "no-cache"                         
         | "no-store"                        
         | "max-age" "=" delta-seconds        
         | "max-stale" [ "=" delta-seconds ]  
         | "min-fresh" "=" delta-seconds      
         | "no-transform"                    
         | "only-if-cached"                 
         | cache-extension                  
     cache-response-directive =
           "public"                             
         | "private" [ "=" <"> 1#field-name <"> ]
         | "no-cache" [ "=" <"> 1#field-name <"> ]
         | "no-store"                            
         | "no-transform"                       
         | "must-revalidate"                    
         | "proxy-revalidate"                 
         | "max-age" "=" delta-seconds        
         | "s-maxage" "=" delta-seconds        
         | cache-extension                      
    cache-extension = token [ "=" ( token | quoted-string ) ]

10 Connection general-header

11 Content-Encoding entity-header

12 Content-Language entity-header

13 Content-Length entity-header

14 Content-Location entity-header

15 Content-MD5 entity-header

16 Content-Range entity-header

17 Content-Type entity-header

18 Date general-header

19 ETag response-header

20 Expect request-header

21 Expires entity-header

22 From request-header

23 Host request-header

24 If-Match request-header

25 If-Modified-Since request-header

26 If-None-Match request-header

27 If-Range request-header

28 If-Unmodified-Since request-header

29 Last-Modified entity-header

30 Location response-header

31 Max-Forwards request-header

32 Pragma general-header

33 Proxy-Authenticate response-header

34 Proxy-Authorization request-header

35 Range

36 Referer request-header

37 Retry-After response-header

38 Server response-header

39 TE request-header

40 Trailer general field

41 Transfer-Encoding general-header

42 Upgrade general-header

43 User-Agent request-header
User-Agent     = "User-Agent" ":" 1*( product | comment )

44 Vary

45 Via general-header

46 Warning general-header

47 WWW-Authenticate response-header


转载请注明来自:[MSN Spaces]http://msn.shandian.biz/329.html

  1. 本文目前尚无任何评论.