RFC2616( http://www.ietf.org/rfc/rfc2616.txt )を整理したものです。
HTTPは、クライアントとサーバの間で情報をやりとりするプロトコルです。
クライアント側からサーバ側への処理要求をRequestといい、
サーバ側からクライアント側への処理結果通知をResponseといいます。
______ Request ______ |クライ| ----------------------------------> |サーバ| |アント| <---------------------------------- | | ------ Response ------
Request := Request-Line ; REQUEST種別
*( general-header ; REQUEST/RESOPNSEで共通の項目
| request-header ; REQUESTに関する情報
| entity-header ) ; ENTITYに関する情報
CRLF
[ message-body ] ; クライアント側に送り返す情報。7bit文字列
Request-Line := Method SP Request-URI SP HTTP-Version CRLF
Method := "OPTIONS" ; 利用できるメソッド一覧
| "GET" ; URIで示すファイルを取得する
| "HEAD" ; URIで示すファイルを取得する。message-bodyをRESPONSEで返さない
| "POST" ; URIで示すサービスへの情報の送信
| "PUT" ; URIにファイルを置く
| "DELETE" ; URIのファイルを削除する
| "TRACE" ; 伝送経路のテスト
| extension-method
extension-method := token
general-header := Cache-Control ; 伝送経路のすべての装置に対するコンテンツキャッシュ方式の指定
| Connection ; サーバとクライアントの接続の寿命を規定する
| Date ; 時刻
| Pragma ; 伝送経路のすべての装置に対する何らかの指定(`no-cache`)
| Transfer-Encoding ; 7bit文字列のentity-bodyで、バイナリを送信する方式(`chunked`)
| Upgrade ; 次にresponseを返すときには、このプロトコルを使ってほしい(`HTTP2.0`)
| Via ; 伝送経路情報。proxyサーバ情報が経路順に羅列される
request-header := Accept ; Responseで返すことができるコンテンツのフォーマット(text/htmlなど)
| Accept-Charset ; Responseで返すことができるコンテンツの文字コード
| Accept-Encoding ; Responseで返すことができるコンテンツの圧縮形式
| Accept-Language ; Responseで返すことができるコンテンツの言語
| Authorization ; 認証情報
| From ; 送信元のメールアドレス
| Host ; 送信元のURI
| If-Modified-Since ; キャッシュされたコンテンツが、ここで指定したHTTP-dateより新しければGETする
| If-Match ; 指定されたEntityTagと同じコンテンツをGETする
| If-None-Match ; 指定されたEntityTagと同じコンテンツをGETしない
| If-Range ; コンテンツのLast-Modifiedが指定した日付よりも新しければGETする
| If-Unmodified-Since ; コンテンツのLast-Modifiedが指定した日付よりも古ければGETしない
| Max-Forwards ; TRACE時に使う。経由する最大proxy数
| Proxy-Authorization ; 最初に経由するproxyに対する信用証明書。
| Range ; MESSAGE-BODY中の該当Requestデータの在処
; "bytes 500-999" = 500〜999バイトでが、このREQUESTのデータ
| Referer ; REQUEST-URIを得たURI(リンク元)
| User-Agent ; クライアントの製品名(ブラウザ名)
entity-header := Allow ; クライアントが使えるMETHOD(POST,GET,PUT,...)
| Content-Base ; URIを相対指定するときの基準となる絶対URI
| Content-Encoding ; コンテンツの圧縮方式(gzip(=LZ77) / compress(=LZW) / deflate(=zlib))
| Content-Language ; コンテンツの言語
| Content-Length ; コンテンツの長さ
| Content-Location ; コンテンツのURL
| Content-MD5 ; コンテンツのMD5(ハッシュ値)
| Content-Range ; ENTITY-BODY中の該当コンテンツの在処(※複数のコンテンツを送ることができる=マルチパートMIME)
; "bytes 500-999/1024" = ENTITY-BODY1024バイトのうち頭から500〜999バイトがこのコンテンツ
| Content-Type ; "text/html; charset=ISO-8859-4" , "image/png"など
| ETag ; コンテンツに対して自由につけられる名前
| Expires ; コンテンツの賞味期限。HTTP-date
| Last-Modified ; コンテンツの最終更新日時
| extension-header
extension-header := message-header
entity-body := *OCTET
Response := Status-Line ; REQUESTの処理結果ステータス
*( general-header ; REQUEST/RESOPNSEで共通の項目
| response-header ; RESPONSEに関する情報
| entity-header ) ; ENTITYに関する情報
CRLF
[ entity-body ] ; クライアント側に送り返す情報。7bit文字列
Status-Line := HTTP-Version SP Status-Code SP Reason-Phrase CRLF
Status-Code := "100" ; Continue
| "101" ; Switching Protocols
| "200" ; OK
| "201" ; Created
| "202" ; Accepted
| "203" ; Non-Authoritative Information
| "204" ; No Content
| "205" ; Reset Content
| "206" ; Partial Content
| "300" ; Multiple Choices
| "301" ; Moved Permanently
| "302" ; Moved Temporarily
| "303" ; See Other
| "304" ; Not Modified
| "305" ; Use Proxy
| "400" ; Bad Request
| "401" ; Unauthorized
| "402" ; Payment Required
| "403" ; Forbidden
| "404" ; Not Found
| "405" ; Method Not Allowed
| "406" ; Not Acceptable
| "407" ; Proxy Authentication Required
| "408" ; Request Time-out
| "409" ; Conflict
| "410" ; Gone
| "411" ; Length Required
| "412" ; Precondition Failed
| "413" ; Request Entity Too Large
| "414" ; Request-URI Too Large
| "415" ; Unsupported Media Type
| "500" ; Internal Server Error
| "501" ; Not Implemented
| "502" ; Bad Gateway
| "503" ; Service Unavailable
| "504" ; Gateway Time-out
| "505" ; HTTP Version not supported
| extension-code
extension-code := 3DIGIT
Reason-Phrase := *<TEXT, excluding CR, LF>
general-header := Cache-Control ; 伝送経路のすべての装置に対するコンテンツキャッシュ方式の指定
| Connection ; サーバとクライアントの接続の寿命を規定する
| Date ; 時刻
| Pragma ; 伝送経路のすべての装置に対する何らかの指定(`no-cache`)
| Transfer-Encoding ; 7bit文字列のentity-bodyで、バイナリを送信する方式(`chunked`)
| Upgrade ; 次にrequestを送るときには、このプロトコルを使ってほしい(`HTTP2.0')
| Via ; 伝送経路情報。proxyサーバ情報が経路順に羅列される
response-header := Age ; コンテンツが生成されてからの10進数の秒数。キャッシュの鮮度
| Location ; Requestの結果生成されたサーバ内のファイルへのURI
| Proxy-Authenticate ; StatusCode"407"の付加情報
| Public ; サーバ側が使ってほしいMETHOD(POST,GET,PUT,...)をクライアントに通知する
| Retry-After ; StatusCode"503"の付加情報。HTTP-dataか、10進数の秒数。
| Server ; Webサーバの製品名。Prox`ies`は、general-headerのViaに記録される。
| Vary ; クライアント-サーバ間のネゴシエーション方式
| Warning ; 警告情報
| WWW-Authenticate ; StatusCode"401"の付加情報
entity-header := Allow ; StatusCode"401"の付加情報。サーバが処理できるMETHOD(POST,GET,PUT,...)
| Content-Base ; URIを相対指定するときの基準となる絶対URI
| Content-Encoding ; コンテンツの圧縮方式(gzip(=LZ77) / compress(=LZW) / deflate(=zlib))
| Content-Language ; コンテンツの言語
| Content-Length ; コンテンツの長さ
| Content-Location ; コンテンツのURL
| Content-MD5 ; コンテンツのMD5(ハッシュ値)
| Content-Range ; ENTITY-BODY中の該当コンテンツの在処(※複数のコンテンツを送ることができる=マルチパートMIME)
; "bytes 500-999/1024" = ENTITY-BODY1024バイトのうち頭から500〜999バイトがこのコンテンツ
| Content-Type ; "text/html; charset=ISO-8859-4" , "image/png"など
| ETag ; コンテンツに対して自由につけられる名前
| Expires ; コンテンツの賞味期限。HTTP-date
| Last-Modified ; コンテンツの最終更新日時
| extension-header
extension-header := message-header
entity-body := *OCTET