/
409.txt
204 lines (158 loc) · 11.7 KB
/
409.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
[1] [CODE(HTTP)[Pragma]] 頭欄を使って、要求・応答鎖の中継者・最終受信者に
pragma 指令を与えることができます。
例えば、 [CODE(HTTP)[Pragma: no-cache]] を''要求''で使うと、
要求鎖の途中で[[キャッシュ]]の複製を使わずに、[[起源サーバー]]の応答を得たいと主張できます。
[2] [CODE(HTTP)[Pragma]] 頭欄は [[HTTP/1.0]] で使われていましたが、
[[HTTP/1.1]] では互換性のためにのみ使用し、新たな pragma 指令は追加しないことになりました。
[CODE(HTTP)[[[no-cache]]]] は [CODE(HTTP)[[[Cache-Control]]: no-cache]]
で代替できます。
受信者が HTTP/1.0 か HTTP/1.1 か分からない時には [CODE(HTTP)[Pragma]]
と [CODE(HTTP)[Cache-Control]] の両方を使うのが良いとされています。
[3] [[応答]]の受信者 ([[WWWブラウザ]]など) が [[CGIスクリプト]]の出力のような動的に生成された応答をキャッシュしないように、
''応答で'' [CODE(HTTP)[Pragma: no-cache]] が使われることがよくあります。
([[HTML]] 形の [CODE(HTML)[<[CODE(HTMLe)[[[meta]]]] [CODE(HTMLa)[[[http-equiv]]]]="pragma" [CODE(HTMLa)[[[content]]]]="no-cache">]]
として使われることが特に多いようです。)
しかし、この使い方は実は RFC では規定されていません。 RFC 2616
の注記にあるように、正しく解釈される可能性は低いでしょう。
[WEAK[(現実には要求で使われることよりも応答で、しかも HTML 形で使われることが圧倒的に多いのでしょうけどねぇ。)]]
正しく理解されることを望む時は、 [CODE(HTTP)[Cache-Control: no-cache]]
を使わないといけません。
* 仕様書
[REFS[
- [14] [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-5.4>
]REFS]
* [CODE(ABNF)@en[pragma-directive]]
[7]
,[CODE(ABNF)@en[pragma-directive]],出典
,[CODE(HTTP)@en[[[for]]]],>>4
,[CODE(HTTP)@en[[[no-cache]]]],"[DEL[[[HTTP92]]]], [[RFC 1945]], [DEL[[[RFC 2068]]]], [[RFC 2616]]"
* 文脈
[13] 明記されていませんが、 [CODE(HTTP)[[[304]]]] でも使って良いと推測されます。
* 歴史
- [4] ''CMU School of Computer Science'' <http://www-2.cs.cmu.edu/webhelp/for-protocol.html> (1996年) は [CODE(HTTP)[[[for]]]] 引数を提案しています。要求では [CODE(HTTP)[Pragma: for=anyone]] または [CODE(HTTP)[Pragma: for=fqdn.example]], 応答ではこれに加えて [CODE(HTTP)[Pragma: for=request]] が使えます。複数可。実体の対象利用者を表すものみたいです。[WEAK[実用になるのか怪しいですし、結局標準化されずじまい。歴史的なものですね。]] 提案者のところのサーバーで実装していたみたいですが、今そのサーバーは普通の [[Apache]] みたいです。
[REFS[
- [11] [CITE[Request Headers in the HTTP protocol]]
( ([TIME[2001-11-29 11:01:38 +09:00]] 版))
<http://www.w3.org/Protocols/HTTP/HTRQ_Headers.html#pragma>
]REFS]
[5] >>11 は [CODE(HTTP)[no-cache]] を RFC 1945 と同じ意味で定義しています。それだけ。
[6] >>11 は、構文を自然言語で [CODE(ABNF)[[DFN[Pragma]] := #(token *(";" parameter))]] と定義していました。
[FIG(quote)[
[FIGCAPTION[
[15] RFC 1945 (HTTP/1.0) 10.12; RFC 2068・2616 (HTTP/1.1) 14.32 Pragma
]FIGCAPTION]
> The Pragma general-header field is used to include implementation-specific directives that [DEL[may]] [INS[[INS[{2616}]] might]] apply to any recipient along the
request/response chain. All pragma directives specify optional
behavior from the viewpoint of the protocol; however, some systems [DEL[may]] [INS[MAY]] require that behavior be consistent with the directives.
[CODE(HTTP)[Pragma]] [[一般頭欄]]は、要求・応答鎖沿いの任意の受信者に適用するかもしれない実装規定の指令を含めるのに使います。
すべての語用指令は、プロトコルの見地からの任意選択の動作を指定します。
しかし、システムによってはその動作が指令と一貫していることを要求しても'''構いません'''。
>
-Pragma = "Pragma" ":" 1#pragma-directive
>
- pragma-directive = "no-cache" | extension-pragma
-[DEL[extension-pragma = token [ "=" word ] ]]
-[INS[extension-pragma = token [ "=" ( token | quoted-string ) ] ]]
> When the [DEL["]]no-cache[DEL["]] directive is present in a request message, an
application [DEL[should]] [INS[SHOULD]] forward the request toward the origin server even
if it has a cached copy of what is being requested. [DEL[This allows a client to insist upon receiving an authoritative response to its request. It also allows a client to refresh a cached copy which is known to be corrupted or stale.]] [INS[This pragma directive has the same semantics as the no-cache cache-directive (see section 14.9) and is defined here for backward[DEL[s]] compatibility with HTTP/1.0. Clients SHOULD include both header fields when a no-cache request is sent to a server not known to be HTTP/1.1 compliant.]]
[CODE(HTTP)[no-cache]] 指令が要求メッセージに示されている時は、
[[応用]]は、たとえ要求されているもののキャッシュした複製を持っていたとしても、
その要求を[[起源サーバー]]に転送する'''べきです'''。[DEL[これによってクライアントはその要求に対する本家応答を受取ることを主張できます。クライアントが破壊されているまたは[[腐敗]]していると知っているキャッシュされた複製を更新することも可能になります。]] [INS[この語用指令は、 [CODE(HTTP)[no-cache]] [CODE(ABNF)[[[cache-directive]]]] と同じ意味を持ちまして、ここでは HTTP/1.0 との[[後方互換性]]のために定義します。クライアントは、 [CODE(HTTP)[no-cache]] 要求を HTTP/1.1 に従っていると分かっていないサーバーに送るときは両方の頭欄を含める'''べきです'''。]]
> Pragma directives [DEL[must]] [INS[MUST]] be passed through by a proxy or gateway
application, regardless of their significance to that application,
since the directives [DEL[may]] [INS[might [INS[{2616}]]]] be applicable to all recipients along the
request/response chain. It is not possible to specify a pragma for a
specific recipient; however, any pragma directive not relevant to a
recipient [DEL[should]] [INS[SHOULD]] be ignored by that recipient.
[CODE(HTTP)[Pragma]] 指令を、串や関門の応用は、その応用での重要度に拘らず、
次に渡さなければ'''なりません'''。なぜなら、指令は要求・応答鎖沿いのすべての受信者に適用可能かもしれないからです。
特定の受信者に語用を指定することはできません。しかし、受信者に関係のない語用指令はその受信者では無視する'''べきです'''。
[INS[
> [DEL[HTTP/1.1 clients SHOULD NOT send the Pragma request-header.]] HTTP/1.1
caches SHOULD treat "Pragma: no-cache" as if the client had sent
"Cache-Control: no-cache". No new Pragma directives will be defined
in HTTP.
;[DEL[HTTP/1.1 クライアントは [CODE(HTTP)[Pragma]] 要求頭を送る'''べきではありません'''。]]
HTTP/1.1 キャッシュは [CODE(HTTP)[Pragma: no-cache]] をクライアントが
[CODE(HTTP)[[[Cache-Control]]: no-cache]] を送ったのであるとして扱う'''べきです'''。
新しい [CODE(HTTP)[Pragma]] 指令は HTTP では定義されません。
[INS[
> Note: because the meaning of "Pragma: no-cache as a response
header field is not actually specified, it does not provide a
reliable replacement for "Cache-Control: no-cache" in a response [INS[(ママ)]]
注意: 応答頭欄としての [CODE(HTTP)[Pragma: no-cache]] の意味は実際には規定されていませんから、
応答中での [CODE(HTTP)[Cache-Control: no-cache]] の信頼できる置換は提供されません。
]INS]
]INS]
[INS[
注: 注記のない修正部は RFC 1945→2068 の変更点。
]INS]
]FIG]
[12] [CITE@en[RFC 3507 - Internet Content Adaptation Protocol (ICAP)]]
( ([TIME[2014-06-08 07:17:07 +09:00]] 版))
<http://tools.ietf.org/html/rfc3507#section-4.3.1>
* 実装
** IE
[2] [[WinIE]] 3.02〜4.01 には、[CODE(HTML)[<[CODE(HTMLe)[meta]] [CODE(HTMLa)[http-equiv]]="pragma" [CODE(HTMLa)[content]]="no-cache">]]
が最初の方にあるとキャッシュにきっちり保存してしまい、
M$ はこれを不具合と認識していました。
''Q222064 - "Pragma: No-cache" Tag May Not Prevent Page from Being Cached'' <http://web.archive.org/web/20010808174139/support.microsoft.com/support/kb/articles/Q222/0/64.ASP>
対策として、この文書では [CODE(HTMLe)[[[body]]]] 要素の後に2つめの
[CODE(HTMLe)[[[head]]]] 要素を置き、その中に [CODE(HTMLe)[meta]]
要素のタグを書けとものすごいことを言っています。例:
[PRE[
<HTML>
<HEAD>
<META HTTP-EQUIV="REFRESH" CONTENT="5">
<TITLE> Pragma No-cache </TITLE>
</HEAD>
<BODY>
This is an example of where to place the second header section<br>
so that the "Pragama, No-Cache" metatag will work as it is supposed to.<br>
</BODY>
<HEAD>
<META HTTP-EQUIV="PRAGMA" CONTENT="NO-CACHE">
</HEAD>
</HTML>
]PRE]
M$ は一体何を考えているのでしょう。英語の意味もついに分からなくなりましたか。
[1] [[WinIE4]] (4.01 SP2 まで) には、 [CODE(HTML)[<[CODE(HTMLe)[meta]] [CODE(HTMLa)[http-equiv]]="pragma" [CODE(HTMLa)[content]]="no-cache">]]
が含まれている文書について、その大きさが64キロオクテット以下なら[[キャッシュ]]から削除、それより大きければ普通に削除しないという挙動を取っていました。
[[M$]] はこれを不具合と認識し、修正パッチを出しています。
''Q234247 - Web Page with "Pragma: No-Cache" Tag Stored in Cache Not Deleted'' <http://web.archive.org/web/20010816054645/http://support.microsoft.com/support/kb/articles/Q234/2/47.ASP>
[3] ''Q234067 - HOWTO: Prevent Caching in Internet Explorer'' <http://web.archive.org/web/20010810040821/support.microsoft.com/support/kb/articles/Q234/0/67.ASP>
によれば、 WinIE4 と [[WinIE5]] で [CODE(HTTP)[Pragma: no-cache]] (と HTML 形)
を処理してくれるのは over [[SSL]] の時だけだそうです。
仕様書に従うなら [CODE(HTTP)[Pragma: no-cache]] が使えるのは要求のときで応答のときは駄目なんだ、ほんとは、なーんて珍しくまともなことを言っています。
[305] [CITE@ja-JP[''''''[''''''HOWTO'''''']'''''' Internet Explorer でキャッシュを無効にする]]
( ([TIME[2014-09-23 13:01:18 +09:00]] 版))
<http://support.microsoft.com/kb/234067>
* 統計
[8] [CITE@en[HTTP/1.1 Pragma header]] ([TIME[2009-07-19 11:31:44 +09:00]] 版) <http://www.http-stats.com/Pragma>
* 例
[9] >>8 より
>
* Pragma: no-cache
* Pragma: no-cache, xResetStrm=1
* Pragma: No-cache
* Pragma: cache
* Pragma: No-Cache
* Pragma: private
* Pragma: public
* Pragma: no-store
* Pragma: no-store, no-cache, must-revalidate
* Pragma: no cache
* Pragma: NO-CACHE
* Pragma: Private
* Pragma: no-cache, no-cache
* Pragma: no-cash
* Pragma: no-chache
* Pragma: no-store,no-cache
* Pragma: no_cache
* Pragma: nocache
[10]
[PRE(HTTP example code)[
Pragma: no-cache,rate=1.000000,stream-time=0,stream-offset=0:0,request-context=1,max-duration=0
Pragma: xClientGUID={baadc101-8645-d5a3-9571d14a66ea2b8f}
]PRE]