[1] [DFN[[CODE(HTTP)@en[[[Pragma:]]]]]] [[ヘッダー]]は、
[[キャッシュ]]に関する指示を記述するものでした。 [CODE(HTTP)@en[[[Cache-Control:]]]]
[[ヘッダー]]の導入以前に使われていました。

* 仕様書

[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>'''
- [31] [CITE@en-GB-x-hixie[HTML Standard]] ([TIME[2014-12-04 10:25:09 +09:00]] 版) <https://html.spec.whatwg.org/#processing-model-10:http-cache-control>
]REFS]

* 意味

[16] [CODE(HTTP)@en[[[Pragma:]]]] [[ヘッダー]]は、 [[HTTP/1.0]]
時代に[[受信者]]に対する[[実装規定]]の[[指令]]を記述するためのものとして導入されました。
[[HTTP/1.1]] 時代になって[[相互運用性]]を損ねるものとして[[非推奨]]とされています。 [SRC[>>14]]

[17] 現在は [CODE(HTTP)@en[[[Pragma:]]]] [[ヘッダー]]は
[[HTTP/1.0]] [[キャッシュ]]との[[後方互換性]]のために
[CODE(HTTP)@en[[[no-cache]]]] [[指令]]を記述するためのものとされています [SRC[>>14]]。

* 構文

[21] [CODE(HTTP)@en[[[Pragma:]]]] [[ヘッダー]]の値は、1つ以上の
[CODE(ABNF)@en[pragma-directive]] の[[リスト]] ([CODE(HTTP)[#]]) です [SRC[>>14]]。

[FIG(railroad)[
= [CODE(ABNF)@en[pragma-directive]]
= *
== [[OWS]]
== [CODE(HTTP)[[[,]]]]
== [[OWS]]
== [CODE(ABNF)@en[pragma-directive]]
]FIG]

[22] [CODE(ABNF)@en[pragma-directive]] は、名前と値を [CODE(HTTP)[[[=]]]]
で連結したものです。ただし [CODE(HTTP)[=]] と値は省略できます。 [SRC[>>14]]

[23] 名前は[[字句]]です [SRC[>>14]]。[[大文字・小文字不区別]]です。

;; [28] 仕様上は [[ABNF]] により [CODE(HTTP)@en[[[no-cache]]]] が[[大文字・小文字不区別]]と明確になっていますが、それ以外がそうなのかどうかは明言されていません。

[24] 値は[[字句]]または[[引用文字列]]です。 [SRC[>>14]]

[FIG(railroad)[
= [[字句]]
= ?
== [CODE(HTTP)[[[=]]]]
== |
=== [[字句]]
=== [[引用文字列]]
]FIG]

[26] 値の有無やその解釈は [CODE(ABNF)@en[pragma-directive]] によって異なります。

;; [25] [CODE(HTTP)[[[=]]]] の前後に [[BWS]] は無いようです。

* 文脈

[18] [[クライアント]]は、 [[HTTP/1.0]] [[キャッシュ]]との[[後方互換性]]のために必要なら
[CODE(HTTP)@en[[[Pragma:]] [[no-cache]]]] を指定できます [SRC[>>14]]。

[13] 明記されていませんが、 [CODE(HTTP)[[[304]]]] でも使って良いと推測されます。

* 処理

[19] [[要求]]に [CODE(HTTP)@en[[[Cache-Control:]]]] [[ヘッダー]]が含まれる場合、
[CODE(HTTP)@en[[[Pragma:]]]] [[ヘッダー]]は無視されます [SRC[>>14]]。

;; [20] [CODE(HTTP)@en[[[Cache-Control:]] [[no-cache]]]] が含まれなくても、
[CODE(HTTP)@en[[[Cache-Control:]]]] [[ヘッダー]]があれば無視されるようです。

[30] [CODE(DOMi)@en[[[EventSource]]]] のための [[fetch]] では、
[[応答]]の[[キャッシュ]]の[[ヘッダー]]は無視する[['''べき''']]で、
[[キャッシュ]]を使う[['''べきではありません''']] [SRC[>>31]]。

* [CODE(ABNF)@en[pragma-directive]]

[7] [CODE(ABNF)@en[[[pragma-directive]]]] としては次のものがあります。
[FIG(short list)[
- [CODE(HTTP)@en[[[no-cache]]]]
- [CODE(HTTP)@en[[[for]]]]
]FIG]

[2] この他 >>305 で多くの値が規定されています。

;; [27] [CODE(HTTP)@en[[[no-cache]]]] 以外は[[非推奨]]とされているようですが (>>16)、
他の値も特に禁止はされていません。

[3] [[指令]]の一覧は >>29 の [[JSON]] ファイルにも含まれています。
[REFS[
- [29] [CITE@en[data-web-defs/headers.txt at master · manakai/data-web-defs]] ([TIME[2014-10-09 14:33:34 +09:00]] 版) <https://github.com/manakai/data-web-defs/blob/master/doc/headers.txt>
]REFS]

* 歴史

- [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>

* 統計

[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]

[305] [CITE@en[2.2.1.4 Pragma]]
( ([TIME[2014-10-09 13:56:33 +09:00]] 版))
<http://msdn.microsoft.com/en-us/library/cc251236.aspx>

[306] [CITE[Request Headers in the HTTP protocol]]
( ([TIME[2001-11-29 20:01:38 +09:00]] 版))
<http://www.w3.org/Protocols/HTTP/HTRQ_Headers.html#pragma>

[307] [CITE@en[The Performance Impact of META REFRESH - IEInternals - Site Home - MSDN Blogs]]
( ([TIME[2014-12-11 17:52:27 +09:00]] 版))
<http://blogs.msdn.com/b/ieinternals/archive/2010/05/13/meta-refresh-causes-additional-http-requests.aspx>

[FIG(quote)[
[FIGCAPTION[
[32] [CITE@ja[Using Akamai Pragma headers to investigate or t... | Akamai Community]]
( ([TIME[2017-06-23 12:04:19 +09:00]]))
<https://community.akamai.com/community/web-performance/blog/2015/03/31/using-akamai-pragma-headers-to-investigate-or-troubleshoot-akamai-content-delivery>
]FIGCAPTION]

> Pragma: akamai-x-cache-on, akamai-x-cache-remote-on, akamai-x-check-cacheable, akamai-x-get-cache-key, akamai-x-get-ssl-client-session-id, akamai-x-get-true-cache-key, akamai-x-get-request-id
> 

]FIG]


[FIG(quote)[
[FIGCAPTION[
[33] [CITE@ja[Knowledge Base #7693 - Akamai Pragmaヘッダーをリクエストに... | Akamai Community]]
( ([TIME[2017-06-23 12:05:05 +09:00]]))
<https://community.akamai.com/docs/DOC-6369>
]FIGCAPTION]

> akamai-x-cache-on, akamai-x-cache-remote-on, akamai-x-check-cacheable, akamai-x-get-cache-key, akamai-x-get-extracted-values, akamai-x-get-nonces, akamai-x-get-ssl-client-session-id, akamai-x-get-true-cache-key, akamai-x-serial-no, akamai-x-get-request-id, akamai-x-request-trace, akamai-x--meta-trace, akama-xi-get-extracted-values

]FIG]


[34] [CITE@en[Pragma · Issue #140 · httpwg/http-core]]
([TIME[2019-06-27 14:24:37 +09:00]])
<https://github.com/httpwg/http-core/issues/140>

[35] [CITE@en[Deprecate Pragma by mnot · Pull Request #174 · httpwg/http-core]]
([TIME[2019-06-27 14:24:44 +09:00]])
<https://github.com/httpwg/http-core/pull/174>