HTTP要求ヘッダ詳細


http    : 
============== 
 HTTP     4 :  
     general-header ; 
     request-header ; 
     response-header ; 
     entity-header . 
  
******************************************************************************* 
 General Header Fields 
============================= 
   general header request、response    ,       entity.  
  
  
       -- Cache-Control 
       -- Connection 
       -- Date 
       -- Pragma 
       -- Trailer 
       -- Transfer-Encoding 
       -- Upgrade 
       -- Via 
       -- Warning 
  
******************************************************************************* 
 Request Header Fields 
====================== 
  
   request-header fields          request             , 
  
       -- Accept 
       -- Accept-Charset 
       -- Accept-Encoding 
       -- Accept-Language 
       -- Authorization 
       -- Expect 
       -- From 
       -- Host 
       -- If-Match 
       -- If-Modified-Since 
       -- If-None-Match 
       -- If-Range 
       -- If-Unmodified-Since 
       -- Max-Forwards 
       -- Proxy-Authorization 
       -- Range  
       -- Referer 
       -- TE 
       -- User-Agent 
  
******************************************************************************* 
  Response Header Fields 
=============================== 
  
   response-header fields          response 、    Status-Line     。 
                。    
  
      -- Accept-Ranges 
      -- Age 
      -- ETag 
      -- Location  
      -- Proxy-Authenticate 
      -- Retry-After 
      -- Server 
      -- Vary  
      -- WWW-Authenticate 
  
******************************************************************************* 
 Entity Header Fields 
======================== 
  
   Entity-header fields     entity-body metainformation(      ), 
         body,     request       . 
     metainformation    ;       。 
  
       -- Allow 
       -- Content-Encoding 
       -- Content-Language 
       -- Content-Length 
       -- Content-Location 
       -- Content-MD5 
       -- Content-Range 
       -- Content-Type 
       -- Expires 
       -- Last-Modified 
       -- extension-header 
 
 
【  】http://www.x5dj.com/userforum/00100239/00305167.shtml 
 
 
 、    
HTTP(HyperTextTransferProtocol)           ,     WWW     ,  HTTP          RFC2616。HTTP       /    。             ,          、URI、    、         、           MIME     。             ,              ,                 、              。 
  HTTP                             。              ,        ,                    。HTTP        ,   ,           。         ,  (:)        。         ,               ,          ,      ,            。 
 
1、     
                   ,      Cache-Control、Connection、Date、Pragma、Transfer-Encoding、Upgrade、Via。                    ,            ,            。         UPnP          。 
Cache-Control   
Cache-Control              。             Cache-Control                      。          no-cache、no- store、max-age、max-stale、min-fresh、only-if-cached,          public、 private、no-cache、no-store、no-transform、must-revalidate、proxy-revalidate、 max-age。            : 
Public             。 
Private                  ,         。                    ,                。 
no-cache              
no-store               。                        。 
max-age                   (     )   。 
min-fresh                            。 
max-stale                    。    max-stale    ,                        。 
Date   
Date           ,        rfc822  。  ,Date:Mon,31Dec200104:25:57GMT。Date            ,       ,           。 
Pragma   
Pragma             ,     Pragma:no-cache。 HTTP/1.1   ,     Cache-Control:no-cache  。 
 
2、     
              : 
Method SP Request-URI SP HTTP-Version CRLF  
Method    Request-URI     ,           ,  OPTIONS、GET、HEAD、POST、PUT、DELETE、TRACE。  GET HEAD        WEB     ,             。GET     Request-URI     。HEAD       Request-URI     ,        ,      。POST                      ,        ,    、BBS、            。 
SP    。 
Request-URI  URI  ,       (*) ,                 ,         。 
HTTP-Version     HTTP  ,   HTTP/1.1。 
CRLF       。 
                               。            Accept、Accept-Charset、Accept- Encoding、Accept-Language、Authorization、From、Host、If-Modified-Since、If- Match、If-None-Match、If-Range、If-Range、If-Unmodified-Since、Max-Forwards、 Proxy-Authorization、Range、Referer、User-Agent。                 ,            ,            。 
       : 
GEThttp://class/download.microtool.de:80/somedata.exe 
Host:download.microtool.de 
Accept:*/* 
Pragma:no-cache 
Cache-Control:no-cache 
Referer:http://class/download.microtool.de/ 
User-Agent:Mozilla/4.04[en](Win95;I;Nav) 
Range:bytes=554554- 
       HTTP   (      、    )  GET      URL    。              ,            。 
Host   
Host         Intenet      ,      url            。HTTP/1.1          ,      400     。 
Referer   
Referer           uri      ,              ,     、  cache 。                       。     uri     uri  ,Referer     。        uri  ,             。 
Range   
Range                  。  , 
   500   :bytes=0-499 
     500  :bytes=500-999 
    500   :bytes=-500 
  500       :bytes=500- 
          :bytes=0-0,-1 
        :bytes=500-600,601-999 
             ,     GET  Range   ,       206(PartialContent)      200(OK)。 
User-Agent   
User-Agent                。 
 
3、     
              : 
HTTP-Version SP Status-Code SP Reason-Phrase CRLF 
HTTP-Version     HTTP  ,   HTTP/1.1。 
Status-Code            。 
Reason-Phrase Status-Code           。Status-Code          ,Reason-Phrase          。Status-Code             ,            。        5     : 
1xx:     ,              
2xx:       ,         、      
3xx:      ,         ,          
4xx:     ,                    
5xx:     ,                 
                       ,              Request-URI      。      Age、 Location、Proxy-Authenticate、Public、Retry-After、Server、Vary、Warning、WWW- Authenticate。                 ,            ,            。 
       : 
HTTP/1.0200OK 
Date:Mon,31Dec200104:25:57GMT 
Server:Apache/1.3.14(Unix) 
Content-type:text/html 
Last-modified:Tue,17Apr200106:46:28GMT 
Etag:"a030f020ac7c01:1e9f" 
Content-length:39725426 
Content-range:bytes554554-40279979/40279980 
       HTTP       GET  。              ,            ,              。 
Location    
Location               URI  。 
Server    
Server                    。              ,             。 
 
4、     
                  ,                。              ,     Allow、Content-Base、Content-Encoding、Content-Language、 Content-Length、Content-Location、Content-MD5、Content-Range、Content-Type、 Etag、Expires、Last-Modified、extension-header。extension-header            ,               。               ,       Content-Encoding Content-Type  ,     Content-Length Content-Range  。 
Content-Type    
Content-Type                   ,  HEAD              , GET           Content-Range    
Content-Range    
                  ,            。               ,                   。    : 
Content-Range:bytes-unit SP first-byte-pos - last-byte-pos/entity-legth 
  ,   500         :Content-Range:bytes0-499/1234    http      (  ,                    ),Content-Range       ,Content-Length          。 
Last-modified    
Last-modified                    。 
 
5、 HTTP    (microsoft) 
HTTP     HTTP            HTTP      。        ,       ,       、  、 。          。                   ,               。  
                           ,                   。        。  ,          “Content-Encoding: gzip, compress,”    ,            。             gzip   ,        “Content-Encoding: gzip”。 
               。  ,      “Warning”  。 
      HTTP 1.1    。  :       MIME   。MIME     Internet Engineering Task Force (IETF)    RFC 2045       ,      HTTP 1.1   。   MIME   HTTP 1.1        ,    IEIF  。 
      
                 。 
                  
Cache-Control  "max-age=10"  
Connection    "close"  
Date          "Tue, 11 Jul 2000 18:23:51 GMT"  
Pragma        "no-cache"  
Trailer         "Date"  
Transfer-Encoding "chunked"  
Upgrade       "SHTTP/1.3"  
Via            "HTTP/1.1 Proxy1, HTTP/1.1 Proxy2"  
Warning       "112 Disconnected Operation"  
       
            。 
                       
Accept           "text/html, image/*"  
Accept-Charset   "iso8859-5"  
Accept-Encoding  "gzip, compress"  
Accept-Language "en, fr"  
Authorization     [credentials]  
Content-Encoding "gzip"  
Expect           "100-continue"  
From            "[email protected]"  
Host            "www.microsoft.com"  
If-Match         "entity_tag001"  
If-Modified-Since "Tue, 11 Jul 2000 18:23:51 GMT"  
If-None-Match    "entity_tag001"  
If-Range         "entity_tag001" or "Tue, 11 Jul 2000 18:23:51 GMT"  
If-Unmodified-Since "Tue, 11 Jul 2000 18:23:51 GMT"  
Max-Forwards    "3"  
Proxy-Authorization [credentials]  
Range       "bytes=100-599"  
Referer      "http://www.microsoft.com/resources.asp"  
TE          "trailers"  
User-Agent   "Mozilla/4.0 (compatible; MSIE 5.5; Windows NT 5.0)" 
  
>>           
Accept:       MIME  。  
Accept-Charset:          。  
Accept-Encoding:                ,  gzip。 
Accept-Language:           ,                     。  
Authorization:    ,            WWW-Authenticate     。  
Connection:          。  Servlet       “Keep-Alive”,          HTTP 1.1(HTTP 1.1        ),             ,          (  Applet,  ),             。      , Servlet          Content-Length ,         :      ByteArrayOutputStream,                 。 
Content-Length:           。  
Cookie:  cookie,              
From:      email  ,      Web      ,        。  
Host:  URL       。  
If-Modified-Since:                          ,    304“Not Modified”  。  
Pragma:  “no-cache”                  ,                      。  
Referer:    URL,    URL                。  
User-Agent:     ,  Servlet                    。 
UA-Pixels,UA-Color,UA-OS,UA-CPU:      IE              ,      、    、     CPU  。  
       
            。 
                   
Accept-Ranges  "none"  
Age            "2147483648(2^31)"  
ETag           "b38b9-17dd-367c5dcd"  
Last-Modified    "Tue, 11 Jul 2000 18:23:51 GMT"  
Location        "http://localhost/redirecttarget.asp"  
Proxy-Authenticate [challenge]  
Retry-After      "Tue, 11 Jul 2000 18:23:51 GMT" or "60"  
Server         "Microsoft-IIS/5.0"  
Vary            "Date"  
WWW-Authenticate [challenge]  
       
                  。                   ,        。 
                      
Allow              "GET, HEAD"  
Content-Encoding   "gzip"  
Content-Language  "en"  
Content-Length     "8445"  
Content-Location   "http://localhost/page.asp"  
Content-MD5       [md5-digest]  
Content-Range     "bytes 2543-4532/7898"  
Content-Type      "text/html"  
Expires           "Tue, 11 Jul 2000 18:23:51 GMT"  
Last-Modified      "Tue, 11 Jul 2000 18:23:51 GMT"  
>>           
Allow            ( GET、POST )。 
Content-Encoding      (Encode)  。            Content-Type        。  gzip           HTML       。Java GZIPOutputStream        gzip  ,   Unix  Netscape Windows  IE 4、IE 5    。 
Content-Length       。          HTTP          。 
Content-Type            MIME  。Servlet   text/plain,           text/html。 
Date    GMT  。    setDateHeader                  。  
Expires                ,       ?  
Last-Modified          。      If-Modified-Since         ,           GET,                   ,      304(Not Modified)  。 
Location               。Location         ,    HttpServletResponse sendRedirect  ,            302。  
Refresh                   ,   。          ,      setHeader("Refresh", "5; URL=http://host/path")           。  
             HTML  HEAD  <META HTTP-EQUIV="Refresh" C>  ,    ,                CGI Servlet HTML       。  ,  Servlet  ,     Refresh     。  
  Refresh    “N               ”,   “  N              ”。  ,             Refresh ,   204                ,     Refresh   <META HTTP-EQUIV="Refresh" ...>。  
  Refresh    HTTP 1.1        ,      , Netscape IE    。  
      
    HTTP        。 
GET /articles/news/today.asp HTTP/1.1 
Accept: */* 
Accept-Language: en-us 
Connection: Keep-Alive 
Host: localhost 
Referer: http://localhost/links.asp 
User-Agent: Mozilla/4.0 (compatible; MSIE 5.5; Windows NT 5.0) 
Accept-Encoding: gzip, deflate 
        ,       (GET)、     (/articles/news/today.asp)   HTTP    (HTTP/1.1)。         ,                  。           ,      。 
      
Web                   。          ,              ,      : 
HTTP/1.1 200 OK 
Server: Microsoft-IIS/5.0 
Date: Thu, 13 Jul 2000 05:46:53 GMT 
Content-Length: 2291 
Content-Type: text/html 
Set-Cookie: ASPSESSIONIDQQGGGNCG=LKLDFFKCINFLDMFHCBCBMFLJ; path=/ 
Cache-control: private 
... 
           。         HTTP   、     (200)      。        ,        ,       (      ),           。 
  HTTP   、     ,   http://www.w3.org/Protocols/ HTTP  。 
  
  :HTTP         
                
100 Continue          ,               。(HTTP 1.1 ) 
101 Switching Protocols                     (HTTP 1.1  
200 OK     , GET POST           。 
201 Created           ,Location      URL。 
202 Accepted       ,       。  
203 Non-Authoritative Information          ,           ,           (HTTP 1.1 )。  
204 No Content      ,              。 
205 Reset Content       ,               。               (HTTP 1.1 )。  
206 Partial Content          Range  GET  ,       (HTTP 1.1 )。  
300 Multiple Choices                 ,               。            ,    Location     。  
301 Moved Permanently             ,  URL Location    ,            URL。  
302 Found    301,   URL           ,       。  , HTTP1.0         “Moved Temporatily”,        ,           URL,              。              301    。  ,          http://host/~user(        ),       301,     302。    ,               GET           。   307。  
303 See Other    301/302,      ,        POST,Location               GET  (HTTP 1.1 )。  
304 Not Modified                      (     If-Modified-Since                 )。       ,              。 
305 Use Proxy            Location            (HTTP 1.1 )。 
307 Temporary Redirect  302(Found)  。           302       ,        POST,         POST      303      。      ,HTTP 1.1   307,               :   303   ,           GET POST  ;   307  ,         GET      。(HTTP 1.1 )  
400 Bad Request         。  
401 Unauthorized                   。        WWW-Authenticate ,           /     ,        Authorization        。  
403 Forbidden      。          ,      。                    。  
404 Not Found            。          ,  
405 Method Not Allowed     (GET、POST、HEAD、DELETE、PUT、TRACE )         。(HTTP 1.1 )  
406 Not Acceptable          ,   MIME      Accpet         (HTTP 1.1 )。  
407 Proxy Authentication Required    401,                 。(HTTP 1.1 ) 
408 Request Timeout             ,            。             。(HTTP 1.1 )  
409 Conflict    PUT    。               ,        。(HTTP 1.1 ) 
410 Gone             ,                   。  404     ,  407               , 404              。(HTTP 1.1 ) 
411 Length Required          ,        Content-Length 。(HTTP 1.1 ) 
412 Precondition Failed                (HTTP 1.1 )。  
413 Request Entity Too Large                      。                   ,       Retry-After (HTTP 1.1 )。  
414 Request URI Too Long URI  (HTTP 1.1 )。  
416 Requested Range Not Satisfiable                 Range 。(HTTP 1.1 )  
500 Internal Server Error              ,         。  
501 Not Implemented                 。  ,              PUT  。 
502 Bad Gateway             ,              ,             。  
503 Service Unavailable                  。 
504 Gateway Timeout               ,                 。(HTTP 1.1 )  
505 HTTP Version Not Supported              HTTP