/
45.txt
91 lines (63 loc) · 4.28 KB
/
45.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
[416] [DFN[[CODE(HTTP)@en[[[413]]]]]] ([DFN[[[Payload Too Large]]]])
は、[[要求]]の [[payload]] が[[鯖]]の処理できるサイズよりも大きいことを表す[[状態符号]]です。
* 仕様書
[REFS[
- [1] [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-6.5.11>
]REFS]
* 意味
[4] [CODE(HTTP)[[[413]]]] は、[[要求]]の [[payload]] が[[鯖]]が処理する意志がある、
あるいは処理できるよりも大きいために[[要求]]を拒むことを示しています [SRC[>>1]]。
* 構文
[415] [[鯖]]は、この状態が一時的なものである場合、[[クライアント]]が再試行してもよい時刻を表す
[CODE(HTTP)@en[[[Retry-After:]]]] [[ヘッダー]]を[[生成]]する[['''べきです''']] [SRC[>>1]]。
* 処理
[414] [[鯖]]は、[[クライアント]]が[[要求]]を継続することを防ぐため、
[[接続]]を閉じても構いません [SRC[>>1]]。
[417] [[鯖]]は[[接続]]を閉じない場合には、通常の [[HTTP]] の規則に従い当該[[要求]]を末尾まで読み飛ばさなければなりません。
[418] [[クライアント]]は[[要求]]を送信した途中で [CODE(HTTP)[[[413]]]]
を受信した場合、 [CODE(HTTP)@en[[[Transfer-Encoding:]] [[chunked]]]] なら直近の [[chunk]]
の後最後の [[chunk]] を送信して[[要求]]の送信を終えられますし、
[CODE(HTTP)@en[[[Transfer-Encoding:]]]] も [CODE(HTTP)@en[[[Content-Length:]]]]
もなければ任意の位置で[[HTTP接続]]を閉じることで終えられますが、
[CODE(HTTP)@en[[[Content-Length:]]]] を指定している場合には、
その長さまで[[要求]]を送信しなければなりません。
;; そうしなければ[[鯖]]が[[メッセージ]]の終端位置を正しく決定できません。
* 関連
[6] [[要求本体]]も参照。
* 実装
[8] [[nginx]] は[[応答本体]]の最大サイズを設定ファイルの [CODE[client_max_body_size]]
で指定できるようにしており、それを超えると [CODE[413]] を返します。
既定値は 1[[MB]] です。 [SRC[>>7]]
[REFS[
- [7] [CITE[Module ngx_http_core_module]]
([TIME[2017-08-09 16:39:23 +09:00]])
<https://nginx.org/en/docs/http/ngx_http_core_module.html#client_max_body_size>
]REFS]
* 歴史
[FIG(quote)[
[FIGCAPTION[
[2] RFC 2068 & 2616 (HTTP/1.1) 10.4.14 413 Request Entity Too Large
]FIGCAPTION]
> The server is refusing to process a request because the request
entity is larger than the server is willing or able to process. The
server [DEL[may]] [INS[MAY]] close the connection to prevent the client from continuing the request.
サーバーは、その処理する意思がある、又は処理することができるのよりも要求された実態が大きいがために、要求を処理するのを拒否しています。
サーバーは、クライアントが要求を継続するのを防ぐために接続を閉じても'''構いません'''。
> If the condition is temporary, the server SHOULD include a Retry-After header field to indicate that it is temporary and after what
time the client [DEL[may]] [INS[MAY]] try again.
この状況が一時的なものであれば、サーバーは [CODE(HTTP)[[[Retry-After]]]]
頭欄を含めてこれが一時的であって、どれだけの時間の後クライアントが再挑戦しても'''構わない'''かを示す'''べきです'''。
]FIG]
[REFS[
- [3] [CITE@en[RFC 7252 - The Constrained Application Protocol (CoAP)]] ([TIME[2014-06-27 00:59:37 +09:00]] 版) <http://tools.ietf.org/html/rfc7252#section-5.9.2.9>
]REFS]
[FIG(quote)[
[FIGCAPTION[
[5] [CITE@en[Creating Custom Search Engines programmatically | Custom Search | Google Developers]]
([TIME[2015-12-02 02:24:14 +09:00]] 版)
<https://developers.google.com/custom-search/docs/api#table_ondemand>
]FIGCAPTION]
> 413 - File too large The XML that is being submitted exceeds the Custom Search limit.
> Verify that your file is not exceeding the size limit, which is documented on the Selecting Sites to Search page and the Promotions page.
> If you are certain that the file size doesn't exceed the limit, try again later.
]FIG]