naobe @ ウィキ
RFC2616概要
最終更新:
naobe
-
view
HTTPに戻る
拡張BNF記法
| 項目 | 説明 |
|---|---|
| | | または |
| () | 単独要素 |
| N*M要素 | 最低N、最大M個、要素を繰り返す。Nは省略すると0。Mは省略すると無限大 |
| N#M要素 | 最低N、最大M個、要素を繰り返す。要素と要素の間には","を配置する。Nは省略すると0。Mは省略すると無限大。1#elementは( *LWS element *( *LWS "," *LWS element ))と同じ |
| [] | 省略可能 |
| ; | コメント |
| DQUOTE | ダブルクウォート。" |
基本ルール
このRFCのために定義した文字列
| 項目 | 説明 |
|---|---|
| OCTET | データの8ビットシーケンス |
| CHAR | ASCIIコードの0x00-0x7f |
| CTL | コントロールコード。(0x00-0x1f|0x7f)。0x7fはDEL |
| TEXT | コントロールコードを除いたCHAR。LWSは含む。 |
| token | コントロールコードとセパレータを除いた1個以上のCHAR。1*<any CHAR except CTLs or separators> |
| separators | "(" | ")" | "<" | ">" | "@"| "," | ";" | ":" | "\" | <">| "/" | "[" | "]" | "?" | "="| "{" | "}" | SP | HT |
| LWS | Linear White Space。[CRLF] 1*( SP | HT ) |
| SP | 空白。ASCIIコードの0x20 |
| CRLF | 復帰改行。0x0d0a |
| DIGIT | 0..9 |
HTTPメッセージ
HTTP-message = Request | Response ; HTTP/1.1 messages
リクエスト
Request = Request-Line ; Section 5.1
*(( general-header ; Section 4.5
| request-header ; Section 5.3
| entity-header ) CRLF) ; Section 7.1
CRLF
[ message-body ] ; Section 4.3
Request-Line = Method SP Request-URI SP HTTP-Version CRLF
Method = "OPTIONS" ; Section 9.2
| "GET" ; Section 9.3
| "HEAD" ; Section 9.4
| "POST" ; Section 9.5
| "PUT" ; Section 9.6
| "DELETE" ; Section 9.7
| "TRACE" ; Section 9.8
| "CONNECT" ; Section 9.9
| extension-method
extension-method = token
Request-URI = "*" | absoluteURI | abs_path | authority
HTTP-Version = "HTTP" "/" 1*DIGIT "." 1*DIGIT
general-header = Cache-Control ; Section 14.9
| Connection ; Section 14.10
| Date ; Section 14.18
| Pragma ; Section 14.32
| Trailer ; Section 14.40
| Transfer-Encoding ; Section 14.41
| Upgrade ; Section 14.42
| Via ; Section 14.45
| Warning ; Section 14.46
リクエストヘッダ
request-header = Accept ; Section 14.1
| Accept-Charset ; Section 14.2
| Accept-Encoding ; Section 14.3
| Accept-Language ; Section 14.4
| Authorization ; Section 14.8
| Expect ; Section 14.20
| From ; Section 14.22
| Host ; Section 14.23
| If-Match ; Section 14.24
| If-Modified-Since ; Section 14.25
| If-None-Match ; Section 14.26
| If-Range ; Section 14.27
| If-Unmodified-Since ; Section 14.28
| Max-Forwards ; Section 14.31
| Proxy-Authorization ; Section 14.34
| Range ; Section 14.35
| Referer ; Section 14.36
| TE ; Section 14.39
| User-Agent ; Section 14.43
レスポンス
Response = Status-Line ; Section 6.1
*(( general-header ; Section 4.5
| response-header ; Section 6.2
| entity-header ) CRLF) ; Section 7.1
CRLF
[ message-body ] ; Section 7.2
Status-Line = HTTP-Version SP Status-Code SP Reason-Phrase CRLF
Reason-Phrase = *<CR, LF を含まない TEXT>
ステータスコード
1xx: Informational - リクエストは受け入れられ、処理を続けている 2xx: Success - 動作は正常に受信され、理解され、受け入れられた 3xx: Redirection - リクエストを完了するためには、さらに動作を行わなければならない 4xx: Client Error - リクエストは間違った構文か、果たす事のできないものを含んでいる 5xx: Server Error - サーバは明白に明らかにリクエストを果たすのに失敗した
Status-Code=
"100" ; Section 10.1.1: Continue
| "101" ; Section 10.1.2: Switching Protocols
| "200" ; Section 10.2.1: OK
| "201" ; Section 10.2.2: Created
| "202" ; Section 10.2.3: Accepted
| "203" ; Section 10.2.4: Non-Authoritative Information
| "204" ; Section 10.2.5: No Content
| "205" ; Section 10.2.6: Reset Content
| "206" ; Section 10.2.7: Partial Content
| "300" ; Section 10.3.1: Multiple Choices
| "301" ; Section 10.3.2: Moved Permanently
| "302" ; Section 10.3.3: Found
| "303" ; Section 10.3.4: See Other
| "304" ; Section 10.3.5: Not Modified
| "305" ; Section 10.3.6: Use Proxy
| "307" ; Section 10.3.8: Temporary Redirect
| "400" ; Section 10.4.1: Bad Request
| "401" ; Section 10.4.2: Unauthorized
| "402" ; Section 10.4.3: Payment Required
| "403" ; Section 10.4.4: Forbidden
| "404" ; Section 10.4.5: Not Found
| "405" ; Section 10.4.6: Method Not Allowed
| "406" ; Section 10.4.7: Not Acceptable
| "407" ; Section 10.4.8: Proxy Authentication Required
| "408" ; Section 10.4.9: Request Time-out
| "409" ; Section 10.4.10: Conflict
| "410" ; Section 10.4.11: Gone
| "411" ; Section 10.4.12: Length Required
| "412" ; Section 10.4.13: Precondition Failed
| "413" ; Section 10.4.14: Request Entity Too Large
| "414" ; Section 10.4.15: Request-URI Too Large
| "415" ; Section 10.4.16: Unsupported Media Type
| "416" ; Section 10.4.17: Requested range not satisfiable
| "417" ; Section 10.4.18: Expectation Failed
| "500" ; Section 10.5.1: Internal Server Error
| "501" ; Section 10.5.2: Not Implemented
| "502" ; Section 10.5.3: Bad Gateway
| "503" ; Section 10.5.4: Service Unavailable
| "504" ; Section 10.5.5: Gateway Time-out
| "505" ; Section 10.5.6: HTTP Version not supported
| extension-code
extension-code = 3DIGIT
レスポンスヘッダ
response-header = Accept-Ranges ; Section 14.5
| Age ; Section 14.6
| ETag ; Section 14.19
| Location ; Section 14.30
| Proxy-Authenticate ; Section 14.33
| Retry-After ; Section 14.37
| Server ; Section 14.38
| Vary ; Section 14.44
| WWW-Authenticate ; Section 14.47
エンティティ
entity-header = Allow ; Section 14.7
| Content-Encoding ; Section 14.11
| Content-Language ; Section 14.12
| Content-Length ; Section 14.13
| Content-Location ; Section 14.14
| Content-MD5 ; Section 14.15
| Content-Range ; Section 14.16
| Content-Type ; Section 14.17
| Expires ; Section 14.21
| Last-Modified ; Section 14.29
| extension-header
extension-header = message-header
message-header = field-name ":" [ field-value ]
field-name = token
field-value = *( field-content | LWS )
field-content = <field-value を構成し、*TEXT あるいは
token, separators, quoted-string を連結
したものから成る OCTET>
message-body = entity-body
| <Transfer-Encoding にてエンコードされた entity-body>
entity-body = *OCTET
接続
- 持続的接続は、クライアントとサーバが TCP 接続を閉じる時に合図を行えるというメカニズムを提供する。この合図は、Connection ヘッダフィールド (section 14.10) を用いて示す。
- HTTP/1.1 サーバは、HTTP/1.1 クライアントがリクエスト中に "close" という connection-token を含んでいる Connection ヘッダを送られなければ、持続的接続を維持するつもりである事を想定してもよい。
- 持続的接続をサポートするクライアントは、そのリクエストを "パイプライン" する事ができる (例えば、複数のレスポンスを待つ事無く、複数のリクエストを送る)。サーバは、リクエストが受信されたのと同じ順番で、それらのリクエストのレスポンスを返さなければならない。
