-
Notifications
You must be signed in to change notification settings - Fork 4
/
709.txt
94 lines (68 loc) · 6.08 KB
/
709.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
[415] [DFN[[CODE(HTTP)[[[403]]]]]] ([DFN[[[Forbidden]]]]) は、[[要求]]の処理が禁止されている
(アクセス権限がないと判断された) ことを表す[[状態符号]]です。
* 仕様書
[REFS[
- [407] '''[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.3>'''
- [1] [CITE@en[RFC 7235 - Hypertext Transfer Protocol (HTTP/1.1): Authentication]] ([TIME[2014-09-11 10:01:28 +09:00]] 版) <https://tools.ietf.org/html/rfc7235#section-2.1>
- [6] [CITE@en[RFC 4918 - HTTP Extensions for Web Distributed Authoring and Versioning (WebDAV)]] ([TIME[2014-09-21 17:04:59 +09:00]] 版) <http://tools.ietf.org/html/rfc4918#section-14.5>
- [8] [CITE@en[RFC 4918 - HTTP Extensions for Web Distributed Authoring and Versioning (WebDAV)]] ([TIME[2014-09-21 17:04:59 +09:00]] 版) <http://tools.ietf.org/html/rfc4918#section-16>
- [11] [CITE@en[RFC 4918 - HTTP Extensions for Web Distributed Authoring and Versioning (WebDAV)]] ([TIME[2014-09-21 17:04:59 +09:00]] 版) <http://tools.ietf.org/html/rfc4918#section-16>
- [4] [CITE@en[RFC 7168 - The Hyper Text Coffee Pot Control Protocol for Tea Efflux Appliances (HTCPCP-TEA)]] ([TIME[2014-10-12 17:41:43 +09:00]] 版) <http://tools.ietf.org/html/rfc7168#section-2.3.2>
]REFS]
* 意味
[409] [CODE(HTTP)[[[403]]]] は、[[鯖]]が[[要求]]を理解したものの、
それに[[権限]]を与えることを拒絶したことを示します [SRC[>>407]]。
[9] 常に失敗するので反復するべきでないことを暗示しています [SRC[>>8]]。
;; [10] 修正して反復すれば成功するかもしれない時は [CODE(HTTP)[[[409]]]]
を使えます [SRC[>>8]]。
* 構文
[410] [[鯖]]は、[[要求]]が禁止された理由を公開したい場合は、
その理由を [[payload]] で説明できます [SRC[>>407]]。
[7] [[payload body]] には [CODE(URI)@en[[[DAV:]]]] [[名前空間]]の
[CODE(XMLe)@en[[[error]]]] [[要素]]を使うことができます [SRC[>>6]]。
[12] [[WebDAV]] [[鯖]]は、適切な[[事前条件符号]]や[[事後条件符号]]があれば
[[XML]] を返す[['''べきです''']]。それ以外のエラーでは空の [[payload body]]
を返しても構いませんし、独自の[[要素]]を使ってエラーを表しても構いません。 [SRC[>>11]]
* 文脈
[2] [[鯖]]は、[[要求]]に妥当な [[credentials]] が含まれていて、
なお適切なアクセス権を有しない場合には、
[CODE(HTTP)[[[403]]]] [[応答]]を返す[RUBYB[べき]@en[ought to]]です [SRC[>>1]]。
;; [3] 非妥当な [[credentials]] (誤った[[パスワード]]など) が含まれている時や、
[[credentials]] が含まれていない時には、 [CODE(HTTP)[[[401]]]] や
[CODE(HTTP)[[[407]]]] を使うべきです。
[5] [[HTCPCP-TEA]] において [CODE(HTTP)@en[[[Accept-Additions:]]]]
[[ヘッダー]]で指定された添加物の組み合わせが不適切とみなされる時は、
[CODE(HTTP)[[[403]]]] [[応答]]を返すことができます [SRC[>>4]]。
* 処理モデル
[411] [[要求]]に [[credentials]] が含まれていた場合は、
[[鯖]]がアクセスを認めるのには不十分と判断したことを示していますから、
[[クライアント]]は同じ [[credentials]] で[[要求]]を繰り返す[['''べきではありません''']]
[SRC[>>407]]。
;; [412] [[クライアント]]は別の [[credentials]] で[[要求]]を繰り返しても構いません。
ただし禁止されたのは [[credentials]] 以外の理由かもしれません。 [SRC[>>407]]
* 歴史
[FIG(quote)[
[FIGCAPTION[
[408] RFC 1945 (HTTP/1.0); RFC 2068 & 2616 (HTTP/1.1) 10.4.4 403 Forbidden
]FIGCAPTION]
> The server understood the request, but is refusing to fulfill it. Authorization will not help and the request [DEL[[INS[{1945}]] should not]] [INS[SHOULD NOT]]
be repeated. If the request method was not HEAD and the server wishes to make
public why the request has not been fulfilled,
it [DEL[[INS[{1945}]] should]] [INS[SHOULD]] describe the reason for the refusal in the entity [DEL[body]]. [DEL[[INS[{1945,2068}]] This status code is commonly used when the server does not wish to reveal exactly why the request has been refused, or when no other response is applicable.]] [INS[[INS[{2616}]] If the server does not wish to make this information available to the client, the status code 404 (Not Found) can be used instead.]]
サーバーは要求を理解しましたが、これを満たすことを拒否しています。
認証は助けとならず、要求を繰り返す'''べきではありません'''。
要求 method が [CODE(HTTP)[[[HEAD]]]] ではなく、
サーバーがなぜ要求が満たされなかったのかを公表したいと思うのであれば、
応答の実体[DEL[本体]]において拒否の理由を説明する'''べきです'''。 [DEL[この状態符号は、サーバーが要求を拒否した実際の理由を晒したくないと思っている時や他の適当な応答がないときに広く使われています。]] [INS[サーバーがこの情報をクライアントに知らせたくないと思うときは、代わりに状態符号 [CODE(HTTP)[404]] (見つかりません) を使うことができます。]]
]FIG]
[405] [CITE@en[RFC 7168 - The Hyper Text Coffee Pot Control Protocol for Tea Efflux Appliances (HTCPCP-TEA)]]
( ([TIME[2014-04-02 07:55:01 +09:00]] 版))
<http://tools.ietf.org/html/rfc7168#section-2.3.2>
[406] [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.4>
* 関連
[413] [[起源鯖]]は、[[対象資源]]の存在をも隠したいときは、
[CODE(HTTP)[[[403]]]] ではなく [CODE(HTTP)[[[404]]]] を使っても構いません [SRC[>>407]]。
[414] 禁止の理由が [[credentials]] が正しくないこと、あるいは [[credentials]]
が与えられていないことの場合は、 [CODE(HTTP)[[[401]]]] を使うことができます。