状態符号

状態符号 (HTTP)

[627] 状態符号 (ステータスコード) (status code) は、応答の種別を表す3桁の数字列です。

[628] HTTP および派生プロトコルでは、一部共通する状態符号が使われています。 先頭1桁は状態符号の分類を表しており、下2桁がその細分類を表しています。

仕様書

呼称

[18] 状態符号は、俗に応答符号 (レスポンスコード) (response code) とも呼ばれます。 RFC 7230 でも1箇所応答符号と呼んでいるところがありましたが、 正誤表で訂正されています >>17

[46] 文脈上曖昧でない場合は、 status ないし code と略されることがあります。

[47] XHR属性名は、 status です。

[51] Fetch Standard は、「状態 (status) 符号 (code) である >>50」とわけのわからない定義をしています。

意味

[622] 状態符号は、クライアント要求を理解し満足しようと試みた結果を説明するものです >>620, >>626

[623] 応答メッセージの他の部分は、状態符号ごとに定義された意味に照らして解釈されます >>620

[13] ヘッダーの中には状態符号によって意味が変わるものがあります。 またメッセージ本体の意味は状態符号によって変わります。

[8] 1xx は途中経過の応答を表すなど、 HTTP接続の状態の管理にも状態符号は影響を及ぼします。 204 のように状態符号によってメッセージ本体が存在しなくなることもありますが、 新規の状態符号にはそのように HTTPメッセージの構文に影響をあたえることは認められていません >>7

構文

[621] 状態符号は、3桁のASCII数字です >>620

  1. ASCII数字
  2. ASCII数字
  3. ASCII数字

[632] 最初の1桁は分類 (class) を表します。 残りの2桁はその分類内の種別を表しています。 >>626

[15] 下2桁には特に意味はありません。従って 401201 に特に関係はありません。ただし下2桁が 00状態符号は既定の状態符号となっています (>>629)。

[14] HTTP の仕様書では、 2xx のように「xx」 を使って当該分類に含まれる状態符号すべてを表しています。

[9] RFC 7231 は、提案中でまだ用いるべきでない状態符号について 4NN, 3N0 .. 3N9 のような「N」構文を提唱しています >>7

[10] これまでに実際に提案中や非標準の状態符号の意味が衝突したり、 非標準の状態符号と標準化された状態符号の意味が衝突したりする例があります。

[11] HTTP から派生したプロトコルの状態符号HTTP でも非標準の状態符号は、50番台や90番台を使って HTTP の標準の状態符号との衝突を避けようと試みていることがあります。

[12] しかし実際にはそうでないものもあり、そうでないものは HTTP の標準の状態符号と衝突していることもあります。また派生プロトコル同士で衝突していることもあります。

[48] サーバーが3桁以外のASCII数字列を指定した場合、それが十進整数として解釈されます。 従って非標準な応答の場合は 100 から 999 の範囲の外の数値が得られるかもしれませんし、 非標準な応答は 3桁の整数を表していても先導0により4桁以上になっているかもしれません。

[49] XHR などでは、ネットワークエラーを表すために整数 0 が用いられます。また IE の実装では4桁や5桁の Windows ライブラリーのエラーコードが状態符号として用いられることがあります。

文脈

[33] 次の場面で使われます。

理由句

[634] 状態符号は、状態行において理由句と組で記述されます。 仕様書では状態符号に対応する理由句が定義されていますが、 これはあくまで一例に過ぎず、は任意の値を指定できます。

詳しくは理由句を参照。

取り扱いに注意が必要な状態符号

[62] いくつかの状態は、取り扱いに注意が必要です。

[63] 0 は、ネットワークエラーなどで使われます。古い実装は HTTP 以外のプロトコルの成功の応答0 を返すことがあります。

[66] 1xx は、HTTP接続において特別な扱いを受けます。

[67] 204205304応答本体を持ちません。

[64] 207 は、複数の応答をまとめたことを表します。 その中に含まれる実際の応答2xx (成功) とは限りません。

[65] 304 は、 3xx ですがHTTPリダイレクトではありません。

[68] 407511 は、プロキシ認証ネットワーク認証のエラーを表しています。 つまり起源サーバーではなく、途中の他の (第三者の) サーバーが返した応答です。

処理

[629] HTTPクライアントは、すべての状態符号を理解する必要はありません。 しかし、未対応なら状態符号の最初の1桁 x で表される分類 (class) に基づき、 x00 と同じように扱わなければなりません>>626

[630] そのため x00 は実装することを要求されていると思われます。
[633] 099 以下や 600 以上をどう処理するべきなのかは不明です。
[637] 3xx では未知の状態符号の処理の規定があります。

[631] 未知の状態符号応答は、キャッシュしてはなりません >>626

:status 疑似ヘッダー (HTTP)

[38] HTTP/2 応答:status 疑似ヘッダーは、状態符号を表します >>37

[39] 応答:status 疑似ヘッダーを含まなければなりません >>37

[40] :status 疑似ヘッダーが含まれない応答は、 奇形です >>37

[41] 複数含まれるのを禁止はしていませんが、奇形とみなすべきでしょうか。

[53] Firefox は最初を採用します。 Chrome は最後を採用します。 どちらもエラーとはしないようです。

[42] 要求トレーラー部に含まれる場合、奇形です。

[54] 値が数値でないときどう処理するべきかは不明です。

[55] ChromeFirefox も先頭の非負整数応答状態として使います。 非負整数がないとき、どちらも 200 とします。 Chrome はその続きがあれば、理由句として使います。 それ以外の場合や Firefox は、仕様書に由来する標準的な理由句を使います。 仕様書に無いとき、 ChromeOKFirefoxNo Reason Phrase とします。

status IDL 属性 (XMLHttpRequest)

仕様書

非 HTTP プロトコルの場合

[28] HTTP 以外のプロトコルの場合の status 属性の値について XHR では規定されていません XHR から fetch の定義が参照されている WA1 では、非 HTTP プロトコル状態符号HTTP を準用して与えられているかのように扱うとされていますが、 明確な対応関係を規定しているわけではありません。

[29] MDN の文書では file:ftp:HTTP では無いので常に 0 を返すと述べられています >>30

状態符号の一覧

[1] HTTP 及び派生プロトコルでは次のような状態符号が使われています。

状態符号典型的な理由語句出典
0HTTP
1xxHTTP, RTSP, SIP
100ContinueHTTP ([RFC 2068], [RFC 2616]), RTSP ([RFC 2326])
100TryingSIP ([RFC 2543], [RFC 3261]), Q4S
101Switching ProtocolsHTTP/1.1 ([RFC 2068], [RFC 2616])
102ProcessingHTTP ([RFC 2518])
103CheckpointHTTP
103Access denied while creating Web ServiceHTTP
103Early HintsHTTP
104File Format or Program ErrorHTTP
122Request-URI too longHTTP
180RingingSIP ([RFC 2543], [RFC 3261])
181Call Is Being ForwardedSIP ([RFC 2543], [RFC 3261])
182QueuedSIP ([RFC 2543], [RFC 3261])
183Session ProgressSIP ([RFC 3261])
2xxHTTP, RTSP, SIP
200OKHTTP ([RFC 1945], [RFC 2068], [RFC 2616]), RTSP ([RFC 2326]), SIP ([RFC 2543], [RFC 3261]), CGI ([RFC 3875]), SSTP, mediaont-api, Q4S
201CreatedHTTP ([RFC 1945], [RFC 2068], [RFC 2616]), RTSP ([RFC 2326])
202AcceptedHTTP ([RFC 1945], [RFC 2068], [RFC 2616]), SIP ([RFC 3265])
203Non-Authoritative InformationHTTP/1.1 ([RFC 2068], [RFC 2616])
204No ContentHTTP ([RFC 1945], [RFC 2068], [RFC 2616]), SSTP, mediaont-api
205Reset ContentHTTP ([RFC 2068], [RFC 2616])
206Partial ContentHTTP ([RFC 2068], [RFC 2616]), mediaont-api
207Multi-StatusHTTP ([RFC 2518])
208Already ReportedHTTP
210BreakSSTP
220Uses Protocol ExtensionsHTTP
226IM UsedHTTP
235Authentication CompletedHTTP (I-D)
236Proxy Authentication CompletedHTTP (I-D)
250Low on Storage SpaceRTSP ([RFC 2326])
3xxHTTP, RTSP, SIP
300Multiple ChoicesHTTP ([RFC 1945], [RFC 2068], [RFC 2616]), RTSP ([RFC 2326]), SIP ([RFC 2543], [RFC 3261])
301Moved PermanentlyHTTP ([RFC 1945], [RFC 2068], [RFC 2616]), RTSP ([RFC 2326]), SIP ([RFC 2543], [RFC 3261])
302Moved TemporarilyHTTP ([RFC 1945], [RFC 2068]), RTSP ([RFC 2326]), SIP ([RFC 2543], [RFC 3261])
302FoundHTTP ([RFC 2616]), CGI ([RFC 3875])
303See OtherHTTP ([RFC 2068], [RFC 2616]), RTSP ([RFC 2326]), SIP ([RFC 2543])
304Not ModifiedHTTP ([RFC 1945], [RFC 2068], [RFC 2616]), RTSP ([RFC 2326])
305Use ProxyHTTP ([RFC 2068], [RFC 2616]), RTSP ([RFC 2326]), SIP ([RFC 2543], [RFC 3261])
306Switch ProxyHTTP (draft-cohen-http-305-306-responses)
306Switch ProxyHTTP
307Temporary RedirectHTTP ([RFC 2616])
308Permanent RedirectHTTP
308Resume IncompleteHTTP
320SHTTP Not ModifedS-HTTP (RFC 2660)
350Resolution DelegatedHTTP (draft-girod-w3-id-res-ext)
380Alternative ServiceSIP ([RFC 2543], [RFC 3261])
4xxHTTP, RTSP, SIP
400Bad RequestHTTP ([RFC 1945], [RFC 2068], [RFC 2616]), RTSP ([RFC 2326]), SIP ([RFC 2543], [RFC 3261]), CGI ([RFC 3875]), SSTP, mediaont-api, Q4S
401UnauthorizedHTTP ([RFC 1945], [RFC 2068], [RFC 2616]), RTSP ([RFC 2326]), SIP ([RFC 2543], [RFC 3261])
402Payment RequiredHTTP ([RFC 2068], [RFC 2616]), RTSP ([RFC 2326]), SIP ([RFC 2543], [RFC 3261])
403ForbiddenHTTP ([RFC 1945], [RFC 2068], [RFC 2616]), RTSP ([RFC 2326]), SIP ([RFC 2543], [RFC 3261])
404Not FoundHTTP ([RFC 1945], [RFC 2068], [RFC 2616]), RTSP ([RFC 2326]), SIP ([RFC 2543], [RFC 3261]), mediaont-api, Q4S
405Method Not AllowedHTTP ([RFC 2068], [RFC 2616]), RTSP ([RFC 2326]), SIP ([RFC 2543], [RFC 3261]), Q4S
406Not AcceptableHTTP ([RFC 2068], [RFC 2616]), HTCPCP ([RFC 2324]), RTSP ([RFC 2326]), SIP ([RFC 2543], [RFC 3261]), Q4S
407Proxy Authentication RequiredHTTP ([RFC 2068], [RFC 2616]), RTSP ([RFC 2326]), SIP ([RFC 2543], [RFC 3261])
408Request TimeoutHTTP ([RFC 2068], [RFC 2616]), SIP ([RFC 2543], [RFC 3261]), SSTP, Q4S
408Request Time-outRTSP ([RFC 2326])
409ConflictHTTP ([RFC 2068], [RFC 2616]), SIP ([RFC 2543]), SSTP
410GoneHTTP ([RFC 2068], [RFC 2616]), RTSP ([RFC 2326]), SIP ([RFC 2543], [RFC 3261])
411Length RequiredHTTP ([RFC 2068], [RFC 2616]), RTSP ([RFC 2326]), SIP ([RFC 2543])
412Precondition FailedHTTP ([RFC 2068], [RFC 2616]), RTSP ([RFC 2326])
413Request Entity Too LargeHTTP ([RFC 2068], [RFC 2616]), RTSP ([RFC 2326]), SIP ([RFC 2543], [RFC 3261]), Q4S
414Request-URI Too LongHTTP ([RFC 2068], [RFC 2616]), Q4S
414Request-URI Too LargeRTSP ([RFC 2326]), SIP ([RFC 2543], [RFC 3261])
415Unsupported Media TypeHTTP ([RFC 2068], [RFC 2616]), RTSP ([RFC 2326]), SIP ([RFC 2543], [RFC 3261]), mediaont-api, Q4S
416Requested Range Not SatisfiedHTTP ([RFC 2616])
416Unsupported URI SchemeSIP ([RFC 3261]), Q4S
417Expectation FailedHTTP ([RFC 2616])
418I'm a teapotHTCPCP ([RFC 2324])
419Expectation FailedHTTP
419Authentication TimeoutHTTP
420HTTP ([IANAREG])
420Bad Protocol Extension RequestHTTP
420RefuseSSTP
420SecurityRetryS-HTTP (RFC 2660)
420Method FailureHTTP
420Enhance Your CalmHTTP
420Policy Not FulfilledHTTP
420Bad ExtensionSIP ([RFC 2543], [RFC 3261])
421HTTP ([IANAREG])
421Protocol Extension UnknownHTTP
421Bad MappingHTTP
421BogusHeaderS-HTTP (RFC 2660)
421Extension RequiredSIP ([RFC 3261])
422HTTP ([IANAREG])
422Unprocessable EntityHTTP ([RFC 2518])
422Protocol Extension RefusedHTTP
422SHTTP Proxy Authentication RequiredS-HTTP (RFC 2660)
423LockedHTTP ([RFC 2518], [IANAREG])
423Bad Protocol Extension ParametersHTTP
423Interval Too BriefSIP ([RFC 3261])
424Failed DependencyHTTP ([RFC 2518], [IANAREG])
425Unordered CollectionHTTP
426AbortHTTP (draft-ietf-tip-usehttp)
426Upgrade RequiredHTTP ([RFC 2817], [IANAREG])
427SOAPActionHTTP
428Precondition RequiredHTTP
429Too Many RequestsHTTP
430WOULD BLOCKHTTP
431Request Header Fields Too LargeHTTP
432Transition NeededHTTP (I-D)
440Login TimeoutHTTP
444No ResponseHTTP
449Retry WithHTTP
450Blocked by Windows Parental ControlsHTTP
450Authentication mechanism not acceptedHTTP (I-D)
451Unavailable for Legal ReasonsHTTP
451RedirectHTTP
451Parameter Not UnderstoodRTSP [RFC 2326]
452Conference Not FoundRTSP [RFC 2326]
453Not Enough BandwidthRTSP [RFC 2326]
454Session Not FoundRTSP [RFC 2326]
455Method Not Valid in This StateRTSP [RFC 2326]
456Header Field Not Valid for ResourceRTSP [RFC 2326]
457Invalid RangeRTSP [RFC 2326]
458Parameter Is Read-OnlyRTSP [RFC 2326]
459Aggregate operation not allowedRTSP [RFC 2326]
460Only aggregate operation allowedRTSP [RFC 2326]
461Unsupported transportRTSP [RFC 2326]
462Destination unreachableRTSP [RFC 2326]
462Property not defined in Source Formatmediaont-api
470HTTP
480Temporarily not availableSIP ([RFC 2543], [RFC 3261])
481Call Leg/Transaction Does Not ExistSIP ([RFC 2543], [RFC 3261])
482Loop DetectedSIP ([RFC 2543], [RFC 3261])
483Too Many HopsSIP ([RFC 2543], [RFC 3261])
484Address IncompletedSIP ([RFC 2543], [RFC 3261])
485AmbiguousSIP ([RFC 2543], [RFC 3261])
486Busy HereSIP ([RFC 2543], [RFC 3261])
487Request TerminetedSIP ([RFC 3261])
488Not Acceptable HereSIP ([RFC 3261])
489Bad EventSIP ([RFC 3265])
491Request PendingSIP ([RFC 3261])
493UndecipherableSIP ([RFC 3261])
494Request Header Too LargeHTTP
494Security Agreement RequiredSIP ([RFC 3329])
495Cert ErrorHTTP
496No CertHTTP
497HTTP to HTTPSHTTP
498Token expired/invalidHTTP
499Client Closed RequestHTTP
499Token requiredHTTP
5xxHTTP, RTSP, SIP
500Internal Server ErrorHTTP ([RFC 1945], [RFC 2068], [RFC 2616]), RTSP ([RFC 2326]), SIP ([RFC 2543], [RFC 3261]), mediaont-api
500Server Internal ErrorQ4S
501Not ImplementedHTTP ([RFC 1945], [RFC 2068], [RFC 2616]), RTSP ([RFC 2326]), SIP ([RFC 2543], [RFC 3261]), CGI ([RFC 3875]), SSTP, Q4S
502Bad GatewayHTTP ([RFC 1945], [RFC 2068], [RFC 2616]), RTSP ([RFC 2326]), SIP ([RFC 2543], [RFC 3261])
503Service UnavailableHTTP ([RFC 1945], [RFC 2068], [RFC 2616]), RTSP ([RFC 2326]), SIP ([RFC 2543], [RFC 3261]), SSTP, Q4S
504Gateway TimeoutHTTP ([RFC 2068], [RFC 2616])
504Gateway Time-outRTSP ([RFC 2326]), SIP ([RFC 2543], [RFC 3261])
504Server Time-outQ4S
505HTTP Version Not SupportedHTTP ([RFC 2068], [RFC 2616])
505RTSP Version not supportedRTSP [RFC 2326]
505SIP Version not supportedSIP ([RFC 2543], [RFC 3261])
505Version Not SupportedQ4S
506Variant Also NegotiatesHTTP ([RFC 2295])
507Insufficient StorageHTTP ([RFC 2518])
508Loop DetectedHTTP
508Cross Server Binding ForbiddenHTTP
509Bandwidth Limit ExceededHTTP
510Not ExtendedHTTP ([RFC 2774])
510Not Local IPSSTP
511Network Authentication RequiredHTTP
511In Black ListSSTP
512InvisibleSSTP
513Message Too LargeSIP ([RFC 3161]), Q4S
520Origin ErrorHTTP
520Protocol Extension ErrorHTTP
521Protocol Extension Not ImplementedHTTP
522Origin Connection Time-outHTTP
522Protocol Extension Parameters Not AcceptableHTTP
523HTTP
524Origin Time-outHTTP
529HTTP
551Option not supportedRTSP [RFC 2326]
555HTTP
562Property not supportedmediaont-api
564
580Precondition FailureSIP [RFC 3312]
591Restore successfulHTTP (CEA-2014-B)
592Cannot connect to provided saved state URLHTTP (CEA-2014-B)
593Unidentified error while restoringHTTP (CEA-2014-B)
594Save successfulHTTP (CEA-2014-B)
595Page does not include save-restore plugin objectHTTP, HTTP (CEA-2014-B)
596Cannot connect to provided storage server URLHTTP, HTTP (CEA-2014-B)
597Unidentified error while savingHTTP, HTTP (CEA-2014-B)
598Network read timeout errorHTTP
599Network connect timeout errorHTTP
6xxSIP
600Busy EverywhereSIP ([RFC 2543], [RFC 3261])
600session does not existQ4S
601quality level not allowedQ4S
603DeclineSIP ([RFC 2543], [RFC 3261])
603Session not allowedQ4S
604Does not exist anywhereSIP ([RFC 2543], [RFC 3261])
604authorization not allowedQ4S
606Not AcceptableSIP ([RFC 2543], [RFC 3261])
1223HTTP
12152UnknownHTTP

[636] JSON 形式の一覧ファイルが >>635 にあります。

[43] 数値が割り当てられずに廃案となった提案:

IANA 登録簿

[608] HTTP の登録簿は RFC 2817 により (ようやく) 設けられました >>609

[16] その後 RFC 7231 により再定義されています。

[2] RTSP は独自の符号は50番台を使うことで衝突を防いでいます。 (RFC 2326 7.1)

[3] [Apache] apache-1.3/src/main/http_protocol.c http://www.apache.jp/viewcvs.cgi/apache-1.3/src/main/http_protocol.c, httpd-2.0/modules/http/http_protocol.c http://www.apache.jp/viewcvs.cgi/httpd-2.0/modules/http/http_protocol.c

[5] Real Time Streaming Protocol (RTSP)/1.0 Parameters http://www.iana.org/assignments/rtsp-parameters

状態符号の拡張

[19] HTTP 仕様は状態符号IANA 登録手続きを規定していますが、 登録されていない状態符号の利用を明確に禁じてはいません。

[20] 実際に未登録の状態符号を使った例は多々あります。 (状態符号IANA登録簿が出来る前から非標準の状態符号は使われていたと思われます。)

[21] >>11 のような工夫が行われることもありますが、行われないこともあります。 そして実際に非標準の状態符号と新たに RFC 化された状態符号が衝突した例もあります。

[22] IETFHTTP に関わらず一般に市場で利用されているものを調査してそれを標準化したり、 それとの衝突を避けたりする努力をしていないので、状態符号以外でもこのような例はいくつもあります。

性質

[24] HTTP の仕様書は 2xx3xx除く状態符号応答non-error response と呼んでいます >>23

[25] 1xx もエラーではありませんが、キャッシュに関する規定の一部で使われている用語なので、 キャッシュに関係しない 1xx には言及していないものと思われます。

[45] 状態符号には、次の分類があります。

事前条件と事後条件

[32] WebDAV では状態符号よりも細かいエラーの詳細を XML 形式で表現でき、これを事前条件符号事後条件符号と呼んでいます。

error 要素の項を参照。

CATP

[72] CATPステータスコードは、 HTTP状態符号と同様に3桁で1桁目の意味もおなじですが (但し 1xx は予約)、 下2桁は実装依存とされています。 >>71

[74] HTTP と同じ数値でも意味は違うことがあります。

歴史

[615] RFC 1945 (HTTP/1.0), RFC 2068・2616 (HTTP/1.1) 6.1.1 Status Code and Reason Phrase

The Status-Code element is a 3-digit integer result code of the attempt to understand and satisfy the request. {2068,2616} These codes are fully defined in section 10. The Reason-Phrase is intended to give a short textual description of the Status-Code. The Status-Code is intended for use by automata and the Reason-Phrase is intended for the human user. The client is not required to examine or display the Reason-Phrase.

Status-Code 要素は要求を理解し満足しようと試みた結果の3桁整数符号です。この符号は10章で完全に定義しています。 Reason-PhraseStatus-Code の短文の説明を与えることを意図しています。 Status-Code は自動化に使うことを意図しており、 Reason-Phrase は人間利用者向けを意図しています。 クライアントが Reason-Phrase を検査したり表示したりすることは必須ではありません。

The first digit of the Status-Code defines the class of response. The last two digits do not have any categorization role. There are 5 values for the first digit:

Status-Code の最初の数字は応答の種別を定義します。 後ろの2桁は分類的役割は持っていません。最初の数字には5つの値があります。

  • {1945,2068} o {2616} - 1xx: Informational - {1945} Not used, but reserved for future use {2068,2616} Request received, continuing process
  • {1945,2068} o {2616} - 2xx: Success - The action was successfully received, understood, and accepted.
  • {1945,2068} o {2616} - 3xx: Redirection - Further action must be taken in order to complete the request
  • {1945,2068} o {2616} - 4xx: Client Error - The request contains bad syntax or cannot be fulfilled
  • {1945,2068} o {2616} - 5xx: Server Error - The server failed to fulfill an apparently valid request
  • 1xx : 情報提供 — 使用されておらず、将来の使用のために予約 要求を受信し、処理を継続
  • 2xx : 成功 — 動作は成功裏に受信し、理解し、受け入れた
  • 3xx : 再指向 — 要求を完了するためには更なる動作を取らなければならない
  • 4xx : クライアント誤り — 要求は悪い構文を含んでいるか、または満たすことができない
  • 5xx : サーバー誤り — サーバーは妥当そうな要求を満たすことに失敗した

The individual values of the numeric status codes defined for {1945} HTTP/1.0 {2068,2616} HTTP/1.1, and an example set of corresponding Reason-Phrase's, are presented below. The reason phrases listed here are only {1945,2068} recommended {2616} recommendations -- they {1945,2068} may {2616} MAY be replaced by local equivalents without affecting the protocol. These codes are fully defined in Section 9.

HTTP 用に定義した数値状態符号の個々の値と対応する Reason-Phrase の例の集合を次に示します。 ここに挙げた理由語句は推奨に過ぎません。 プロトコルに影響なく局所的な同等のものに置換えて構いません

{1945}

  •        Status-Code    = "200"   ; OK
                          | "201"   ; Created
                          | "202"   ; Accepted
                          | "204"   ; No Content
                          | "301"   ; Moved Permanently
                          | "302"   ; Moved Temporarily
                          | "304"   ; Not Modified
                          | "400"   ; Bad Request
                          | "401"   ; Unauthorized
                          | "403"   ; Forbidden
                          | "404"   ; Not Found
                          | "500"   ; Internal Server Error
                          | "501"   ; Not Implemented
                          | "502"   ; Bad Gateway
                          | "503"   ; Service Unavailable
                          | extension-code

{2068}

  •           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

{2616}

  •       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
  • Reason-Phrase = *<TEXT, excluding CR, LF>

HTTP status codes are extensible, {1945} but the above codes are the only ones generally recognized in current practice. HTTP applications are not required to understand the meaning of all registered status codes, though such understanding is obviously desirable. However, applications {1945} must MUST understand the class of any status code, as indicated by the first digit, and treat any unrecognized response as being equivalent to the x00 status code of that class, with the exception that an unrecognized response {1945} must not MUST NOT be cached. For example, if an unrecognized status code of 431 is received by the client, it can safely assume that there was something wrong with its request and treat the response as if it had received a 400 status code. In such cases, user agents {1945} should SHOULD present to the user the entity returned with the response, since that entity is likely to include human-readable information which will explain the unusual status.

HTTP 状態符号は拡張可能ですが、上述の符号は現在の慣習で一般的に認識されるもののみです。 HTTP 応用はすべての登録された状態符号の意味を理解できる方が明らかに望ましくはありますが、その必要はありません。 しかし、応用は最初の数字が示す状態符号の種別を理解し、認識できない応答をその種別の x00 状態符号と同等のものとして扱わなければなりません。 ただし例外として、認識できない応答はキャッシュしてはなりません。 例えば、認識できない 431 の状態符号を蔵あinnとが受信したとしたら、 クライアントはその要求の何かがおかしいのであると安全に仮定でき、 その応答を 400 状態符号で受取ったものとして扱えます。 その場合、利用者エージェントはその応答で返された実体を利用者に提示するべきです。 その実体にはおそらくその普通じゃない状態を説明する人間可読の情報を含んでいることでしょう。

RFC 2817

[35] RFC 2817 により状態符号IANA登録簿が新設されました >>609

RFC 3875 (CGI/1.1)

RFC 3875 6.3.3. Status

[607] draft-nottingham-http-new-status-01 - Additional HTTP Status Codes ( ( 版)) http://tools.ietf.org/html/draft-nottingham-http-new-status-01

[610] RFC 4463 - A Media Resource Control Protocol (MRCP) Developed by Cisco, Nuance, and Speechworks ( ( 版)) http://tools.ietf.org/html/rfc4463#section-5.2.1

[611] RFC 4975 - The Message Session Relay Protocol (MSRP) ( ( 版)) http://tools.ietf.org/html/rfc4975#section-10

[613] RFC 6787 - Media Resource Control Protocol Version 2 (MRCPv2) ( ( 版)) http://tools.ietf.org/html/rfc6787#section-5.4

[614] RFC 6787 - Media Resource Control Protocol Version 2 (MRCPv2) ( ( 版)) http://tools.ietf.org/html/rfc6787#section-13.1.4

[616] Media Resource Control Protocol Version 2 (MRCPv2) Parameters ( ( 版)) http://www.iana.org/assignments/mrcpv2-parameters/mrcpv2-parameters.xhtml#status-codes

[619] Metadata API for Media Resources 1.0 ( ( 版)) http://www.w3.org/TR/mediaont-api-1.0/#api-status-codes

[638] draft-aranda-dispatch-q4s-02 - The Quality for Service Protocol ( ( 版)) http://tools.ietf.org/html/draft-aranda-dispatch-q4s-02#section-4

RFC 6585

[57] IETF は2012年4月に RFC 6585 を発行し、 状態符号を4つ規定しています。

[58] この RFCRFC 2616更新する形となっていますが、 単なる追加規定なので、どこが更新なのか謎です。

IETF の手続きは謎だらけなので、気にしなくて良いと思われます。

HTTP/2

[44] HTTP/2 では状態行が廃止されています。 SPDY では status ヘッダーが使われました。 HTTP/2 では :status 疑似ヘッダーとなっています。

実装

[6] Force Apache to output any HTTP Status Code with ErrorDocument (2007-03-05 07:36:37 +09:00 版) http://www.askapache.com/2007/htaccess/apache-status-code-headers-errordocument.html (名無しさん 2007-03-04 22:43:40 +00:00)

[612] AnyEvent::HTTP - search.cpan.org ( 版) http://search.cpan.org/~mlehmann/AnyEvent-HTTP-2.13/HTTP.pm

[617] IIS 7.0、IIS 7.5、および IIS 8.0 の HTTP 状態コード ( ( 版)) http://support.microsoft.com/kb/943891/ja

[618] IISのステータスコードは小数点つきという話 - ういはるかぜの化学 - subtech ( ( 版)) http://subtech.g.hatena.ne.jp/mayuki/20131120/1384901536

[31] LWP で使われるPerlモジュールである HTTP::Response は、 code メソッド状態符号を返します。

関連

[624] CoAPHTTP と類似した状態符号を使っていますが、 HTTP の百の位に当たる整数部1桁と、十・一の位にあたる小数部2桁を小数点 . で連結した表記となっています。整数部は3ビット、小数部は5ビットの整数です。

[625] ただし 0.00空メッセージを表すものとされており、 それ以外の整数部が 0 の値はメソッドに割り当てられています。 (CoAPHTTP に由来するメソッドを使っていますが、数値が割り当てられています。) 整数部が 1、6、7 の値は予約されています。それ以外、つまり 2、3、4 が状態符号となっています。

[34] IRC logs: freenode / #whatwg / 20150125 ( 版) http://krijnhoetmer.nl/irc-logs/whatwg/20150125

[36] HTML Standard ( 版) https://html.spec.whatwg.org/#concept-http-equivalent-codes

The HTTP response codes are equivalent to statuses in other protocols that have the same basic meanings. For example, a "file not found" error is equivalent to a 404 code, a server error is equivalent to a 5xx code, and so on.

[52] Define status, ok status, and use them both · whatwg/fetch@159d43c ( 版) https://github.com/whatwg/fetch/commit/159d43c7d55e682d7f3fc3cc800d1c004dd183f6

[59] draft-schulzrinne-http-status-00 - Assignment of Status Codes for HTTP and HTTP-Derived Protocols ( 版) https://tools.ietf.org/html/draft-schulzrinne-http-status-00

[60] nginx/ngx_event_openssl_stapling.c at master · nginx/nginx ( ()) https://github.com/nginx/nginx/blob/master/src/event/ngx_event_openssl_stapling.c

case '.': /* IIS may send 403.1, 403.2, etc */

[61] Replace 'HTTP status code' with 'HTTP status' (vkatsikaros著, ) https://github.com/w3c/webdriver/commit/30ed50c68b8c52da7996df8e5e037f838ee9b826

[69] カーセンサー | APIリファレンス | リクルートWEBサービス () https://webservice.recruit.co.jp/carsensor/reference.html

エラーの際でも、HTTPレスポンスステータスは常に "200 OK" が返ります。実装側では常にレスポンスXMLの内容を見てエラー判断を行ってください。

[70] Make status message default to the empty byte sequence (annevk著, ) https://github.com/whatwg/fetch/commit/0dec453f642c1fe57e6e7627c9a66cf7f8b8394d