/
725.txt
847 lines (691 loc) · 45 KB
/
725.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
[627] [DFN[[RUBY[[[状態符号]]]@en[ステータスコード][status code]]]]は、[[応答]]の種別を表す3桁の[[数字]]列です。
[628] [[HTTP]] および派生プロトコルでは、一部共通する[[状態符号]]が使われています。
先頭1桁は[[状態符号]]の分類を表しており、下2桁がその細分類を表しています。
* 仕様書
[REFS[
- [626] '''[CITE@en[RFC 7231 - Hypertext Transfer Protocol (HTTP/1.1): Semantics and Content]] ([TIME[2014-06-07 01:55:45 +09:00]] 版) <https://tools.ietf.org/html/rfc7231#section-6>'''
- [620] [CITE@en[RFC 7230 - Hypertext Transfer Protocol (HTTP/1.1): Message Syntax and Routing]] ([TIME[2014-06-07 01:59:35 +09:00]] 版) <https://tools.ietf.org/html/rfc7230#section-3.1.2>
- [7] [CITE@en[RFC 7231 - Hypertext Transfer Protocol (HTTP/1.1): Semantics and Content]] ([TIME[2014-08-07 05:54:02 +09:00]] 版) <https://tools.ietf.org/html/rfc7231#section-8.2>
- [23] [CITE@en[RFC 7234 - Hypertext Transfer Protocol (HTTP/1.1): Caching]] ([TIME[2014-09-11 10:19:59 +09:00]] 版) <https://tools.ietf.org/html/rfc7234#section-4.3.5>
- [17] [CITE[RFC Errata Report]] ([TIME[2014-09-04 11:10:59 +09:00]] 版) <http://www.rfc-editor.org/errata_search.php?rfc=7230&eid=4050>
- [37] [CITE@en[RFC 7540 - Hypertext Transfer Protocol Version 2 (HTTP/2)]] ([TIME[2015-05-15 10:14:54 +09:00]] 版) <https://tools.ietf.org/html/rfc7540#section-8.1.2.4>
- [50] [CITE@en-US[Fetch Standard]] ([TIME[2015-09-07 19:46:18 +09:00]] 版) <https://fetch.spec.whatwg.org/#concept-status>
]REFS]
* 呼称
[18] [[状態符号]]は、俗に[DFN[[RUBY[応答符号]@en[レスポンスコード][response code]]]]とも呼ばれます。
[[RFC 7230]] でも1箇所[[応答符号]]と呼んでいるところがありましたが、
[[正誤表]]で訂正されています [SRC[>>17]]。
[46] 文脈上曖昧でない場合は、 [CODE[status]] ないし [CODE[code]] と略されることがあります。
[EG[
[47] [[XHR]] の[[属性名]]は、 [CODE(DOMa)@en[[[status]]]] です。
]EG]
[51] [[Fetch Standard]] は、「[DFN[[RUBYB[状態]@en[status]]]]は[RUBYB[符号]@en[code]]である
[SRC[>>50]]」とわけのわからない定義をしています。
* 意味
[622] [[状態符号]]は、[[鯖]]が[[クライアント]]の[[要求]]を理解し満足しようと試みた結果を説明するものです
[SRC[>>620, >>626]]。
[623] [[応答メッセージ]]の他の部分は、[[状態符号]]ごとに定義された意味に照らして解釈されます
[SRC[>>620]]。
;; [13] [[ヘッダー]]の中には[[状態符号]]によって意味が変わるものがあります。
また[[メッセージ本体]]の意味は[[状態符号]]によって変わります。
[8] [CODE(HTTP)[[[1xx]]]] は途中経過の[[応答]]を表すなど、
[[HTTP接続]]の状態の管理にも[[状態符号]]は影響を及ぼします。
[CODE(HTTP)[[[204]]]] のように[[状態符号]]によって[[メッセージ本体]]が存在しなくなることもありますが、
新規の[[状態符号]]にはそのように [[HTTPメッセージ]]の構文に影響をあたえることは認められていません
[SRC[>>7]]。
* 構文
[621] [[状態符号]]は、3桁の[[ASCII数字]]です [SRC[>>620]]。
[FIG(railroad)[
= [[ASCII数字]]
= [[ASCII数字]]
= [[ASCII数字]]
]FIG]
[632] 最初の1桁は[RUBYB[分類]@en[class]]を表します。
残りの2桁はその分類内の種別を表しています。 [SRC[>>626]]
;; [15] 下2桁には特に意味はありません。従って [CODE[401]] と
[CODE[201]] に特に関係はありません。ただし下2桁が [CODE[00]]
の[[状態符号]]は既定の[[状態符号]]となっています (>>629)。
[14] [[HTTP]] の仕様書では、 [CODE[[[2xx]]]] のように「xx」
を使って当該分類に含まれる[[状態符号]]すべてを表しています。
[9] [[RFC 7231]] は、提案中でまだ用いるべきでない[[状態符号]]について
[CODE[4NN]], [CODE[3N0]] .. [CODE[3N9]] のような「N」構文を提唱しています [SRC[>>7]]。
;; [10] これまでに実際に提案中や非標準の[[状態符号]]の意味が衝突したり、
非標準の[[状態符号]]と標準化された[[状態符号]]の意味が衝突したりする例があります。
[11] [[HTTP]] から派生したプロトコルの[[状態符号]]や [[HTTP]]
でも非標準の[[状態符号]]は、50番台や90番台を使って [[HTTP]]
の標準の[[状態符号]]との衝突を避けようと試みていることがあります。
;; [12] しかし実際にはそうでないものもあり、そうでないものは [[HTTP]]
の標準の[[状態符号]]と衝突していることもあります。また派生プロトコル同士で衝突していることもあります。
[48] [[サーバー]]が3桁以外の[[ASCII数字]]列を指定した場合、それが十進整数として解釈されます。
従って非標準な[[応答]]の場合は 100 から 999 の範囲の外の数値が得られるかもしれませんし、
非標準な[[応答]]は 3桁の整数を表していても[[先導0]]により4桁以上になっているかもしれません。
;; [[HTTPの構文解析]]を参照。
[49] [[XHR]] などでは、[[ネットワークエラー]]を表すために[[整数]] [CODE[[[0]]]]
が用いられます。また [[IE]] の実装では4桁や5桁の [[Windows]]
ライブラリーのエラーコードが[[状態符号]]として用いられることがあります。
* 文脈
[33] 次の場面で使われます。
[FIG(short list)[
- [[状態行]]
- [CODE(HTTP)@en[[[Status-URI:]]]]
- [CODE(HTTP)@en[[[oauth_error_code]]]]
- [CODE(HTTP)@en[[[:status]]]]
]FIG]
* 理由句
[634] [[状態符号]]は、[[状態行]]において[[理由句]]と組で記述されます。
仕様書では[[状態符号]]に対応する[[理由句]]が定義されていますが、
これはあくまで一例に過ぎず、[[鯖]]は任意の値を指定できます。
;; 詳しくは[[理由句]]を参照。
* 取り扱いに注意が必要な状態符号
[62] いくつかの[[状態]]は、取り扱いに注意が必要です。
[63] [CODE[0]] は、[[ネットワークエラー]]などで使われます。古い実装は [[HTTP]]
以外の[[プロトコル]]の成功の[[応答]]も [CODE[0]] を返すことがあります。
[66] [CODE[1xx]] は、[[HTTP接続]]において特別な扱いを受けます。
[67] [CODE[204]]、[CODE[205]]、[CODE[304]] の[[応答]]は[[本体]]を持ちません。
[64] [CODE[207]] は、複数の[[応答]]をまとめたことを表します。
その中に含まれる実際の[[応答]]は [CODE[2xx]] (成功) とは限りません。
[65] [CODE[304]] は、 [CODE[3xx]] ですが[[HTTPリダイレクト]]ではありません。
[68] [CODE[407]] と [CODE[511]] は、[[プロキシ認証]]や[[ネットワーク認証]]のエラーを表しています。
つまり[[起源サーバー]]ではなく、途中の他の (第三者の) [[サーバー]]が返した[[応答]]です。
* 処理
[629] [[HTTP]] の[[クライアント]]は、すべての[[状態符号]]を理解する必要はありません。
しかし、未対応なら[[状態符号]]の最初の1桁 [VAR[x]] で表される[RUBYB[分類]@en[class]]に基づき、
[CODE[[VAR[x]]00]] と同じように扱わなければ[['''なりません''']]。 [SRC[>>626]]
;; [630] そのため [CODE[[VAR[x]]00]] は実装することを要求されていると思われます。
;; [633] [CODE[[[099]]]] 以下や [CODE[[[600]]]] 以上をどう処理するべきなのかは不明です。
;; [637] [CODE(HTTP)[[[3xx]]]] では未知の[[状態符号]]の処理の規定があります。
[631] 未知の[[状態符号]]の[[応答]]は、[[キャッシュ]]しては[['''なりません''']] [SRC[>>626]]。
* [CODE(HTTP)@en[:status]] 疑似ヘッダー (HTTP)
[38] [[HTTP/2]] [[応答]]の [DFN[[CODE(HTTP)@en[[[:status]]]]]]
[[疑似ヘッダー]]は、[[状態符号]]を表します [SRC[>>37]]。
[39] [[応答]]は [CODE(HTTP)@en[[[:status]]]] [[疑似ヘッダー]]を含まなければ[['''なりません''']] [SRC[>>37]]。
[40] [CODE(HTTP)@en[[[:status]]]] [[疑似ヘッダー]]が含まれない[[応答]]は、
[[奇形]]です [SRC[>>37]]。
;; [41] 複数含まれるのを禁止はしていませんが、[[奇形]]とみなすべきでしょうか。
[53] [[Firefox]] は最初を採用します。 [[Chrome]] は最後を採用します。
どちらもエラーとはしないようです。 [TIME[2015-10-10T13:58:50.100Z]]
[42] [[要求]]や[[トレーラー部]]に含まれる場合、[[奇形]]です。
[54] 値が数値でないときどう処理するべきかは不明です。
[55] [[Chrome]] も [[Firefox]] も先頭の[[非負整数]]を[[応答]]の[[状態]]として使います。
[[非負整数]]がないとき、どちらも [CODE[[[200]]]] とします。
[[Chrome]] はその続きがあれば、[[理由句]]として使います。
それ以外の場合や [[Firefox]] は、仕様書に由来する標準的な[[理由句]]を使います。
仕様書に無いとき、 [[Chrome]] は [CODE[OK]]、[[Firefox]] は [CODE[No Reason Phrase]]
とします。 [TIME[2015-10-10T14:24:01.100Z]]
* [CODE(DOMa)@en[status]] IDL 属性 (XMLHttpRequest)
** 仕様書
[REFS[
- [26] [CITE@en-US[XMLHttpRequest Level 2]]
-- [27] <http://dev.w3.org/2006/webapi/XMLHttpRequest-2/#the-status-attribute>
]REFS]
** 非 HTTP プロトコルの場合
[28] [[HTTP]] 以外のプロトコルの場合の [CODE(DOMa)@en[[[status]]]] [[属性]]の値について
[[XHR]] では規定されていません [TIME[2011-09-19T09:55:51.300Z]]。 [[XHR]]
から [[fetch]] の定義が参照されている [[WA1]] では、非 [[HTTP]]
[[プロトコル]]の[[状態符号]]は [[HTTP]] を準用して与えられているかのように扱うとされていますが、
明確な対応関係を規定しているわけではありません。
[29] [[MDN]] の文書では [CODE(URI)@en[[[file:]]]] や [CODE(URI)@en[[[ftp:]]]] は [[HTTP]]
では無いので常に [CODE(HTTP)[[[0]]]] を返すと述べられています [SRC[>>30]]。
[REFS[
- [30] [CITE@en[Using XMLHttpRequest - MDN]] ([TIME[2011-09-19 18:46:27 +09:00]] 版) <https://developer.mozilla.org/En/XMLHttpRequest/Using_XMLHttpRequest#Example:.C2.A0Non-HTTP_synchronous_request>
]REFS]
* 状態符号の一覧
[1] [[HTTP]] 及び派生プロトコルでは次のような[[状態符号]]が使われています。
,*状態符号 ,*典型的な理由語句 ,*出典
,[CODE(HTTP)[[[0]]]],,HTTP
,[CODE[[[1[VAR[xx]]]]]] ,== ,"HTTP, RTSP, SIP"
,[[100]] ,Continue ,"HTTP ([RFC 2068], [RFC 2616]), RTSP ([RFC 2326])"
,100 ,Trying ,"SIP ([RFC 2543], [RFC 3261]), [[Q4S]]"
,[[101]] ,Switching Protocols ,"HTTP/1.1 ([RFC 2068], [RFC 2616])"
,[[102]] ,Processing ,HTTP ([RFC 2518])
,[CODE(HTTP)[103]],Checkpoint,[[HTTP]]
,[CODE(HTTP)[103]],Access denied while creating Web Service,[[HTTP]]
,[CODE(HTTP)[103]],Early Hints,[[HTTP]]
,[CODE(HTTP)[[[104]]]],File Format or Program Error,HTTP
,[CODE(HTTP)[[[122]]]],Request-URI too long,HTTP
,[[180]] ,Ringing ,"SIP ([RFC 2543], [RFC 3261])"
,[[181]] ,Call Is Being Forwarded ,"SIP ([RFC 2543], [RFC 3261])"
,[[182]] ,Queued ,"SIP ([RFC 2543], [RFC 3261])"
,[[183]] ,Session Progress ,SIP ([RFC 3261])
,[CODE[[[2[VAR[xx]]]]]] ,== ,"HTTP, RTSP, SIP"
,[CODE(HTTP)[[[200]]]] ,OK ,"HTTP ([RFC 1945], [RFC 2068], [RFC 2616]), RTSP ([RFC 2326]), SIP ([RFC 2543], [RFC 3261]), CGI ([RFC 3875]), SSTP, [[mediaont-api]], [[Q4S]]"
,[[201]] ,Created ,"HTTP ([RFC 1945], [RFC 2068], [RFC 2616]), RTSP ([RFC 2326])"
,[[202]] ,Accepted ,"HTTP ([RFC 1945], [RFC 2068], [RFC 2616]), SIP ([RFC 3265])"
,[[203]] ,Non-Authoritative Information ,"HTTP/1.1 ([RFC 2068], [RFC 2616])"
,[CODE(HTTP)[[[204]]]] ,No Content ,"HTTP ([RFC 1945], [RFC 2068], [RFC 2616]), SSTP, [[mediaont-api]]"
,[[205]] ,Reset Content ,"HTTP ([RFC 2068], [RFC 2616])"
,[[206]] ,Partial Content ,"HTTP ([RFC 2068], [RFC 2616]), [[mediaont-api]]"
,[[207]] ,Multi-Status ,HTTP ([RFC 2518])
,[CODE(HTTP)[[[208]]]],Already Reported,HTTP
,[CODE[[[210]]]] ,Break ,SSTP
,[CODE(HTTP)[[[220]]]],Uses Protocol Extensions,[[HTTP]]
,[CODE(HTTP)[[[226]]]],IM Used,[[HTTP]]
,[CODE(HTTP)[[[235]]]],Authentication Completed,[[HTTP]] ([[I-D]])
,[CODE(HTTP)[[[236]]]],Proxy Authentication Completed,[[HTTP]] ([[I-D]])
,[[250]] ,Low on Storage Space ,RTSP ([RFC 2326])
,[CODE[[[3[VAR[xx]]]]]] ,== ,"HTTP, RTSP, SIP"
,[[300]] ,Multiple Choices ,"HTTP ([RFC 1945], [RFC 2068], [RFC 2616]), RTSP ([RFC 2326]), SIP ([RFC 2543], [RFC 3261])"
,[[301]] ,Moved Permanently ,"HTTP ([RFC 1945], [RFC 2068], [RFC 2616]), RTSP ([RFC 2326]), SIP ([RFC 2543], [RFC 3261])"
,[CODE(HTTP)[[[302]]]] ,Moved Temporarily ,"HTTP ([RFC 1945], [RFC 2068]), RTSP ([RFC 2326]), SIP ([RFC 2543], [RFC 3261])"
,[CODE(HTTP)[[[302]]]] ,Found ,"HTTP ([RFC 2616]), CGI ([RFC 3875])"
,[[303]] ,See Other ,"HTTP ([RFC 2068], [RFC 2616]), RTSP ([RFC 2326]), SIP ([RFC 2543])"
,[[304]] ,Not Modified ,"HTTP ([RFC 1945], [RFC 2068], [RFC 2616]), RTSP ([RFC 2326])"
,[[305]] ,Use Proxy ,"HTTP ([RFC 2068], [RFC 2616]), RTSP ([RFC 2326]), SIP ([RFC 2543], [RFC 3261])"
,306 ,Switch Proxy ,HTTP ([[draft-cohen-http-305-306-responses]])
,[[306]] ,Switch Proxy,HTTP
,[[307]] ,Temporary Redirect ,HTTP ([RFC 2616])
,[CODE(HTTP)[[[308]]]],Permanent Redirect,HTTP
,[CODE(HTTP)[[[308]]]],Resume Incomplete,HTTP
,[CODE[[[320]]]],SHTTP Not Modifed,[[S-HTTP]] ([[RFC 2660]])
,[CODE[[[350]]]] ,Resolution Delegated ,HTTP ([[draft-girod-w3-id-res-ext]])
,[[380]] ,Alternative Service ,"SIP ([RFC 2543], [RFC 3261])"
,[CODE[[[4[VAR[xx]]]]]] ,== ,"HTTP, RTSP, SIP"
,[CODE(HTTP)[[[400]]]] ,Bad Request ,"HTTP ([RFC 1945], [RFC 2068], [RFC 2616]), RTSP ([RFC 2326]), SIP ([RFC 2543], [RFC 3261]), CGI ([RFC 3875]), SSTP, [[mediaont-api]], [[Q4S]]"
,[[401]] ,Unauthorized ,"HTTP ([RFC 1945], [RFC 2068], [RFC 2616]), RTSP ([RFC 2326]), SIP ([RFC 2543], [RFC 3261])"
,[[402]] ,Payment Required ,"HTTP ([RFC 2068], [RFC 2616]), RTSP ([RFC 2326]), SIP ([RFC 2543], [RFC 3261])"
,[[403]] ,Forbidden ,"HTTP ([RFC 1945], [RFC 2068], [RFC 2616]), RTSP ([RFC 2326]), SIP ([RFC 2543], [RFC 3261])"
,[[404]] ,Not Found ,"HTTP ([RFC 1945], [RFC 2068], [RFC 2616]), RTSP ([RFC 2326]), SIP ([RFC 2543], [RFC 3261]), [[mediaont-api]], [[Q4S]]"
,[[405]] ,Method Not Allowed ,"HTTP ([RFC 2068], [RFC 2616]), RTSP ([RFC 2326]), SIP ([RFC 2543], [RFC 3261]), [[Q4S]]"
,[[406]] ,Not Acceptable ,"HTTP ([RFC 2068], [RFC 2616]), HTCPCP ([RFC 2324]), RTSP ([RFC 2326]), SIP ([RFC 2543], [RFC 3261]), [[Q4S]]"
,[[407]] ,Proxy Authentication Required ,"HTTP ([RFC 2068], [RFC 2616]), RTSP ([RFC 2326]), SIP ([RFC 2543], [RFC 3261])"
,[CODE(HTTP)[[[408]]]] ,Request Timeout ,"HTTP ([RFC 2068], [RFC 2616]), SIP ([RFC 2543], [RFC 3261]), SSTP, [[Q4S]]"
,408 ,Request Time-out ,RTSP ([RFC 2326])
,[CODE(HTTP)[[[409]]]] ,Conflict ,"HTTP ([RFC 2068], [RFC 2616]), SIP ([RFC 2543]), SSTP"
,[[410]] ,Gone ,"HTTP ([RFC 2068], [RFC 2616]), RTSP ([RFC 2326]), SIP ([RFC 2543], [RFC 3261])"
,[[411]] ,Length Required ,"HTTP ([RFC 2068], [RFC 2616]), RTSP ([RFC 2326]), SIP ([RFC 2543])"
,[[412]] ,Precondition Failed ,"HTTP ([RFC 2068], [RFC 2616]), RTSP ([RFC 2326])"
,[[413]] ,Request Entity Too Large ,"HTTP ([RFC 2068], [RFC 2616]), RTSP ([RFC 2326]), SIP ([RFC 2543], [RFC 3261]), [[Q4S]]"
,[[414]] ,Request-URI Too Long ,"HTTP ([RFC 2068], [RFC 2616]), [[Q4S]]"
,414 ,Request-URI Too Large ,"RTSP ([RFC 2326]), SIP ([RFC 2543], [RFC 3261])"
,[[415]] ,Unsupported Media Type ,"HTTP ([RFC 2068], [RFC 2616]), RTSP ([RFC 2326]), SIP ([RFC 2543], [RFC 3261]), [[mediaont-api]], [[Q4S]]"
,[[416]] ,Requested Range Not Satisfied ,HTTP ([RFC 2616])
,416 ,Unsupported URI Scheme ,"SIP ([RFC 3261]), [[Q4S]]"
,[[417]] ,Expectation Failed ,HTTP ([RFC 2616])
,[[418]] ,I'm a teapot ,HTCPCP ([RFC 2324])
,[CODE(HTTP)[[[419]]]],Expectation Failed,HTTP
,[CODE(HTTP)[[[419]]]],Authentication Timeout,HTTP
,420 , ,HTTP ([IANAREG])
,[CODE(HTTP)[[[420]]]],Bad Protocol Extension Request,[[HTTP]]
,[CODE[[[420]]]] ,Refuse ,SSTP
,[CODE[[[420]]]],SecurityRetry,[[S-HTTP]] ([[RFC 2660]])
,[CODE(HTTP)[[[420]]]],Method Failure,HTTP
,[CODE(HTTP)[[[420]]]],Enhance Your Calm,HTTP
,[CODE(HTTP)[[[420]]]],Policy Not Fulfilled,HTTP
,[[420]] ,Bad Extension ,"SIP ([RFC 2543], [RFC 3261])"
,421 , ,HTTP ([IANAREG])
,[CODE(HTTP)[[[421]]]],Protocol Extension Unknown,[[HTTP]]
,[CODE(HTTP)[[[421]]]],Bad Mapping,HTTP
,[[421]],BogusHeader,[[S-HTTP]] ([[RFC 2660]])
,[[421]] ,Extension Required ,SIP ([RFC 3261])
,422 , ,HTTP ([IANAREG])
,[[422]] ,Unprocessable Entity ,HTTP ([RFC 2518])
,[CODE(HTTP)[[[422]]]],Protocol Extension Refused,[[HTTP]]
,[CODE[[[422]]]],SHTTP Proxy Authentication Required,[[S-HTTP]] ([[RFC 2660]])
,[[423]] ,Locked ,"HTTP ([RFC 2518], [IANAREG])"
,[CODE(HTTP)[[[423]]]],Bad Protocol Extension Parameters,[[HTTP]]
,[[423]] ,Interval Too Brief ,SIP ([RFC 3261])
,[[424]] ,Failed Dependency ,"HTTP ([RFC 2518], [IANAREG])"
,[CODE[[[425]]]] ,Unordered Collection,HTTP
,426 ,Abort ,HTTP ([[draft-ietf-tip-usehttp]])
,[[426]] ,Upgrade Required ,"HTTP ([RFC 2817], [IANAREG])"
,[CODE(HTTP)[[[427]]]],SOAPAction,HTTP
,[CODE(HTTP)[[[428]]]],Precondition Required,HTTP
,[CODE(HTTP)[[[429]]]],Too Many Requests,HTTP
,[CODE(HTTP)[[[430]]]],WOULD BLOCK,HTTP
,[CODE(HTTP)[[[431]]]],Request Header Fields Too Large,HTTP
,[CODE(HTTP)[[[432]]]],Transition Needed,[[HTTP]] ([[I-D]])
,[CODE(HTTP)[[[440]]]],Login Timeout,[[HTTP]]
,[CODE(HTTP)[[[444]]]],No Response,HTTP
,[CODE(HTTP)[[[449]]]],Retry With,HTTP
,[CODE(HTTP)[[[450]]]],Blocked by Windows Parental Controls,HTTP
,[CODE(HTTP)[[[450]]]],Authentication mechanism not accepted,[[HTTP]] ([[I-D]])
,[CODE(HTTP)[[[451]]]],Unavailable for Legal Reasons,[[HTTP]]
,[CODE(HTTP)[[[451]]]],Redirect,HTTP
,[[451]] ,Parameter Not Understood ,RTSP [RFC 2326]
,[[452]] ,Conference Not Found ,RTSP [RFC 2326]
,[[453]] ,Not Enough Bandwidth ,RTSP [RFC 2326]
,[[454]] ,Session Not Found ,RTSP [RFC 2326]
,[[455]] ,Method Not Valid in This State ,RTSP [RFC 2326]
,[[456]] ,Header Field Not Valid for Resource ,RTSP [RFC 2326]
,[[457]] ,Invalid Range ,RTSP [RFC 2326]
,[[458]] ,Parameter Is Read-Only ,RTSP [RFC 2326]
,[[459]] ,Aggregate operation not allowed ,RTSP [RFC 2326]
,[[460]] ,Only aggregate operation allowed ,RTSP [RFC 2326]
,[[461]] ,Unsupported transport ,RTSP [RFC 2326]
,[[462]] ,Destination unreachable ,RTSP [RFC 2326]
,[CODE[[[462]]]],Property not defined in Source Format,[[mediaont-api]]
,[CODE(HTTP)[[[470]]]],,[[HTTP]]
,[[480]] ,Temporarily not available ,"SIP ([RFC 2543], [RFC 3261])"
,[[481]] ,Call Leg/Transaction Does Not Exist ,"SIP ([RFC 2543], [RFC 3261])"
,[[482]] ,Loop Detected ,"SIP ([RFC 2543], [RFC 3261])"
,[[483]] ,Too Many Hops ,"SIP ([RFC 2543], [RFC 3261])"
,[[484]] ,Address Incompleted ,"SIP ([RFC 2543], [RFC 3261])"
,[[485]] ,Ambiguous ,"SIP ([RFC 2543], [RFC 3261])"
,[[486]] ,Busy Here ,"SIP ([RFC 2543], [RFC 3261])"
,[[487]] ,Request Termineted ,SIP ([RFC 3261])
,[[488]] ,Not Acceptable Here ,SIP ([RFC 3261])
,[[489]] ,Bad Event ,SIP ([RFC 3265])
,[[491]] ,Request Pending ,SIP ([RFC 3261])
,[[493]] ,Undecipherable ,SIP ([RFC 3261])
,[CODE(HTTP)[[[494]]]],Request Header Too Large,HTTP
,[[494]] ,Security Agreement Required ,SIP ([RFC 3329])
,[CODE(HTTP)[[[495]]]],Cert Error,HTTP
,[CODE(HTTP)[[[496]]]],No Cert,HTTP
,[CODE(HTTP)[[[497]]]],HTTP to HTTPS,HTTP
,[CODE(HTTP)[[[498]]]],Token expired/invalid,[[HTTP]]
,[CODE(HTTP)[[[499]]]],Client Closed Request,[[HTTP]]
,[CODE(HTTP)[[[499]]]],Token required,[[HTTP]]
,[CODE[[[5[VAR[xx]]]]]] ,== ,"HTTP, RTSP, SIP"
,[CODE(HTTP)[[[500]]]] ,Internal Server Error ,"HTTP ([RFC 1945], [RFC 2068], [RFC 2616]), RTSP ([RFC 2326]), SIP ([RFC 2543], [RFC 3261]), [[mediaont-api]]"
,[CODE(HTTP)[[[500]]]],Server Internal Error,[[Q4S]]
,[CODE(HTTP)[[[501]]]] ,Not Implemented ,"HTTP ([RFC 1945], [RFC 2068], [RFC 2616]), RTSP ([RFC 2326]), SIP ([RFC 2543], [RFC 3261]), CGI ([RFC 3875]), SSTP, [[Q4S]]"
,[[502]] ,Bad Gateway ,"HTTP ([RFC 1945], [RFC 2068], [RFC 2616]), RTSP ([RFC 2326]), SIP ([RFC 2543], [RFC 3261])"
,[CODE(HTTP)[[[503]]]] ,Service Unavailable ,"HTTP ([RFC 1945], [RFC 2068], [RFC 2616]), RTSP ([RFC 2326]), SIP ([RFC 2543], [RFC 3261]), SSTP, [[Q4S]]"
,[[504]] ,Gateway Timeout ,"HTTP ([RFC 2068], [RFC 2616])"
,504 ,Gateway Time-out ,"RTSP ([RFC 2326]), SIP ([RFC 2543], [RFC 3261])"
,[CODE(HTTP)[[[504]]]],Server Time-out,[[Q4S]]
,[[505]] ,HTTP Version Not Supported ,"HTTP ([RFC 2068], [RFC 2616])"
,505 ,RTSP Version not supported ,RTSP [RFC 2326]
,505 ,SIP Version not supported ,"SIP ([RFC 2543], [RFC 3261])"
,[CODE(HTTP)[[[505]]]],Version Not Supported,[[Q4S]]
,[[506]] ,Variant Also Negotiates ,HTTP ([RFC 2295])
,[[507]] ,Insufficient Storage ,HTTP ([RFC 2518])
,[CODE(HTTP)[[[508]]]],Loop Detected,HTTP
,[CODE(HTTP)[[[508]]]],Cross Server Binding Forbidden,HTTP
,[CODE(HTTP)[[[509]]]],Bandwidth Limit Exceeded,HTTP
,[[510]] ,Not Extended ,HTTP ([RFC 2774])
,[CODE[[[510]]]] ,Not Local IP ,SSTP
,[CODE[[[511]]]],Network Authentication Required,HTTP
,[CODE[[[511]]]] ,In Black List ,SSTP
,[CODE[[[512]]]] ,Invisible ,SSTP
,[[513]] ,Message Too Large ,"SIP ([RFC 3161]), [[Q4S]]"
,[CODE(HTTP)[[[520]]]],Origin Error,[[HTTP]]
,[CODE(HTTP)[[[520]]]],Protocol Extension Error,[[HTTP]]
,[CODE(HTTP)[[[521]]]],Protocol Extension Not Implemented,[[HTTP]]
,[CODE(HTTP)[[[522]]]],Origin Connection Time-out,HTTP
,[CODE(HTTP)[[[522]]]],Protocol Extension Parameters Not Acceptable,[[HTTP]]
,[CODE(HTTP)[[[523]]]],,[[HTTP]]
,[CODE(HTTP)[[[524]]]],Origin Time-out,[[HTTP]]
,[CODE(HTTP)[529]],,[[HTTP]]
,[[551]] ,Option not supported ,RTSP [RFC 2326]
,[CODE[555]],,[[HTTP]]
,[CODE[[[562]]]],Property not supported, [[mediaont-api]]
,[CODE[564]]
,[[580]] ,Precondition Failure ,SIP [RFC 3312]
,[CODE[591]],Restore successful,[[HTTP]] ([[CEA-2014-B]])
,[CODE[592]],Cannot connect to provided saved state URL,[[HTTP]] ([[CEA-2014-B]])
,[CODE[593]],Unidentified error while restoring,[[HTTP]] ([[CEA-2014-B]])
,[CODE[594]],Save successful,[[HTTP]] ([[CEA-2014-B]])
,[CODE[595]],Page does not include save-restore plugin object,"[[HTTP]], [[HTTP]] ([[CEA-2014-B]])"
,[CODE[596]],Cannot connect to provided storage server URL,"[[HTTP]], [[HTTP]] ([[CEA-2014-B]])"
,[CODE[597]],Unidentified error while saving,"[[HTTP]], [[HTTP]] ([[CEA-2014-B]])"
,[CODE(HTTP)[[[598]]]],Network read timeout error,HTTP
,[CODE(HTTP)[[[599]]]],Network connect timeout error,HTTP
,[CODE[[[6[VAR[xx]]]]]] ,== ,SIP
,[[600]] ,Busy Everywhere ,"SIP ([RFC 2543], [RFC 3261])"
,[CODE(HTTP)[[[600]]]],session does not exist,[[Q4S]]
,[CODE(HTTP)[[[601]]]],quality level not allowed,[[Q4S]]
,[[603]] ,Decline ,"SIP ([RFC 2543], [RFC 3261])"
,[CODE(HTTP)[[[603]]]],Session not allowed,[[Q4S]]
,[[604]] ,Does not exist anywhere ,"SIP ([RFC 2543], [RFC 3261])"
,[CODE(HTTP)[[[604]]]],authorization not allowed,[[Q4S]]
,[[606]] ,Not Acceptable ,"SIP ([RFC 2543], [RFC 3261])"
,[CODE(HTTP)[[[1223]]]],,HTTP
,[CODE(HTTP)[[[12152]]]],Unknown,HTTP
[636] [[JSON]] 形式の一覧ファイルが >>635 にあります。
[REFS[
- [635] [CITE@en[data-web-defs/http-status-codes.txt at master · manakai/data-web-defs]] ([TIME[2014-08-10 06:26:13 +09:00]] 版) <https://github.com/manakai/data-web-defs/blob/master/doc/http-status-codes.txt>
]REFS]
[43] 数値が割り当てられずに廃案となった提案:
[FIG(list short)[
- [[2NN Contents of Related]]
]FIG]
* IANA 登録簿
[608] [[HTTP]] の登録簿は [[RFC 2817]] により (ようやく) 設けられました [SRC[>>609]]。
[16] その後 [[RFC 7231]] により再定義されています。
- [IANAREG]
-- (HTTP) ''HTTP Status Code Registry'' <http://www.iana.org/assignments/http-status-codes>
-- (RTSP) 登録簿無し
-- (SIP) <http://www.iana.org/assignments/sip-parameters>
[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>
- [4] SIP/2.0 は、 RFC 2543 では六百番台以外は 80番台を使うことで衝突を回避すると書いてありましたが、 RFC 3261 でその一節は消えて、実際他の番号に進出しています。 (で、見事に HTTP/1.1 (RFC 2616, RFC 2318) と衝突しています。。。)
[5]
[CITE[Real Time Streaming Protocol (RTSP)/1.0 Parameters]] <http://www.iana.org/assignments/rtsp-parameters>
* 状態符号の拡張
[19] [[HTTP]] 仕様は[[状態符号]]の [[IANA]] 登録手続きを規定していますが、
登録されていない[[状態符号]]の利用を明確に禁じてはいません。
[20] 実際に未登録の[[状態符号]]を使った例は多々あります。 ([[状態符号]]の
[[IANA登録簿]]が出来る前から非標準の[[状態符号]]は使われていたと思われます。)
[21] >>11 のような工夫が行われることもありますが、行われないこともあります。
そして実際に非標準の[[状態符号]]と新たに [[RFC]] 化された[[状態符号]]が衝突した例もあります。
;; [22] [[IETF]] は [[HTTP]] に関わらず一般に市場で利用されているものを調査してそれを標準化したり、
それとの衝突を避けたりする努力をしていないので、[[状態符号]]以外でもこのような例はいくつもあります。
* 性質
[24] [[HTTP]] の仕様書は [CODE(HTTP)[[[2xx]]]] と [CODE(HTTP)[[[3xx]]]]
を''除く''[[状態符号]]の[[応答]]を [DFN[non-error response]]
と呼んでいます [SRC[>>23]]。
;; [25] [CODE(HTTP)[[[1xx]]]] もエラーではありませんが、[[キャッシュ]]に関する規定の一部で使われている用語なので、
[[キャッシュ]]に関係しない [CODE(HTTP)[[[1xx]]]] には言及していないものと思われます。
[45] [[状態符号]]には、次の分類があります。
[FIG(short list)[
- [[null body status]]
- [[ok status]]
- [[redirect status]]
]FIG]
* 事前条件と事後条件
[32] [[WebDAV]] では[[状態符号]]よりも細かいエラーの詳細を [[XML]]
形式で表現でき、これを[[事前条件符号]]や[[事後条件符号]]と呼んでいます。
;; [CODE(XMLe)@en[[[error]]]] [[要素]]の項を参照。
* CATP
[72]
[[CATP]] の[DFN[ステータスコード]]は、
[[HTTP状態符号]]と同様に3桁で1桁目の意味もおなじですが (但し [CODE[1xx]] は予約)、
下2桁は[[実装依存]]とされています。
[SRC[>>71]]
-[71]
[CITE@ja[CATP/1.0 chap.3]], [TIME[2023-06-26T07:43:57.000Z]], [TIME[2023-07-04T02:26:12.380Z]] <https://catill.bitbucket.io/CATP/catp/chap3.html#chap3.3(5)>
-[73] [CITE[status code]], [TIME[2023-11-25T04:05:55.000Z]], [TIME[2001-01-16T17:51:44.550Z]] <https://web.archive.org/web/20010116174100/http://www.nii.ac.jp/CAT-ILL/INFO/newcat/jissou_siyo/sta_code.html>
- [75]
[CITE@JA[null]], [TIME[2023-11-22T00:11:30.000Z]], [TIME[2023-11-25T04:22:37.098Z]] <https://catill.bitbucket.io/CATP/catp1.1/honbun.html#_Toc464618948>
[74]
[[HTTP]] と同じ数値でも意味は違うことがあります。
* 歴史
[FIG(quote)[
[FIGCAPTION[
[615] RFC 1945 (HTTP/1.0), RFC 2068・2616 (HTTP/1.1) 6.1.1 Status Code and Reason Phrase
]FIGCAPTION]
> The Status-Code element is a 3-digit integer result code of the
attempt to understand and satisfy the request. [INS[[INS[{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.
[CODE(ABNF)[Status-Code]] 要素は要求を理解し満足しようと試みた結果の3桁整数符号です。[INS[この符号は10章で完全に定義しています。]]
[CODE(ABNF)[Reason-Phrase]] は [CODE(ABNF)[Status-Code]] の短文の説明を与えることを意図しています。
[CODE(ABNF)[Status-Code]] は自動化に使うことを意図しており、
[CODE(ABNF)[Reason-Phrase]] は人間利用者向けを意図しています。
クライアントが [CODE(ABNF)[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:
[CODE(ABNF)[Status-Code]] の最初の数字は応答の種別を定義します。
後ろの2桁は分類的役割は持っていません。最初の数字には5つの値があります。
>
- [DEL[[INS[{1945,2068}]] o]] [INS[[INS[{2616}]] -]] 1xx: Informational - [DEL[[INS[{1945}]] Not used, but reserved for future use]] [INS[[INS[{2068,2616}]] Request received, continuing process]]
- [DEL[[INS[{1945,2068}]] o]] [INS[[INS[{2616}]] -]] 2xx: Success - The action was successfully received, understood, and accepted[DEL[.]]
- [DEL[[INS[{1945,2068}]] o]] [INS[[INS[{2616}]] -]] 3xx: Redirection - Further action must be taken in order to
complete the request
- [DEL[[INS[{1945,2068}]] o]] [INS[[INS[{2616}]] -]] 4xx: Client Error - The request contains bad syntax or cannot
be fulfilled
- [DEL[[INS[{1945,2068}]] o]] [INS[[INS[{2616}]] -]] 5xx: Server Error - The server failed to fulfill an apparently
valid request
- [CODE(HTTP)[[[1xx]]]] : 情報提供 — [DEL[使用されておらず、将来の使用のために予約]] [INS[要求を受信し、処理を継続]]
- [CODE(HTTP)[[[2xx]]]] : 成功 — 動作は成功裏に受信し、理解し、受け入れた
- [CODE(HTTP)[[[3xx]]]] : 再指向 — 要求を完了するためには更なる動作を取らなければならない
- [CODE(HTTP)[[[4xx]]]] : クライアント誤り — 要求は悪い構文を含んでいるか、または満たすことができない
- [CODE(HTTP)[[[5xx]]]] : サーバー誤り — サーバーは妥当そうな要求を満たすことに失敗した
> The individual values of the numeric status codes defined
for [DEL[[INS[{1945}]] HTTP/1.0]] [INS[[INS[{2068,2616}]] HTTP/1.1]], and an example set of corresponding Reason-Phrase's, are
presented below. The reason phrases listed here are only [DEL[[INS[{1945,2068}]] recommended]] [INS[[INS[{2616}]] recommendations]] -- they [DEL[[INS[{1945,2068}]] may]] [INS[[INS[{2616}]] MAY]] be replaced by local equivalents without affecting the protocol. [DEL[These codes are fully defined in Section 9.]]
HTTP 用に定義した数値状態符号の個々の値と対応する [CODE(ABNF)[Reason-Phrase]]
の例の集合を次に示します。
ここに挙げた理由語句は推奨に過ぎません。
プロトコルに影響なく局所的な同等のものに置換えて'''構いません'''。
[DEL[
[DEL[
> [INS[{1945}]]
-
[PRE[
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
]PRE]
]DEL]
[INS[
> [INS[{2068}]]
-
[PRE[
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
]PRE]
]INS]
]DEL]
[INS[
> [INS[{2616}]]
-
[PRE[
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
]PRE]
]INS]
>
- extension-code = 3DIGIT
- Reason-Phrase = *<TEXT, excluding CR, LF>
> HTTP status codes are extensible[DEL[, [INS[{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 [DEL[[INS[{1945}]] must]] [INS[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 [DEL[[INS[{1945}]] must not]] [INS[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 [DEL[[INS[{1945}]] should]] [INS[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 状態符号は拡張可能です[DEL[が、上述の符号は現在の慣習で一般的に認識されるもののみです]]。
HTTP [[応用]]はすべての登録された状態符号の意味を理解できる方が明らかに望ましくはありますが、その必要はありません。
しかし、応用は最初の数字が示す状態符号の種別を理解し、認識できない応答をその種別の
[CODE(HTTP)[[VAR[x]]00]] 状態符号と同等のものとして扱わなければ'''なりません'''。
ただし例外として、認識できない応答は[[キャッシュ]]しては'''なりません'''。
例えば、認識できない [CODE(HTTP)[[[431]]]] の状態符号を蔵あinnとが受信したとしたら、
クライアントはその要求の何かがおかしいのであると安全に仮定でき、
その応答を [CODE(HTTP)[[[400]]]] 状態符号で受取ったものとして扱えます。
その場合、[[利用者エージェント]]はその応答で返された[[実体]]を利用者に提示する'''べきです'''。
その実体にはおそらくその普通じゃない状態を説明する人間可読の情報を含んでいることでしょう。
]FIG]
** RFC 2817
[35] [[RFC 2817]] により[[状態符号]]の [[IANA登録簿]]が新設されました [SRC[>>609]]。
[REFS[
- [609] [CITE@en[RFC 2817 - Upgrading to TLS Within HTTP/1.1]] ([TIME[2012-01-09 20:05:09 +09:00]] 版) <http://tools.ietf.org/html/rfc2817#section-7.1>
]REFS]
** RFC 3875 (CGI/1.1)
→[[RFC 3875]] [CSECTION[6.3.3. Status]]
[607] [CITE@en[draft-nottingham-http-new-status-01 - Additional HTTP Status Codes]]
( ([TIME[2011-08-14 03:30:26 +09:00]] 版))
<http://tools.ietf.org/html/draft-nottingham-http-new-status-01>
[610] [CITE@en[RFC 4463 - A Media Resource Control Protocol (MRCP) Developed by Cisco, Nuance, and Speechworks]]
( ([TIME[2011-12-04 10:31:11 +09:00]] 版))
<http://tools.ietf.org/html/rfc4463#section-5.2.1>
[611] [CITE@en[RFC 4975 - The Message Session Relay Protocol (MSRP)]]
( ([TIME[2012-02-26 13:20:50 +09:00]] 版))
<http://tools.ietf.org/html/rfc4975#section-10>
[613] [CITE@en[RFC 6787 - Media Resource Control Protocol Version 2 (MRCPv2)]]
( ([TIME[2012-11-13 15:18:40 +09:00]] 版))
<http://tools.ietf.org/html/rfc6787#section-5.4>
[614] [CITE@en[RFC 6787 - Media Resource Control Protocol Version 2 (MRCPv2)]]
( ([TIME[2012-11-13 15:18:40 +09:00]] 版))
<http://tools.ietf.org/html/rfc6787#section-13.1.4>
[616] [CITE[Media Resource Control Protocol Version 2 (MRCPv2) Parameters]]
( ([TIME[2012-11-13 21:47:44 +09:00]] 版))
<http://www.iana.org/assignments/mrcpv2-parameters/mrcpv2-parameters.xhtml#status-codes>
[619] [CITE@en-us[Metadata API for Media Resources 1.0]]
( ([TIME[2014-03-12 15:50:19 +09:00]] 版))
<http://www.w3.org/TR/mediaont-api-1.0/#api-status-codes>
[638] [CITE@en[draft-aranda-dispatch-q4s-02 - The Quality for Service Protocol]]
( ([TIME[2014-07-28 09:14:06 +09:00]] 版))
<http://tools.ietf.org/html/draft-aranda-dispatch-q4s-02#section-4>
** RFC 6585
[REFS[
- [56] [CITE@en[RFC 6585 - Additional HTTP Status Codes]] ([TIME[2015-11-02 08:48:01 +09:00]] 版) <https://tools.ietf.org/html/rfc6585>
]REFS]
[57] [[IETF]] は2012年4月に [DFN[[[RFC 6585]]]] を発行し、
[[状態符号]]を4つ規定しています。
[FIG(short list)[
- [CODE[[[428]]]]
- [CODE[[[429]]]]
- [CODE[[[431]]]]
- [CODE[[[511]]]]
]FIG]
[58] この [[RFC]] は [[RFC 2616]] を[[更新]]する形となっていますが、
単なる追加規定なので、どこが[[更新]]なのか謎です。
;; [[IETF]] の手続きは謎だらけなので、気にしなくて良いと思われます。
** HTTP/2
[44] [[HTTP/2]] では[[状態行]]が廃止されています。 [[SPDY]] では
[CODE(HTTP)@en[[[status]]]] [[ヘッダー]]が使われました。 [[HTTP/2]]
では [CODE(HTTP)@en[[[:status]]]] [[疑似ヘッダー]]となっています。
* 実装
[6]
[CITE@en-US[Force Apache to output any HTTP Status Code with ErrorDocument]] ([CODE[2007-03-05 07:36:37 +09:00]] 版) <http://www.askapache.com/2007/htaccess/apache-status-code-headers-errordocument.html>
([[名無しさん]] [WEAK[2007-03-04 22:43:40 +00:00]])
[612] [CITE[AnyEvent::HTTP - search.cpan.org]]
([TIME[2012-04-13 17:22:16 +09:00]] 版)
<http://search.cpan.org/~mlehmann/AnyEvent-HTTP-2.13/HTTP.pm>
[617] [CITE@ja-JP[IIS 7.0、IIS 7.5、および IIS 8.0 の HTTP 状態コード]]
( ([TIME[2013-11-19 06:48:28 +09:00]] 版))
<http://support.microsoft.com/kb/943891/ja>
[618] [CITE[IISのステータスコードは小数点つきという話 - ういはるかぜの化学 - subtech]]
( ([TIME[2013-11-20 08:15:38 +09:00]] 版))
<http://subtech.g.hatena.ne.jp/mayuki/20131120/1384901536>
[31] [[LWP]] で使われる[[Perlモジュール]]である [CODE(perl)@en[[[HTTP::Response]]]]
は、 [DFN[[CODE(perl)@en[[[code]]]]]] [[メソッド]]が[[状態符号]]を返します。
* 関連
[624] [[CoAP]] は [[HTTP]] と類似した[[状態符号]]を使っていますが、 [[HTTP]]
の百の位に当たる整数部1桁と、十・一の位にあたる小数部2桁を小数点 [CODE[.]]
で連結した表記となっています。整数部は3ビット、小数部は5ビットの整数です。
[625] ただし [CODE[[[0.00]]]] は[[空メッセージ]]を表すものとされており、
それ以外の整数部が 0 の値は[[メソッド]]に割り当てられています。 ([[CoAP]]
は [[HTTP]] に由来する[[メソッド]]を使っていますが、数値が割り当てられています。)
整数部が 1、6、7 の値は予約されています。それ以外、つまり 2、3、4
が[[状態符号]]となっています。
[34] [CITE[IRC logs: freenode / #whatwg / 20150125]]
([TIME[2015-01-26 11:31:25 +09:00]] 版)
<http://krijnhoetmer.nl/irc-logs/whatwg/20150125>
[FIG(quote)[
[FIGCAPTION[
[36] [CITE@en-GB-x-hixie[HTML Standard]]
([TIME[2015-03-05 09:33:40 +09:00]] 版)
<https://html.spec.whatwg.org/#concept-http-equivalent-codes>
]FIGCAPTION]
> 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.
]FIG]
[52] [CITE@en[Define status, ok status, and use them both · whatwg/fetch@159d43c]]
([TIME[2015-09-08 19:57:36 +09:00]] 版)
<https://github.com/whatwg/fetch/commit/159d43c7d55e682d7f3fc3cc800d1c004dd183f6>
[59] [CITE@en[draft-schulzrinne-http-status-00 - Assignment of Status Codes for HTTP and HTTP-Derived Protocols]]
([TIME[2016-01-08 17:16:31 +09:00]] 版)
<https://tools.ietf.org/html/draft-schulzrinne-http-status-00>
[FIG(quote)[
[FIGCAPTION[
[60] [CITE@en[nginx/ngx_event_openssl_stapling.c at master · nginx/nginx]]
( ([TIME[2016-05-28 21:53:15 +09:00]]))
<https://github.com/nginx/nginx/blob/master/src/event/ngx_event_openssl_stapling.c>
]FIGCAPTION]
>
> case '.': /* IIS may send 403.1, 403.2, etc */
]FIG]
[61] [CITE@en[Replace 'HTTP status code' with 'HTTP status']]
([[vkatsikaros]]著, [TIME[2017-01-09 00:44:34 +09:00]])
<https://github.com/w3c/webdriver/commit/30ed50c68b8c52da7996df8e5e037f838ee9b826>
[FIG(quote)[
[FIGCAPTION[
[69] [CITE[カーセンサー | APIリファレンス | リクルートWEBサービス]]
([TIME[2017-04-28 17:40:10 +09:00]])
<https://webservice.recruit.co.jp/carsensor/reference.html>
]FIGCAPTION]
> エラーの際でも、HTTPレスポンスステータスは常に "200 OK" が返ります。実装側では常にレスポンスXMLの内容を見てエラー判断を行ってください。
]FIG]
[70] [CITE@en[Make status message default to the empty byte sequence]]
([[annevk]]著, [TIME[2018-04-25 01:21:13 +09:00]])
<https://github.com/whatwg/fetch/commit/0dec453f642c1fe57e6e7627c9a66cf7f8b8394d>