···2929 Stream { source; mime; length }
30303131let of_file ?mime file =
3232- let mime = match mime with
3333- | Some m -> m
3434- | None ->
3535- (* Guess MIME type from filename if available *)
3636- let path = Eio.Path.native_exn file in
3737- let mime_map = [
3838- (".json", Mime.json);
3939- (".html", Mime.html);
4040- (".xml", Mime.xml);
4141- (".txt", Mime.text);
4242- ] in
4343- let guessed =
4444- List.find_map (fun (suffix, mime_type) ->
4545- if String.ends_with ~suffix path then Some mime_type else None
4646- ) mime_map
4747- |> Option.value ~default:Mime.octet_stream
4848- in
4949- Log.debug (fun m -> m "Guessed MIME type %s for file %s" (Mime.to_string guessed) path);
5050- guessed
5151- in
3232+ let path = Eio.Path.native_exn file in
3333+ let mime = Option.value mime ~default:(
3434+ (* Use magic-mime library to guess MIME type from file extension *)
3535+ let guessed_str = Magic_mime.lookup path in
3636+ let guessed = Mime.of_string guessed_str in
3737+ Log.debug (fun m -> m "Guessed MIME type %s for file %s" (Mime.to_string guessed) path);
3838+ guessed
3939+ ) in
5240 Log.debug (fun m -> m "Creating file body from %s with MIME type %s"
5353- (Eio.Path.native_exn file) (Mime.to_string mime));
4141+ path (Mime.to_string mime));
5442 File { file; mime }
55435644let json_encoding_error e =
+4-2
lib/body.mli
···5858 it will be used for the Content-Length header, otherwise chunked encoding is used. *)
59596060val of_file : ?mime:Mime.t -> _ Eio.Path.t -> t
6161-(** [of_file ?mime path] creates a body from a file. The MIME type is inferred from
6262- the file extension if not provided. *)
6161+(** [of_file ?mime path] creates a body from a file. If [mime] is not provided,
6262+ the MIME type is automatically detected from the file extension using the
6363+ {{:https://github.com/mirage/ocaml-magic-mime}magic-mime} library,
6464+ which provides accurate MIME type mappings for hundreds of file extensions. *)
63656466(** {1 Convenience Constructors} *)
6567
+6-24
lib/cache_control.ml
···283283 2. max-age
284284 3. Expires - Date
285285 4. Heuristic (we return None, let caller decide) *)
286286+ let ( let* ) = Option.bind in
286287 match response_cc.max_age with
287288 | Some age -> Some age
288289 | None ->
289290 match expires, date with
290291 | Some exp_str, Some date_str ->
291291- (* Parse HTTP dates *)
292292- let parse_http_date s =
293293- (* Simple HTTP-date parsing - try RFC 1123 format *)
294294- try
295295- (* "Sun, 06 Nov 1994 08:49:37 GMT" *)
296296- Scanf.sscanf s "%_s %d %s %d %d:%d:%d GMT"
297297- (fun day month_str year hour min sec ->
298298- let month = match String.lowercase_ascii month_str with
299299- | "jan" -> 1 | "feb" -> 2 | "mar" -> 3 | "apr" -> 4
300300- | "may" -> 5 | "jun" -> 6 | "jul" -> 7 | "aug" -> 8
301301- | "sep" -> 9 | "oct" -> 10 | "nov" -> 11 | "dec" -> 12
302302- | _ -> failwith "invalid month"
303303- in
304304- match Ptime.of_date_time ((year, month, day), ((hour, min, sec), 0)) with
305305- | Some t -> t
306306- | None -> failwith "invalid date")
307307- with _ -> failwith "parse failed"
308308- in
309309- (try
310310- let exp_time = parse_http_date exp_str in
311311- let date_time = parse_http_date date_str in
312312- let diff = Ptime.diff exp_time date_time in
313313- Ptime.Span.to_int_s diff
314314- with _ -> None)
292292+ (* Use Http_date.parse to parse HTTP dates *)
293293+ let* exp_time = Http_date.parse exp_str in
294294+ let* date_time = Http_date.parse date_str in
295295+ let diff = Ptime.diff exp_time date_time in
296296+ Ptime.Span.to_int_s diff
315297 | _ -> None
316298317299(** Check if a response is cacheable based on Cache-Control directives *)
···43434444let header name t = Headers.get name t.headers
45454646+(** Option monad operators for cleaner code *)
4747+let ( let* ) = Option.bind
4848+let ( let+ ) x f = Option.map f x
4949+4650let content_type t =
4747- Headers.get "content-type" t.headers
4848- |> Option.map Mime.of_string
5151+ let+ ct = Headers.get "content-type" t.headers in
5252+ Mime.of_string ct
49535054let content_length t =
5151- match Headers.get "content-length" t.headers with
5252- | None -> None
5353- | Some len ->
5454- try Some (Int64.of_string len)
5555- with _ -> None
5555+ let* len = Headers.get "content-length" t.headers in
5656+ try Some (Int64.of_string len) with _ -> None
56575758let location t = Headers.get "location" t.headers
5859···65666667let last_modified t = Headers.get "last-modified" t.headers
67686868-(** Parse HTTP-date (RFC 9110 Section 5.6.7) to Ptime.t *)
6969-let parse_http_date s =
7070- (* HTTP-date format: "Sun, 06 Nov 1994 08:49:37 GMT" (RFC 1123) *)
7171- (* Also supports obsolete formats per RFC 9110 *)
7272- let s = String.trim s in
7373- try
7474- (* Try RFC 1123 format: "Sun, 06 Nov 1994 08:49:37 GMT" *)
7575- Scanf.sscanf s "%_s %d %s %d %d:%d:%d GMT"
7676- (fun day month_str year hour min sec ->
7777- let month = match String.lowercase_ascii month_str with
7878- | "jan" -> 1 | "feb" -> 2 | "mar" -> 3 | "apr" -> 4
7979- | "may" -> 5 | "jun" -> 6 | "jul" -> 7 | "aug" -> 8
8080- | "sep" -> 9 | "oct" -> 10 | "nov" -> 11 | "dec" -> 12
8181- | _ -> failwith "invalid month"
8282- in
8383- Ptime.of_date_time ((year, month, day), ((hour, min, sec), 0)))
8484- with _ ->
8585- try
8686- (* Try RFC 850 format: "Sunday, 06-Nov-94 08:49:37 GMT" *)
8787- Scanf.sscanf s "%_s %d-%s@-%d %d:%d:%d GMT"
8888- (fun day month_str year2 hour min sec ->
8989- let year = if year2 >= 70 then 1900 + year2 else 2000 + year2 in
9090- let month = match String.lowercase_ascii month_str with
9191- | "jan" -> 1 | "feb" -> 2 | "mar" -> 3 | "apr" -> 4
9292- | "may" -> 5 | "jun" -> 6 | "jul" -> 7 | "aug" -> 8
9393- | "sep" -> 9 | "oct" -> 10 | "nov" -> 11 | "dec" -> 12
9494- | _ -> failwith "invalid month"
9595- in
9696- Ptime.of_date_time ((year, month, day), ((hour, min, sec), 0)))
9797- with _ ->
9898- (* Try ANSI C asctime() format: "Sun Nov 6 08:49:37 1994" *)
9999- try
100100- Scanf.sscanf s "%_s %s %d %d:%d:%d %d"
101101- (fun month_str day hour min sec year ->
102102- let month = match String.lowercase_ascii month_str with
103103- | "jan" -> 1 | "feb" -> 2 | "mar" -> 3 | "apr" -> 4
104104- | "may" -> 5 | "jun" -> 6 | "jul" -> 7 | "aug" -> 8
105105- | "sep" -> 9 | "oct" -> 10 | "nov" -> 11 | "dec" -> 12
106106- | _ -> failwith "invalid month"
107107- in
108108- Ptime.of_date_time ((year, month, day), ((hour, min, sec), 0)))
109109- with _ -> None
6969+let parse_http_date = Http_date.parse
1107011171let last_modified_ptime t =
112112- Option.bind (last_modified t) parse_http_date
7272+ let* lm = last_modified t in
7373+ Http_date.parse lm
1137411475let date t = Headers.get "date" t.headers
1157611677let date_ptime t =
117117- Option.bind (date t) parse_http_date
7878+ let* d = date t in
7979+ Http_date.parse d
1188011981let expires t = Headers.get "expires" t.headers
1208212183let expires_ptime t =
122122- Option.bind (expires t) parse_http_date
8484+ let* exp = expires t in
8585+ Http_date.parse exp
1238612487let age t =
125125- match Headers.get "age" t.headers with
126126- | Some s -> (try Some (int_of_string s) with _ -> None)
127127- | None -> None
8888+ let* s = Headers.get "age" t.headers in
8989+ try Some (int_of_string s) with _ -> None
1289012991(** {1 Cache-Control Parsing}
13092
+7
lib/response.mli
···9595(** [last_modified response] returns the Last-Modified header as a raw string.
9696 Format: HTTP-date (e.g., ["Sun, 06 Nov 1994 08:49:37 GMT"]) *)
97979898+val parse_http_date : string -> Ptime.t option
9999+(** [parse_http_date s] parses an HTTP-date string (RFC 9110 Section 5.6.7) to Ptime.t.
100100+ Supports RFC 1123, RFC 850, and ANSI C asctime() formats.
101101+ Returns [None] if parsing fails.
102102+103103+ This is exposed for use by other modules that need to parse HTTP dates. *)
104104+98105val last_modified_ptime : t -> Ptime.t option
99106(** [last_modified_ptime response] parses the Last-Modified header as a Ptime.t.
100107 Returns [None] if the header is not present or cannot be parsed. *)
···11+22+<!DOCTYPE html>
33+44+55+66+77+88+99+1010+<html data-bs-theme="auto" lang="en">
1111+ <head>
1212+1313+ <meta charset="utf-8">
1414+ <meta http-equiv="X-UA-Compatible" content="IE=edge">
1515+ <title>
1616+1717+ RFC 1950 - ZLIB Compressed Data Format Specification version 3.3
1818+1919+ </title>
2020+ <meta name="viewport" content="width=device-width, initial-scale=1">
2121+ <link href="https://static.ietf.org/fonts/inter/import.css" rel="stylesheet">
2222+ <link href="https://static.ietf.org/fonts/noto-sans-mono/import.css" rel="stylesheet">
2323+2424+ <link rel="stylesheet" href="https://static.ietf.org/dt/12.54.0/ietf/css/document_html_referenced.css">
2525+2626+ <script type="module" crossorigin="" src="https://static.ietf.org/dt/12.54.0/assets/embedded-055c333d.js"></script>
2727+<link href="https://static.ietf.org/dt/12.54.0/assets/create-pinia-singleton-8312c5df.js" type="text/javascript" crossorigin="anonymous" rel="modulepreload" as="script" />
2828+<link href="https://static.ietf.org/dt/12.54.0/assets/Scrollbar-ad8c5330.js" type="text/javascript" crossorigin="anonymous" rel="modulepreload" as="script" />
2929+ <script src="https://static.ietf.org/dt/12.54.0/ietf/js/document_html.js"></script>
3030+ <script src="https://static.ietf.org/dt/12.54.0/ietf/js/theme.js"></script>
3131+3232+ <link rel="alternate" type="application/atom+xml" title="Document changes" href="/feed/document-changes/rfc1950/">
3333+ <meta name="description"
3434+3535+ content="ZLIB Compressed Data Format Specification version 3.3 (RFC 1950, )"
3636+ >
3737+3838+3939+<link rel="apple-touch-icon"
4040+ sizes="180x180"
4141+ href="https://static.ietf.org/dt/12.54.0/ietf/images/ietf-logo-nor-180.png">
4242+<link rel="icon"
4343+ sizes="32x32"
4444+ href="https://static.ietf.org/dt/12.54.0/ietf/images/ietf-logo-nor-32.png">
4545+<link rel="icon"
4646+ sizes="16x16"
4747+ href="https://static.ietf.org/dt/12.54.0/ietf/images/ietf-logo-nor-16.png">
4848+<link rel="manifest" href="/site.webmanifest">
4949+<link rel="mask-icon"
5050+ href="https://static.ietf.org/dt/12.54.0/ietf/images/ietf-logo-nor-mask.svg"
5151+ color="#ffffff">
5252+<meta name="msapplication-TileColor"
5353+ content="#ffffff">
5454+<meta name="theme-color"
5555+ content="#ffffff">
5656+5757+5858+5959+6060+6161+<meta property="og:title" content="RFC 1950: ZLIB Compressed Data Format Specification version 3.3">
6262+<meta property="og:url" content="https://datatracker.ietf.org/doc/html/rfc1950.txt">
6363+<link rel="canonical" href="https://datatracker.ietf.org/doc/html/rfc1950.txt">
6464+<meta property="og:site_name" content="IETF Datatracker">
6565+<meta property="og:description" content="This specification defines a lossless compressed data format. This memo provides information for the Internet community. This memo does not specify an Internet standard of any kind.">
6666+<meta property="og:type" content="article">
6767+6868+<meta property="article:section" content="Individual Internet-Draft">
6969+7070+<meta property="article:author" content="L. Peter Deutsch">
7171+<meta property="article:author" content="Jean-loup Gailly">
7272+7373+7474+7575+7676+ <style>
7777+7878+ .diff-form .select2-selection__rendered {
7979+ direction: rtl;
8080+ text-align: left;
8181+ }
8282+ </style>
8383+ </head>
8484+ <body>
8585+8686+ <noscript><iframe class="status" title="Site status" src="/status/latest"></iframe></noscript>
8787+<div class="vue-embed" data-component="Status"></div>
8888+ <div class="btn-toolbar sidebar-toolbar position-fixed top-0 end-0 m-2 m-lg-3 d-print-none">
8989+ <div class="dropdown">
9090+ <button class="btn btn-outline-secondary btn-sm me-1 dropdown-toggle d-flex align-items-center"
9191+ id="bd-theme" type="button" aria-expanded="false" data-bs-toggle="dropdown"
9292+ aria-label="Toggle theme">
9393+ <i class="theme-icon-active bi bi-circle-half"></i>
9494+ </button>
9595+9696+ <ul class="dropdown-menu" aria-labelledby="bd-theme">
9797+ <li>
9898+ <button type="button" class="dropdown-item d-flex align-items-center"
9999+ data-bs-theme-value="light" aria-pressed="false">
100100+ <i class="me-2 opacity-50 theme-icon bi bi-sun-fill"></i>
101101+ Light<i class="bi bi-check2 ms-auto d-none"></i>
102102+ </button>
103103+ </li>
104104+ <li>
105105+ <button type="button" class="dropdown-item d-flex align-items-center"
106106+ data-bs-theme-value="dark" aria-pressed="false">
107107+ <i class="me-2 opacity-50 theme-icon bi bi-moon-stars-fill"></i>
108108+ Dark<i class="bi bi-check2 ms-auto d-none"></i>
109109+ </button>
110110+ </li>
111111+ <li>
112112+ <button type="button" class="dropdown-item d-flex align-items-center active"
113113+ data-bs-theme-value="auto" aria-pressed="true">
114114+ <i class="me-2 opacity-50 theme-icon bi bi-circle-half"></i>
115115+ Auto<i class="bi bi-check2 ms-auto d-none"></i>
116116+ </button>
117117+ </li>
118118+ </ul>
119119+ </div>
120120+ <button class="btn btn-outline-secondary btn-sm sidebar-toggle"
121121+ type="button"
122122+ data-bs-toggle="collapse"
123123+ data-bs-target="#sidebar"
124124+ aria-expanded="true"
125125+ aria-controls="sidebar"
126126+ aria-label="Toggle metadata sidebar"
127127+ title="Toggle metadata sidebar">
128128+ <i class="bi bi-arrow-bar-left sidebar-shown"></i>
129129+ <i class="bi bi-arrow-bar-right sidebar-collapsed"></i>
130130+ </button>
131131+ </div>
132132+ <nav class="navbar bg-light-subtle px-1 fixed-top d-print-none d-md-none">
133133+ <a class="nav-link ps-1"
134134+ href="/doc/rfc1950/">
135135+136136+ RFC 1950
137137+138138+ <br class="d-sm-none">
139139+140140+ <span class="ms-sm-3 badge rounded-pill badge-inf">
141141+142142+ Informational
143143+144144+ </span>
145145+ </a>
146146+ <button class="navbar-toggler p-1"
147147+ type="button"
148148+ data-bs-toggle="collapse"
149149+ data-bs-target="#docinfo-collapse"
150150+ aria-controls="docinfo-collapse"
151151+ aria-expanded="false"
152152+ aria-label="Show document information">
153153+ <span class="navbar-toggler-icon small"></span>
154154+ </button>
155155+ <div class="navbar-nav navbar-nav-scroll overscroll-none collapse pt-1" id="docinfo-collapse">
156156+ <div class="bg-light-subtle p-0">
157157+ <table class="table table-sm table-borderless small">
158158+ <tbody class="meta align-top">
159159+ <tr>
160160+ <th scope="row"></th>
161161+ <th scope="row">Title</th>
162162+ <td class="edit"></td>
163163+ <td>ZLIB Compressed Data Format Specification version 3.3</td>
164164+ </tr>
165165+ </tbody>
166166+167167+168168+169169+170170+171171+172172+173173+174174+<tbody class="meta align-top ">
175175+ <tr>
176176+ <th scope="row">Document</th>
177177+ <th scope="row">Document type</th>
178178+ <td class="edit"></td>
179179+ <td>
180180+181181+182182+183183+184184+185185+186186+<span class="text-success">RFC
187187+188188+ - Informational
189189+190190+</span>
191191+192192+193193+194194+ <br>May 1996
195195+196196+ <br>
197197+198198+199199+ <a class="btn btn-sm btn-warning"
200200+ title="Click to report an error in the document."
201201+ href="https://www.rfc-editor.org/errata.php#reportnew"
202202+ target="_blank">
203203+ Report errata
204204+ </a>
205205+206206+207207+208208+209209+210210+211211+212212+213213+214214+ <div>
215215+ Was
216216+ <a href="/doc/draft-deutsch-zlib-spec/03/">draft-deutsch-zlib-spec</a>
217217+ (individual)
218218+ </div>
219219+220220+221221+222222+223223+224224+225225+226226+227227+228228+229229+ <div class="alert alert-warning small p-2 mt-2" role="alert">
230230+ This RFC is labeled as "Legacy"; it was published before a formal source was recorded.
231231+ This RFC is <strong>not endorsed by the IETF</strong> and has <strong>no formal standing</strong> in the
232232+ <a href="/doc/rfc2026/">IETF standards process</a>.
233233+ </div>
234234+235235+236236+237237+238238+ </td>
239239+ </tr>
240240+241241+ <tr>
242242+ <td></td>
243243+ <th scope="row">Select version</th>
244244+ <td class="edit"></td>
245245+ <td>
246246+247247+248248+249249+250250+ <ul class="revision-list pagination pagination-sm text-center flex-wrap my-0">
251251+252252+253253+254254+255255+ <li class="page-item">
256256+ <a class="page-link"
257257+ href="/doc/html/draft-deutsch-zlib-spec-03"
258258+ rel="nofollow">
259259+ 03
260260+ </a>
261261+ </li>
262262+263263+264264+265265+ <li class="page-item rfc active">
266266+ <a class="page-link"
267267+ href="/doc/html/rfc1950">
268268+ RFC 1950
269269+ </a>
270270+ </li>
271271+272272+ </ul>
273273+274274+ </td>
275275+ </tr>
276276+277277+ <tr>
278278+ <td></td>
279279+ <th scope="row">Compare versions</th>
280280+ <td class="edit"></td>
281281+ <td>
282282+283283+284284+285285+286286+<form class="form-horizontal diff-form"
287287+ action="https://author-tools.ietf.org/iddiff"
288288+ method="get"
289289+ target="_blank">
290290+291291+ <select class="form-select form-select-sm mb-1 select2-field"
292292+ data-max-entries="1"
293293+ data-width="resolve"
294294+ data-allow-clear="false"
295295+ data-minimum-input-length="0"
296296+ aria-label="From revision"
297297+ name="url1">
298298+299299+ <option value="rfc1950">
300300+ RFC 1950
301301+302302+ </option>
303303+304304+ <option value="draft-deutsch-zlib-spec-03" selected>
305305+ draft-deutsch-zlib-spec-03
306306+307307+ </option>
308308+309309+ <option value="draft-deutsch-zlib-spec-02">
310310+ draft-deutsch-zlib-spec-02
311311+312312+ </option>
313313+314314+ <option value="draft-deutsch-zlib-spec-01">
315315+ draft-deutsch-zlib-spec-01
316316+317317+ </option>
318318+319319+ <option value="draft-deutsch-zlib-spec-00">
320320+ draft-deutsch-zlib-spec-00
321321+322322+ </option>
323323+324324+325325+ </select>
326326+327327+ <select class="form-select form-select-sm mb-1 select2-field"
328328+ data-max-entries="1"
329329+ data-width="resolve"
330330+ data-allow-clear="false"
331331+ data-minimum-input-length="0"
332332+ aria-label="To revision"
333333+ name="url2">
334334+335335+ <option value="rfc1950" selected>
336336+ RFC 1950
337337+338338+ </option>
339339+340340+ <option value="draft-deutsch-zlib-spec-03">
341341+ draft-deutsch-zlib-spec-03
342342+343343+ </option>
344344+345345+ <option value="draft-deutsch-zlib-spec-02">
346346+ draft-deutsch-zlib-spec-02
347347+348348+ </option>
349349+350350+ <option value="draft-deutsch-zlib-spec-01">
351351+ draft-deutsch-zlib-spec-01
352352+353353+ </option>
354354+355355+ <option value="draft-deutsch-zlib-spec-00">
356356+ draft-deutsch-zlib-spec-00
357357+358358+ </option>
359359+360360+361361+ </select>
362362+363363+ <button type="submit"
364364+ class="btn btn-primary btn-sm"
365365+ value="--html"
366366+ name="difftype">
367367+ Side-by-side
368368+ </button>
369369+370370+ <button type="submit"
371371+ class="btn btn-primary btn-sm"
372372+ value="--hwdiff"
373373+ name="difftype">
374374+ Inline
375375+ </button>
376376+377377+</form>
378378+ </td>
379379+ </tr>
380380+381381+382382+ <tr>
383383+ <td></td>
384384+ <th scope="row">Authors</th>
385385+ <td class="edit">
386386+387387+ </td>
388388+ <td>
389389+390390+391391+ <span ><a
392392+ title="Datatracker profile of L. Peter Deutsch"
393393+ href="/person/ghost@aladdin.com" >L. Peter Deutsch</a> <a
394394+ href="mailto:ghost%40aladdin.com"
395395+ aria-label="Compose email to ghost@aladdin.com"
396396+ title="Compose email to ghost@aladdin.com">
397397+ <i class="bi bi-envelope"></i></a></span>,
398398+399399+ <span ><a
400400+ title="Datatracker profile of Jean-loup Gailly"
401401+ href="/person/gzip@prep.ai.mit.edu" >Jean-loup Gailly</a> <a
402402+ href="mailto:gzip%40prep.ai.mit.edu"
403403+ aria-label="Compose email to gzip@prep.ai.mit.edu"
404404+ title="Compose email to gzip@prep.ai.mit.edu">
405405+ <i class="bi bi-envelope"></i></a></span>
406406+407407+408408+ <br>
409409+ <a class="btn btn-primary btn-sm mt-1" href="mailto:rfc1950@ietf.org?subject=rfc1950" title="Send email to the document authors">Email authors</a>
410410+411411+ </td>
412412+ </tr>
413413+414414+415415+ <tr>
416416+ <td></td>
417417+ <th scope="row">
418418+ RFC stream
419419+ </th>
420420+ <td class="edit">
421421+422422+ </td>
423423+ <td >
424424+425425+426426+427427+428428+ Legacy
429429+430430+431431+432432+433433+ </td>
434434+ </tr>
435435+436436+ <tr>
437437+ <td></td>
438438+ <th scope="row">
439439+ Other formats
440440+ </th>
441441+ <td class="edit">
442442+ </td>
443443+ <td>
444444+445445+446446+ <div class="buttonlist">
447447+448448+449449+ <a class="btn btn-primary btn-sm"
450450+451451+ target="_blank"
452452+ href="https://www.rfc-editor.org/rfc/rfc1950.txt">
453453+454454+ <i class="bi bi-file-text"></i> txt
455455+456456+ </a>
457457+458458+459459+460460+ <a class="btn btn-primary btn-sm"
461461+462462+ target="_blank"
463463+ href="https://www.rfc-editor.org/rfc/rfc1950.html">
464464+465465+ <i class="bi bi-file-code"></i> html
466466+467467+ </a>
468468+469469+470470+471471+ <a class="btn btn-primary btn-sm"
472472+473473+ download="rfc1950.pdf"
474474+475475+476476+ target="_blank"
477477+ href="https://www.rfc-editor.org/rfc/rfc1950.pdf">
478478+479479+ <i class="bi bi-file-pdf"></i> pdf
480480+481481+ </a>
482482+483483+484484+485485+486486+487487+ <a class="btn btn-primary btn-sm"
488488+489489+ target="_blank"
490490+ href="/doc/rfc1950/bibtex/">
491491+492492+ <i class="bi bi-file-ruled"></i> bibtex
493493+494494+ </a>
495495+496496+497497+</div>
498498+499499+500500+ </td>
501501+ </tr>
502502+503503+504504+505505+506506+</tbody>
507507+ <tr>
508508+ <th scope="row"></th>
509509+ <th scope="row"></th>
510510+ <td class="edit"></td>
511511+ <td>
512512+ <a class="btn btn-sm btn-warning mb-3"
513513+ target="_blank"
514514+ href="https://github.com/ietf-tools/datatracker/issues/new/choose">
515515+ Report a bug
516516+ <i class="bi bi-bug"></i>
517517+ </a>
518518+ </td>
519519+ </tr>
520520+ </table>
521521+ </div>
522522+ </div>
523523+ </nav>
524524+ <div class="row g-0">
525525+ <div class="col-md-9 d-flex justify-content-center lh-sm"
526526+ data-bs-spy="scroll"
527527+ data-bs-target="#toc-nav"
528528+ data-bs-smooth-scroll="true"
529529+ tabindex="0"
530530+ id="content">
531531+532532+ <div class="rfcmarkup">
533533+ <br class="noprint">
534534+ <!-- [html-validate-disable-block attr-quotes, void-style, element-permitted-content, heading-level -- FIXME: rfcmarkup/rfc2html generates HTML with issues] -->
535535+ <div class="rfcmarkup"><pre>Network Working Group P. Deutsch
536536+Request for Comments: 1950 Aladdin Enterprises
537537+Category: Informational J-L. Gailly
538538+ Info-ZIP
539539+ May 1996
540540+541541+542542+ <span class="h1">ZLIB Compressed Data Format Specification version 3.3</span>
543543+544544+Status of This Memo
545545+546546+ This memo provides information for the Internet community. This memo
547547+ does not specify an Internet standard of any kind. Distribution of
548548+ this memo is unlimited.
549549+550550+IESG Note:
551551+552552+ The IESG takes no position on the validity of any Intellectual
553553+ Property Rights statements contained in this document.
554554+555555+Notices
556556+557557+ Copyright (c) 1996 L. Peter Deutsch and Jean-Loup Gailly
558558+559559+ Permission is granted to copy and distribute this document for any
560560+ purpose and without charge, including translations into other
561561+ languages and incorporation into compilations, provided that the
562562+ copyright notice and this notice are preserved, and that any
563563+ substantive changes or deletions from the original are clearly
564564+ marked.
565565+566566+ A pointer to the latest version of this and related documentation in
567567+ HTML format can be found at the URL
568568+ <<a href="ftp://ftp.uu.net/graphics/png/documents/zlib/zdoc-index.html">ftp://ftp.uu.net/graphics/png/documents/zlib/zdoc-index.html</a>>.
569569+570570+Abstract
571571+572572+ This specification defines a lossless compressed data format. The
573573+ data can be produced or consumed, even for an arbitrarily long
574574+ sequentially presented input data stream, using only an a priori
575575+ bounded amount of intermediate storage. The format presently uses
576576+ the DEFLATE compression method but can be easily extended to use
577577+ other compression methods. It can be implemented readily in a manner
578578+ not covered by patents. This specification also defines the ADLER-32
579579+ checksum (an extension and improvement of the Fletcher checksum),
580580+ used for detection of data corruption, and provides an algorithm for
581581+ computing it.
582582+583583+584584+585585+586586+<span class="grey">Deutsch & Gailly Informational [Page 1]</span></pre>
587587+<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-2" ></span>
588588+<span class="grey"><a href="/doc/html/rfc1950">RFC 1950</a> ZLIB Compressed Data Format Specification May 1996</span>
589589+590590+591591+Table of Contents
592592+593593+ <a href="#section-1">1</a>. Introduction ................................................... <a href="#page-2">2</a>
594594+ <a href="#section-1.1">1.1</a>. Purpose ................................................... <a href="#page-2">2</a>
595595+ <a href="#section-1.2">1.2</a>. Intended audience ......................................... <a href="#page-3">3</a>
596596+ <a href="#section-1.3">1.3</a>. Scope ..................................................... <a href="#page-3">3</a>
597597+ <a href="#section-1.4">1.4</a>. Compliance ................................................ <a href="#page-3">3</a>
598598+ <a href="#section-1.5">1.5</a>. Definitions of terms and conventions used ................ <a href="#page-3">3</a>
599599+ <a href="#section-1.6">1.6</a>. Changes from previous versions ............................ <a href="#page-3">3</a>
600600+ <a href="#section-2">2</a>. Detailed specification ......................................... <a href="#page-3">3</a>
601601+ <a href="#section-2.1">2.1</a>. Overall conventions ....................................... <a href="#page-3">3</a>
602602+ <a href="#section-2.2">2.2</a>. Data format ............................................... <a href="#page-4">4</a>
603603+ <a href="#section-2.3">2.3</a>. Compliance ................................................ <a href="#page-7">7</a>
604604+ <a href="#section-3">3</a>. References ..................................................... <a href="#page-7">7</a>
605605+ <a href="#section-4">4</a>. Source code .................................................... <a href="#page-8">8</a>
606606+ <a href="#section-5">5</a>. Security Considerations ........................................ <a href="#page-8">8</a>
607607+ <a href="#section-6">6</a>. Acknowledgements ............................................... <a href="#page-8">8</a>
608608+ <a href="#section-7">7</a>. Authors' Addresses ............................................. <a href="#page-8">8</a>
609609+ <a href="#section-8">8</a>. Appendix: Rationale ............................................ <a href="#page-9">9</a>
610610+ <a href="#section-9">9</a>. Appendix: Sample code ..........................................<a href="#page-10">10</a>
611611+612612+<span class="h2"><a class="selflink" id="section-1" href="#section-1">1</a>. Introduction</span>
613613+614614+ 1.1. Purpose
615615+616616+ The purpose of this specification is to define a lossless
617617+ compressed data format that:
618618+619619+ * Is independent of CPU type, operating system, file system,
620620+ and character set, and hence can be used for interchange;
621621+622622+ * Can be produced or consumed, even for an arbitrarily long
623623+ sequentially presented input data stream, using only an a
624624+ priori bounded amount of intermediate storage, and hence can
625625+ be used in data communications or similar structures such as
626626+ Unix filters;
627627+628628+ * Can use a number of different compression methods;
629629+630630+ * Can be implemented readily in a manner not covered by
631631+ patents, and hence can be practiced freely.
632632+633633+ The data format defined by this specification does not attempt to
634634+ allow random access to compressed data.
635635+636636+637637+638638+639639+640640+641641+642642+<span class="grey">Deutsch & Gailly Informational [Page 2]</span></pre>
643643+<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-3" ></span>
644644+<span class="grey"><a href="/doc/html/rfc1950">RFC 1950</a> ZLIB Compressed Data Format Specification May 1996</span>
645645+646646+647647+ 1.2. Intended audience
648648+649649+ This specification is intended for use by implementors of software
650650+ to compress data into zlib format and/or decompress data from zlib
651651+ format.
652652+653653+ The text of the specification assumes a basic background in
654654+ programming at the level of bits and other primitive data
655655+ representations.
656656+657657+ 1.3. Scope
658658+659659+ The specification specifies a compressed data format that can be
660660+ used for in-memory compression of a sequence of arbitrary bytes.
661661+662662+ 1.4. Compliance
663663+664664+ Unless otherwise indicated below, a compliant decompressor must be
665665+ able to accept and decompress any data set that conforms to all
666666+ the specifications presented here; a compliant compressor must
667667+ produce data sets that conform to all the specifications presented
668668+ here.
669669+670670+ 1.5. Definitions of terms and conventions used
671671+672672+ byte: 8 bits stored or transmitted as a unit (same as an octet).
673673+ (For this specification, a byte is exactly 8 bits, even on
674674+ machines which store a character on a number of bits different
675675+ from 8.) See below, for the numbering of bits within a byte.
676676+677677+ 1.6. Changes from previous versions
678678+679679+ Version 3.1 was the first public release of this specification.
680680+ In version 3.2, some terminology was changed and the Adler-32
681681+ sample code was rewritten for clarity. In version 3.3, the
682682+ support for a preset dictionary was introduced, and the
683683+ specification was converted to RFC style.
684684+685685+<span class="h2"><a class="selflink" id="section-2" href="#section-2">2</a>. Detailed specification</span>
686686+687687+ 2.1. Overall conventions
688688+689689+ In the diagrams below, a box like this:
690690+691691+ +---+
692692+ | | <-- the vertical bars might be missing
693693+ +---+
694694+695695+696696+697697+698698+<span class="grey">Deutsch & Gailly Informational [Page 3]</span></pre>
699699+<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-4" ></span>
700700+<span class="grey"><a href="/doc/html/rfc1950">RFC 1950</a> ZLIB Compressed Data Format Specification May 1996</span>
701701+702702+703703+ represents one byte; a box like this:
704704+705705+ +==============+
706706+ | |
707707+ +==============+
708708+709709+ represents a variable number of bytes.
710710+711711+ Bytes stored within a computer do not have a "bit order", since
712712+ they are always treated as a unit. However, a byte considered as
713713+ an integer between 0 and 255 does have a most- and least-
714714+ significant bit, and since we write numbers with the most-
715715+ significant digit on the left, we also write bytes with the most-
716716+ significant bit on the left. In the diagrams below, we number the
717717+ bits of a byte so that bit 0 is the least-significant bit, i.e.,
718718+ the bits are numbered:
719719+720720+ +--------+
721721+ |76543210|
722722+ +--------+
723723+724724+ Within a computer, a number may occupy multiple bytes. All
725725+ multi-byte numbers in the format described here are stored with
726726+ the MOST-significant byte first (at the lower memory address).
727727+ For example, the decimal number 520 is stored as:
728728+729729+ 0 1
730730+ +--------+--------+
731731+ |00000010|00001000|
732732+ +--------+--------+
733733+ ^ ^
734734+ | |
735735+ | + less significant byte = 8
736736+ + more significant byte = 2 x 256
737737+738738+ 2.2. Data format
739739+740740+ A zlib stream has the following structure:
741741+742742+ 0 1
743743+ +---+---+
744744+ |CMF|FLG| (more-->)
745745+ +---+---+
746746+747747+748748+749749+750750+751751+752752+753753+754754+<span class="grey">Deutsch & Gailly Informational [Page 4]</span></pre>
755755+<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-5" ></span>
756756+<span class="grey"><a href="/doc/html/rfc1950">RFC 1950</a> ZLIB Compressed Data Format Specification May 1996</span>
757757+758758+759759+ (if FLG.FDICT set)
760760+761761+ 0 1 2 3
762762+ +---+---+---+---+
763763+ | DICTID | (more-->)
764764+ +---+---+---+---+
765765+766766+ +=====================+---+---+---+---+
767767+ |...compressed data...| ADLER32 |
768768+ +=====================+---+---+---+---+
769769+770770+ Any data which may appear after ADLER32 are not part of the zlib
771771+ stream.
772772+773773+ CMF (Compression Method and flags)
774774+ This byte is divided into a 4-bit compression method and a 4-
775775+ bit information field depending on the compression method.
776776+777777+ bits 0 to 3 CM Compression method
778778+ bits 4 to 7 CINFO Compression info
779779+780780+ CM (Compression method)
781781+ This identifies the compression method used in the file. CM = 8
782782+ denotes the "deflate" compression method with a window size up
783783+ to 32K. This is the method used by gzip and PNG (see
784784+ references [<a href="#ref-1" title=""GZIP Compressed Data Format Specification"">1</a>] and [<a href="#ref-2" title=""PNG (Portable Network Graphics) specification"">2</a>] in Chapter 3, below, for the reference
785785+ documents). CM = 15 is reserved. It might be used in a future
786786+ version of this specification to indicate the presence of an
787787+ extra field before the compressed data.
788788+789789+ CINFO (Compression info)
790790+ For CM = 8, CINFO is the base-2 logarithm of the LZ77 window
791791+ size, minus eight (CINFO=7 indicates a 32K window size). Values
792792+ of CINFO above 7 are not allowed in this version of the
793793+ specification. CINFO is not defined in this specification for
794794+ CM not equal to 8.
795795+796796+ FLG (FLaGs)
797797+ This flag byte is divided as follows:
798798+799799+ bits 0 to 4 FCHECK (check bits for CMF and FLG)
800800+ bit 5 FDICT (preset dictionary)
801801+ bits 6 to 7 FLEVEL (compression level)
802802+803803+ The FCHECK value must be such that CMF and FLG, when viewed as
804804+ a 16-bit unsigned integer stored in MSB order (CMF*256 + FLG),
805805+ is a multiple of 31.
806806+807807+808808+809809+810810+<span class="grey">Deutsch & Gailly Informational [Page 5]</span></pre>
811811+<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-6" ></span>
812812+<span class="grey"><a href="/doc/html/rfc1950">RFC 1950</a> ZLIB Compressed Data Format Specification May 1996</span>
813813+814814+815815+ FDICT (Preset dictionary)
816816+ If FDICT is set, a DICT dictionary identifier is present
817817+ immediately after the FLG byte. The dictionary is a sequence of
818818+ bytes which are initially fed to the compressor without
819819+ producing any compressed output. DICT is the Adler-32 checksum
820820+ of this sequence of bytes (see the definition of ADLER32
821821+ below). The decompressor can use this identifier to determine
822822+ which dictionary has been used by the compressor.
823823+824824+ FLEVEL (Compression level)
825825+ These flags are available for use by specific compression
826826+ methods. The "deflate" method (CM = 8) sets these flags as
827827+ follows:
828828+829829+ 0 - compressor used fastest algorithm
830830+ 1 - compressor used fast algorithm
831831+ 2 - compressor used default algorithm
832832+ 3 - compressor used maximum compression, slowest algorithm
833833+834834+ The information in FLEVEL is not needed for decompression; it
835835+ is there to indicate if recompression might be worthwhile.
836836+837837+ compressed data
838838+ For compression method 8, the compressed data is stored in the
839839+ deflate compressed data format as described in the document
840840+ "DEFLATE Compressed Data Format Specification" by L. Peter
841841+ Deutsch. (See reference [<a href="#ref-3" title=""DEFLATE Compressed Data Format Specification"">3</a>] in Chapter 3, below)
842842+843843+ Other compressed data formats are not specified in this version
844844+ of the zlib specification.
845845+846846+ ADLER32 (Adler-32 checksum)
847847+ This contains a checksum value of the uncompressed data
848848+ (excluding any dictionary data) computed according to Adler-32
849849+ algorithm. This algorithm is a 32-bit extension and improvement
850850+ of the Fletcher algorithm, used in the ITU-T X.224 / ISO 8073
851851+ standard. See references [<a href="#ref-4" title=""An Arithmetic Checksum for Serial Transmissions,"">4</a>] and [<a href="#ref-5" title=""Checksum Algorithms,"">5</a>] in Chapter 3, below)
852852+853853+ Adler-32 is composed of two sums accumulated per byte: s1 is
854854+ the sum of all bytes, s2 is the sum of all s1 values. Both sums
855855+ are done modulo 65521. s1 is initialized to 1, s2 to zero. The
856856+ Adler-32 checksum is stored as s2*65536 + s1 in most-
857857+ significant-byte first (network) order.
858858+859859+860860+861861+862862+863863+864864+865865+866866+<span class="grey">Deutsch & Gailly Informational [Page 6]</span></pre>
867867+<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-7" ></span>
868868+<span class="grey"><a href="/doc/html/rfc1950">RFC 1950</a> ZLIB Compressed Data Format Specification May 1996</span>
869869+870870+871871+ 2.3. Compliance
872872+873873+ A compliant compressor must produce streams with correct CMF, FLG
874874+ and ADLER32, but need not support preset dictionaries. When the
875875+ zlib data format is used as part of another standard data format,
876876+ the compressor may use only preset dictionaries that are specified
877877+ by this other data format. If this other format does not use the
878878+ preset dictionary feature, the compressor must not set the FDICT
879879+ flag.
880880+881881+ A compliant decompressor must check CMF, FLG, and ADLER32, and
882882+ provide an error indication if any of these have incorrect values.
883883+ A compliant decompressor must give an error indication if CM is
884884+ not one of the values defined in this specification (only the
885885+ value 8 is permitted in this version), since another value could
886886+ indicate the presence of new features that would cause subsequent
887887+ data to be interpreted incorrectly. A compliant decompressor must
888888+ give an error indication if FDICT is set and DICTID is not the
889889+ identifier of a known preset dictionary. A decompressor may
890890+ ignore FLEVEL and still be compliant. When the zlib data format
891891+ is being used as a part of another standard format, a compliant
892892+ decompressor must support all the preset dictionaries specified by
893893+ the other format. When the other format does not use the preset
894894+ dictionary feature, a compliant decompressor must reject any
895895+ stream in which the FDICT flag is set.
896896+897897+<span class="h2"><a class="selflink" id="section-3" href="#section-3">3</a>. References</span>
898898+899899+ [<a id="ref-1">1</a>] Deutsch, L.P.,"GZIP Compressed Data Format Specification",
900900+ available in <a href="ftp://ftp.uu.net/pub/archiving/zip/doc/">ftp://ftp.uu.net/pub/archiving/zip/doc/</a>
901901+902902+ [<a id="ref-2">2</a>] Thomas Boutell, "PNG (Portable Network Graphics) specification",
903903+ available in <a href="ftp://ftp.uu.net/graphics/png/documents/">ftp://ftp.uu.net/graphics/png/documents/</a>
904904+905905+ [<a id="ref-3">3</a>] Deutsch, L.P.,"DEFLATE Compressed Data Format Specification",
906906+ available in <a href="ftp://ftp.uu.net/pub/archiving/zip/doc/">ftp://ftp.uu.net/pub/archiving/zip/doc/</a>
907907+908908+ [<a id="ref-4">4</a>] Fletcher, J. G., "An Arithmetic Checksum for Serial
909909+ Transmissions," IEEE Transactions on Communications, Vol. COM-30,
910910+ No. 1, January 1982, pp. 247-252.
911911+912912+ [<a id="ref-5">5</a>] ITU-T Recommendation X.224, Annex D, "Checksum Algorithms,"
913913+ November, 1993, pp. 144, 145. (Available from
914914+ gopher://info.itu.ch). ITU-T X.244 is also the same as ISO 8073.
915915+916916+917917+918918+919919+920920+921921+922922+<span class="grey">Deutsch & Gailly Informational [Page 7]</span></pre>
923923+<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-8" ></span>
924924+<span class="grey"><a href="/doc/html/rfc1950">RFC 1950</a> ZLIB Compressed Data Format Specification May 1996</span>
925925+926926+927927+<span class="h2"><a class="selflink" id="section-4" href="#section-4">4</a>. Source code</span>
928928+929929+ Source code for a C language implementation of a "zlib" compliant
930930+ library is available at <a href="ftp://ftp.uu.net/pub/archiving/zip/zlib/">ftp://ftp.uu.net/pub/archiving/zip/zlib/</a>.
931931+932932+<span class="h2"><a class="selflink" id="section-5" href="#section-5">5</a>. Security Considerations</span>
933933+934934+ A decoder that fails to check the ADLER32 checksum value may be
935935+ subject to undetected data corruption.
936936+937937+<span class="h2"><a class="selflink" id="section-6" href="#section-6">6</a>. Acknowledgements</span>
938938+939939+ Trademarks cited in this document are the property of their
940940+ respective owners.
941941+942942+ Jean-Loup Gailly and Mark Adler designed the zlib format and wrote
943943+ the related software described in this specification. Glenn
944944+ Randers-Pehrson converted this document to RFC and HTML format.
945945+946946+<span class="h2"><a class="selflink" id="section-7" href="#section-7">7</a>. Authors' Addresses</span>
947947+948948+ L. Peter Deutsch
949949+ Aladdin Enterprises
950950+ 203 Santa Margarita Ave.
951951+ Menlo Park, CA 94025
952952+953953+ Phone: (415) 322-0103 (AM only)
954954+ FAX: (415) 322-1734
955955+ EMail: <ghost@aladdin.com>
956956+957957+958958+ Jean-Loup Gailly
959959+960960+ EMail: <gzip@prep.ai.mit.edu>
961961+962962+ Questions about the technical content of this specification can be
963963+ sent by email to
964964+965965+ Jean-Loup Gailly <gzip@prep.ai.mit.edu> and
966966+ Mark Adler <madler@alumni.caltech.edu>
967967+968968+ Editorial comments on this specification can be sent by email to
969969+970970+ L. Peter Deutsch <ghost@aladdin.com> and
971971+ Glenn Randers-Pehrson <randeg@alumni.rpi.edu>
972972+973973+974974+975975+976976+977977+978978+<span class="grey">Deutsch & Gailly Informational [Page 8]</span></pre>
979979+<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-9" ></span>
980980+<span class="grey"><a href="/doc/html/rfc1950">RFC 1950</a> ZLIB Compressed Data Format Specification May 1996</span>
981981+982982+983983+<span class="h2"><a class="selflink" id="section-8" href="#section-8">8</a>. Appendix: Rationale</span>
984984+985985+ 8.1. Preset dictionaries
986986+987987+ A preset dictionary is specially useful to compress short input
988988+ sequences. The compressor can take advantage of the dictionary
989989+ context to encode the input in a more compact manner. The
990990+ decompressor can be initialized with the appropriate context by
991991+ virtually decompressing a compressed version of the dictionary
992992+ without producing any output. However for certain compression
993993+ algorithms such as the deflate algorithm this operation can be
994994+ achieved without actually performing any decompression.
995995+996996+ The compressor and the decompressor must use exactly the same
997997+ dictionary. The dictionary may be fixed or may be chosen among a
998998+ certain number of predefined dictionaries, according to the kind
999999+ of input data. The decompressor can determine which dictionary has
10001000+ been chosen by the compressor by checking the dictionary
10011001+ identifier. This document does not specify the contents of
10021002+ predefined dictionaries, since the optimal dictionaries are
10031003+ application specific. Standard data formats using this feature of
10041004+ the zlib specification must precisely define the allowed
10051005+ dictionaries.
10061006+10071007+ 8.2. The Adler-32 algorithm
10081008+10091009+ The Adler-32 algorithm is much faster than the CRC32 algorithm yet
10101010+ still provides an extremely low probability of undetected errors.
10111011+10121012+ The modulo on unsigned long accumulators can be delayed for 5552
10131013+ bytes, so the modulo operation time is negligible. If the bytes
10141014+ are a, b, c, the second sum is 3a + 2b + c + 3, and so is position
10151015+ and order sensitive, unlike the first sum, which is just a
10161016+ checksum. That 65521 is prime is important to avoid a possible
10171017+ large class of two-byte errors that leave the check unchanged.
10181018+ (The Fletcher checksum uses 255, which is not prime and which also
10191019+ makes the Fletcher check insensitive to single byte changes 0 <->
10201020+ 255.)
10211021+10221022+ The sum s1 is initialized to 1 instead of zero to make the length
10231023+ of the sequence part of s2, so that the length does not have to be
10241024+ checked separately. (Any sequence of zeroes has a Fletcher
10251025+ checksum of zero.)
10261026+10271027+10281028+10291029+10301030+10311031+10321032+10331033+10341034+<span class="grey">Deutsch & Gailly Informational [Page 9]</span></pre>
10351035+<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-10" ></span>
10361036+<span class="grey"><a href="/doc/html/rfc1950">RFC 1950</a> ZLIB Compressed Data Format Specification May 1996</span>
10371037+10381038+10391039+<span class="h2"><a class="selflink" id="section-9" href="#section-9">9</a>. Appendix: Sample code</span>
10401040+10411041+ The following C code computes the Adler-32 checksum of a data buffer.
10421042+ It is written for clarity, not for speed. The sample code is in the
10431043+ ANSI C programming language. Non C users may find it easier to read
10441044+ with these hints:
10451045+10461046+ & Bitwise AND operator.
10471047+ >> Bitwise right shift operator. When applied to an
10481048+ unsigned quantity, as here, right shift inserts zero bit(s)
10491049+ at the left.
10501050+ << Bitwise left shift operator. Left shift inserts zero
10511051+ bit(s) at the right.
10521052+ ++ "n++" increments the variable n.
10531053+ % modulo operator: a % b is the remainder of a divided by b.
10541054+10551055+ #define BASE 65521 /* largest prime smaller than 65536 */
10561056+10571057+ /*
10581058+ Update a running Adler-32 checksum with the bytes buf[0..len-1]
10591059+ and return the updated checksum. The Adler-32 checksum should be
10601060+ initialized to 1.
10611061+10621062+ Usage example:
10631063+10641064+ unsigned long adler = 1L;
10651065+10661066+ while (read_buffer(buffer, length) != EOF) {
10671067+ adler = update_adler32(adler, buffer, length);
10681068+ }
10691069+ if (adler != original_adler) error();
10701070+ */
10711071+ unsigned long update_adler32(unsigned long adler,
10721072+ unsigned char *buf, int len)
10731073+ {
10741074+ unsigned long s1 = adler & 0xffff;
10751075+ unsigned long s2 = (adler >> 16) & 0xffff;
10761076+ int n;
10771077+10781078+ for (n = 0; n < len; n++) {
10791079+ s1 = (s1 + buf[n]) % BASE;
10801080+ s2 = (s2 + s1) % BASE;
10811081+ }
10821082+ return (s2 << 16) + s1;
10831083+ }
10841084+10851085+ /* Return the adler32 of the bytes buf[0..len-1] */
10861086+10871087+10881088+10891089+10901090+<span class="grey">Deutsch & Gailly Informational [Page 10]</span></pre>
10911091+<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-11" ></span>
10921092+<span class="grey"><a href="/doc/html/rfc1950">RFC 1950</a> ZLIB Compressed Data Format Specification May 1996</span>
10931093+10941094+10951095+ unsigned long adler32(unsigned char *buf, int len)
10961096+ {
10971097+ return update_adler32(1L, buf, len);
10981098+ }
10991099+11001100+11011101+11021102+11031103+11041104+11051105+11061106+11071107+11081108+11091109+11101110+11111111+11121112+11131113+11141114+11151115+11161116+11171117+11181118+11191119+11201120+11211121+11221122+11231123+11241124+11251125+11261126+11271127+11281128+11291129+11301130+11311131+11321132+11331133+11341134+11351135+11361136+11371137+11381138+11391139+11401140+11411141+11421142+11431143+11441144+11451145+11461146+Deutsch & Gailly Informational [Page 11]
11471147+</pre></div>
11481148+ </div>
11491149+11501150+ </div>
11511151+ <div class="d-print-none col-md-3 bg-light-subtle collapse show" id="sidebar">
11521152+ <div class="position-fixed border-start sidebar overflow-scroll overscroll-none no-scrollbar">
11531153+ <div class="d-flex flex-column vh-100 pt-2 pt-lg-3 ps-3 pl-md-2 pl-lg-3">
11541154+ <div>
11551155+ <a class="btn btn-primary btn-sm" href="/doc/rfc1950/">Datatracker</a>
11561156+ <p class="fw-bold pt-2">
11571157+11581158+ RFC 1950
11591159+11601160+ <br>
11611161+11621162+11631163+11641164+11651165+11661166+11671167+<span class="text-success">RFC
11681168+11691169+ - Informational
11701170+11711171+</span>
11721172+11731173+ </p>
11741174+ </div>
11751175+11761176+ <ul class="nav nav-tabs nav-fill small me-2" role="tablist">
11771177+ <li class="nav-item" role="presentation" title="Document information">
11781178+ <button class="nav-link px-2"
11791179+ id="docinfo-tab"
11801180+ data-bs-toggle="tab"
11811181+ data-bs-target="#docinfo-tab-pane"
11821182+ type="button"
11831183+ role="tab"
11841184+ aria-controls="docinfo-tab-pane"
11851185+ aria-selected="true">
11861186+ <i class="bi bi-info-circle"></i><span class="d-none d-md-block d-xl-inline ms-xl-1">Info</span>
11871187+ </button>
11881188+ </li>
11891189+ <li class="nav-item" role="presentation" title="Table of contents">
11901190+ <button class="nav-link px-2"
11911191+ id="toc-tab"
11921192+ data-bs-toggle="tab"
11931193+ data-bs-target="#toc-tab-pane"
11941194+ type="button"
11951195+ role="tab"
11961196+ aria-controls="toc-tab-pane"
11971197+ aria-selected="false">
11981198+ <i class="bi bi-list-ol"></i><span class="d-none d-md-block d-xl-inline ms-xl-1">Contents</span>
11991199+ </button>
12001200+ </li>
12011201+ <li class="nav-item" role="presentation" title="Preferences">
12021202+ <button class="nav-link px-2"
12031203+ id="pref-tab"
12041204+ data-bs-toggle="tab"
12051205+ data-bs-target="#pref-tab-pane"
12061206+ type="button"
12071207+ role="tab"
12081208+ aria-controls="pref-tab-pane"
12091209+ aria-selected="false">
12101210+ <i class="bi bi-gear"></i><span class="d-none d-md-block d-xl-inline ms-xl-1">Prefs</span>
12111211+ </button>
12121212+ </li>
12131213+ </ul>
12141214+ <div class="overflow-auto tab-content pt-2 me-2">
12151215+ <div class="tab-pane"
12161216+ id="docinfo-tab-pane"
12171217+ role="tabpanel"
12181218+ aria-labelledby="docinfo-tab"
12191219+ tabindex="0">
12201220+ <table class="table table-sm table-borderless">
12211221+12221222+12231223+12241224+12251225+12261226+12271227+12281228+12291229+<tbody class="meta align-top ">
12301230+ <tr>
12311231+ <th scope="row">Document</th>
12321232+ <th scope="row">Document type</th>
12331233+ <td class="edit"></td>
12341234+ <td>
12351235+12361236+12371237+12381238+12391239+12401240+12411241+<span class="text-success">RFC
12421242+12431243+ - Informational
12441244+12451245+</span>
12461246+12471247+12481248+12491249+ <br>May 1996
12501250+12511251+ <br>
12521252+12531253+12541254+ <a class="btn btn-sm btn-warning"
12551255+ title="Click to report an error in the document."
12561256+ href="https://www.rfc-editor.org/errata.php#reportnew"
12571257+ target="_blank">
12581258+ Report errata
12591259+ </a>
12601260+12611261+12621262+12631263+12641264+12651265+12661266+12671267+12681268+12691269+ <div>
12701270+ Was
12711271+ <a href="/doc/draft-deutsch-zlib-spec/03/">draft-deutsch-zlib-spec</a>
12721272+ (individual)
12731273+ </div>
12741274+12751275+12761276+12771277+12781278+12791279+12801280+12811281+12821282+12831283+12841284+ <div class="alert alert-warning small p-2 mt-2" role="alert">
12851285+ This RFC is labeled as "Legacy"; it was published before a formal source was recorded.
12861286+ This RFC is <strong>not endorsed by the IETF</strong> and has <strong>no formal standing</strong> in the
12871287+ <a href="/doc/rfc2026/">IETF standards process</a>.
12881288+ </div>
12891289+12901290+12911291+12921292+12931293+ </td>
12941294+ </tr>
12951295+12961296+ <tr>
12971297+ <td></td>
12981298+ <th scope="row">Select version</th>
12991299+ <td class="edit"></td>
13001300+ <td>
13011301+13021302+13031303+13041304+13051305+ <ul class="revision-list pagination pagination-sm text-center flex-wrap my-0">
13061306+13071307+13081308+13091309+13101310+ <li class="page-item">
13111311+ <a class="page-link"
13121312+ href="/doc/html/draft-deutsch-zlib-spec-03"
13131313+ rel="nofollow">
13141314+ 03
13151315+ </a>
13161316+ </li>
13171317+13181318+13191319+13201320+ <li class="page-item rfc active">
13211321+ <a class="page-link"
13221322+ href="/doc/html/rfc1950">
13231323+ RFC 1950
13241324+ </a>
13251325+ </li>
13261326+13271327+ </ul>
13281328+13291329+ </td>
13301330+ </tr>
13311331+13321332+ <tr>
13331333+ <td></td>
13341334+ <th scope="row">Compare versions</th>
13351335+ <td class="edit"></td>
13361336+ <td>
13371337+13381338+13391339+13401340+13411341+<form class="form-horizontal diff-form"
13421342+ action="https://author-tools.ietf.org/iddiff"
13431343+ method="get"
13441344+ target="_blank">
13451345+13461346+ <select class="form-select form-select-sm mb-1 select2-field"
13471347+ data-max-entries="1"
13481348+ data-width="resolve"
13491349+ data-allow-clear="false"
13501350+ data-minimum-input-length="0"
13511351+ aria-label="From revision"
13521352+ name="url1">
13531353+13541354+ <option value="rfc1950">
13551355+ RFC 1950
13561356+13571357+ </option>
13581358+13591359+ <option value="draft-deutsch-zlib-spec-03" selected>
13601360+ draft-deutsch-zlib-spec-03
13611361+13621362+ </option>
13631363+13641364+ <option value="draft-deutsch-zlib-spec-02">
13651365+ draft-deutsch-zlib-spec-02
13661366+13671367+ </option>
13681368+13691369+ <option value="draft-deutsch-zlib-spec-01">
13701370+ draft-deutsch-zlib-spec-01
13711371+13721372+ </option>
13731373+13741374+ <option value="draft-deutsch-zlib-spec-00">
13751375+ draft-deutsch-zlib-spec-00
13761376+13771377+ </option>
13781378+13791379+13801380+ </select>
13811381+13821382+ <select class="form-select form-select-sm mb-1 select2-field"
13831383+ data-max-entries="1"
13841384+ data-width="resolve"
13851385+ data-allow-clear="false"
13861386+ data-minimum-input-length="0"
13871387+ aria-label="To revision"
13881388+ name="url2">
13891389+13901390+ <option value="rfc1950" selected>
13911391+ RFC 1950
13921392+13931393+ </option>
13941394+13951395+ <option value="draft-deutsch-zlib-spec-03">
13961396+ draft-deutsch-zlib-spec-03
13971397+13981398+ </option>
13991399+14001400+ <option value="draft-deutsch-zlib-spec-02">
14011401+ draft-deutsch-zlib-spec-02
14021402+14031403+ </option>
14041404+14051405+ <option value="draft-deutsch-zlib-spec-01">
14061406+ draft-deutsch-zlib-spec-01
14071407+14081408+ </option>
14091409+14101410+ <option value="draft-deutsch-zlib-spec-00">
14111411+ draft-deutsch-zlib-spec-00
14121412+14131413+ </option>
14141414+14151415+14161416+ </select>
14171417+14181418+ <button type="submit"
14191419+ class="btn btn-primary btn-sm"
14201420+ value="--html"
14211421+ name="difftype">
14221422+ Side-by-side
14231423+ </button>
14241424+14251425+ <button type="submit"
14261426+ class="btn btn-primary btn-sm"
14271427+ value="--hwdiff"
14281428+ name="difftype">
14291429+ Inline
14301430+ </button>
14311431+14321432+</form>
14331433+ </td>
14341434+ </tr>
14351435+14361436+14371437+ <tr>
14381438+ <td></td>
14391439+ <th scope="row">Authors</th>
14401440+ <td class="edit">
14411441+14421442+ </td>
14431443+ <td>
14441444+14451445+14461446+ <span ><a
14471447+ title="Datatracker profile of L. Peter Deutsch"
14481448+ href="/person/ghost@aladdin.com" >L. Peter Deutsch</a> <a
14491449+ href="mailto:ghost%40aladdin.com"
14501450+ aria-label="Compose email to ghost@aladdin.com"
14511451+ title="Compose email to ghost@aladdin.com">
14521452+ <i class="bi bi-envelope"></i></a></span>,
14531453+14541454+ <span ><a
14551455+ title="Datatracker profile of Jean-loup Gailly"
14561456+ href="/person/gzip@prep.ai.mit.edu" >Jean-loup Gailly</a> <a
14571457+ href="mailto:gzip%40prep.ai.mit.edu"
14581458+ aria-label="Compose email to gzip@prep.ai.mit.edu"
14591459+ title="Compose email to gzip@prep.ai.mit.edu">
14601460+ <i class="bi bi-envelope"></i></a></span>
14611461+14621462+14631463+ <br>
14641464+ <a class="btn btn-primary btn-sm mt-1" href="mailto:rfc1950@ietf.org?subject=rfc1950" title="Send email to the document authors">Email authors</a>
14651465+14661466+ </td>
14671467+ </tr>
14681468+14691469+14701470+ <tr>
14711471+ <td></td>
14721472+ <th scope="row">
14731473+ RFC stream
14741474+ </th>
14751475+ <td class="edit">
14761476+14771477+ </td>
14781478+ <td >
14791479+14801480+14811481+14821482+14831483+ Legacy
14841484+14851485+14861486+14871487+14881488+ </td>
14891489+ </tr>
14901490+14911491+ <tr>
14921492+ <td></td>
14931493+ <th scope="row">
14941494+ Other formats
14951495+ </th>
14961496+ <td class="edit">
14971497+ </td>
14981498+ <td>
14991499+15001500+15011501+ <div class="buttonlist">
15021502+15031503+15041504+ <a class="btn btn-primary btn-sm"
15051505+15061506+ target="_blank"
15071507+ href="https://www.rfc-editor.org/rfc/rfc1950.txt">
15081508+15091509+ <i class="bi bi-file-text"></i> txt
15101510+15111511+ </a>
15121512+15131513+15141514+15151515+ <a class="btn btn-primary btn-sm"
15161516+15171517+ target="_blank"
15181518+ href="https://www.rfc-editor.org/rfc/rfc1950.html">
15191519+15201520+ <i class="bi bi-file-code"></i> html
15211521+15221522+ </a>
15231523+15241524+15251525+15261526+ <a class="btn btn-primary btn-sm"
15271527+15281528+ download="rfc1950.pdf"
15291529+15301530+15311531+ target="_blank"
15321532+ href="https://www.rfc-editor.org/rfc/rfc1950.pdf">
15331533+15341534+ <i class="bi bi-file-pdf"></i> pdf
15351535+15361536+ </a>
15371537+15381538+15391539+15401540+15411541+15421542+ <a class="btn btn-primary btn-sm"
15431543+15441544+ target="_blank"
15451545+ href="/doc/rfc1950/bibtex/">
15461546+15471547+ <i class="bi bi-file-ruled"></i> bibtex
15481548+15491549+ </a>
15501550+15511551+15521552+</div>
15531553+15541554+15551555+ </td>
15561556+ </tr>
15571557+15581558+15591559+15601560+15611561+</tbody>
15621562+ </table>
15631563+ <a class="btn btn-sm btn-warning mb-3"
15641564+ target="_blank"
15651565+ href="https://github.com/ietf-tools/datatracker/issues/new/choose">
15661566+ Report a datatracker bug
15671567+ <i class="bi bi-bug"></i>
15681568+ </a>
15691569+ </div>
15701570+ <div class="tab-pane mb-5"
15711571+ id="toc-tab-pane"
15721572+ role="tabpanel"
15731573+ aria-labelledby="toc-tab"
15741574+ tabindex="0">
15751575+ <nav class="nav nav-pills flex-column small" id="toc-nav">
15761576+ </nav>
15771577+ </div>
15781578+ <div class="tab-pane mb-5 small"
15791579+ id="pref-tab-pane"
15801580+ role="tabpanel"
15811581+ aria-labelledby="pref-tab"
15821582+ tabindex="0">
15831583+ <label class="form-label fw-bold mb-2">Show sidebar by default</label>
15841584+ <div class="btn-group-vertical btn-group-sm d-flex" role="group">
15851585+ <input type="radio" class="btn-check" name="sidebar" id="on-radio">
15861586+ <label class="btn btn-outline-primary" for="on-radio">Yes</label>
15871587+ <input type="radio" class="btn-check" name="sidebar" id="off-radio">
15881588+ <label class="btn btn-outline-primary" for="off-radio">No</label>
15891589+ </div>
15901590+ <label class="form-label fw-bold mt-4 mb-2">Tab to show by default</label>
15911591+ <div class="btn-group-vertical btn-group-sm d-flex" role="group">
15921592+ <input type="radio" class="btn-check" name="deftab" id="docinfo-radio">
15931593+ <label class="btn btn-outline-primary" for="docinfo-radio">
15941594+ <i class="bi bi-info-circle me-1"></i>Info
15951595+ </label>
15961596+ <input type="radio" class="btn-check" name="deftab" id="toc-radio">
15971597+ <label class="btn btn-outline-primary" for="toc-radio">
15981598+ <i class="bi bi-list-ol me-1"></i>Contents
15991599+ </label>
16001600+ </div>
16011601+ <label class="form-label fw-bold mt-4 mb-2">HTMLization configuration</label>
16021602+ <div class="btn-group-vertical btn-group-sm d-flex" role="group">
16031603+ <input type="radio" class="btn-check" name="htmlconf" id="txt-radio">
16041604+ <label class="btn btn-outline-primary" for="txt-radio" title="This is the traditional HTMLization method.">
16051605+ <i class="bi bi-badge-sd me-1"></i>HTMLize the plaintext
16061606+ </label>
16071607+ <input type="radio" class="btn-check" name="htmlconf" id="html-radio">
16081608+ <label class="btn btn-outline-primary" for="html-radio" title="This is the modern HTMLization method.">
16091609+ <i class="bi bi-badge-hd me-1"></i>Plaintextify the HTML
16101610+ </label>
16111611+ </div>
16121612+ <label class="form-label fw-bold mt-4 mb-2" for="ptsize">Maximum font size</label>
16131613+ <input type="range" class="form-range" min="7" max="16" id="ptsize" oninput="ptdemo.value = ptsize.value">
16141614+ <label class="form-label fw-bold mt-4 mb-2">Page dependencies</label>
16151615+ <div class="btn-group-vertical btn-group-sm d-flex" role="group">
16161616+ <input type="radio" class="btn-check" name="pagedeps" id="inline-radio">
16171617+ <label class="btn btn-outline-primary" for="inline-radio" title="Generate larger, standalone web pages that do not require network access to render.">
16181618+ <i class="bi bi-box me-1"></i>Inline
16191619+ </label>
16201620+ <input type="radio" class="btn-check" name="pagedeps" id="reference-radio">
16211621+ <label class="btn btn-outline-primary" for="reference-radio" title="Generate regular web pages that require network access to render.">
16221622+ <i class="bi bi-link-45deg me-1"></i>Reference
16231623+ </label>
16241624+ </div>
16251625+ <label class="form-label fw-bold mt-4 mb-2">Citation links</label>
16261626+ <div class="btn-group-vertical btn-group-sm d-flex" role="group">
16271627+ <input type="radio" class="btn-check" name="reflinks" id="refsection-radio">
16281628+ <label class="btn btn-outline-primary" for="refsection-radio" title="Citation links go to the reference section.">
16291629+ <i class="bi bi-arrow-clockwise"></i> Go to reference section
16301630+ </label>
16311631+ <input type="radio" class="btn-check" name="reflinks" id="citation-radio">
16321632+ <label class="btn btn-outline-primary" for="citation-radio" title="Citation links go directly to the cited document.">
16331633+ <i class="bi bi-link-45deg me-1"></i>Go to linked document
16341634+ </label>
16351635+ </div>
16361636+ </div>
16371637+ </div>
16381638+ </div>
16391639+ </div>
16401640+ </div>
16411641+ </div>
16421642+16431643+<script>
16441644+ var _paq = window._paq || [];
16451645+16461646+ _paq.push(['disableCookies']);
16471647+ _paq.push(['trackPageView']);
16481648+ _paq.push(['enableLinkTracking']);
16491649+ (function() {
16501650+ var u="//analytics.ietf.org/";
16511651+ _paq.push(['setTrackerUrl', u+'matomo.php']);
16521652+ _paq.push(['setSiteId', 7]);
16531653+ var d=document, g=d.createElement('script'), s=d.getElementsByTagName('script')[0];
16541654+ g.type='text/javascript'; g.async=true; g.defer=true; g.src=u+'matomo.js'; s.parentNode.insertBefore(g,s);
16551655+ })();
16561656+</script>
16571657+<noscript><p><img src="//analytics.ietf.org/matomo.php?idsite=7" style="border:0;" alt="" /></p></noscript>
16581658+16591659+ </body>
16601660+</html>
+1989
spec/rfc1951.txt
···11+22+<!DOCTYPE html>
33+44+55+66+77+88+99+1010+<html data-bs-theme="auto" lang="en">
1111+ <head>
1212+1313+ <meta charset="utf-8">
1414+ <meta http-equiv="X-UA-Compatible" content="IE=edge">
1515+ <title>
1616+1717+ RFC 1951 - DEFLATE Compressed Data Format Specification version 1.3
1818+1919+ </title>
2020+ <meta name="viewport" content="width=device-width, initial-scale=1">
2121+ <link href="https://static.ietf.org/fonts/inter/import.css" rel="stylesheet">
2222+ <link href="https://static.ietf.org/fonts/noto-sans-mono/import.css" rel="stylesheet">
2323+2424+ <link rel="stylesheet" href="https://static.ietf.org/dt/12.54.0/ietf/css/document_html_referenced.css">
2525+2626+ <script type="module" crossorigin="" src="https://static.ietf.org/dt/12.54.0/assets/embedded-055c333d.js"></script>
2727+<link href="https://static.ietf.org/dt/12.54.0/assets/create-pinia-singleton-8312c5df.js" type="text/javascript" crossorigin="anonymous" rel="modulepreload" as="script" />
2828+<link href="https://static.ietf.org/dt/12.54.0/assets/Scrollbar-ad8c5330.js" type="text/javascript" crossorigin="anonymous" rel="modulepreload" as="script" />
2929+ <script src="https://static.ietf.org/dt/12.54.0/ietf/js/document_html.js"></script>
3030+ <script src="https://static.ietf.org/dt/12.54.0/ietf/js/theme.js"></script>
3131+3232+ <link rel="alternate" type="application/atom+xml" title="Document changes" href="/feed/document-changes/rfc1951/">
3333+ <meta name="description"
3434+3535+ content="DEFLATE Compressed Data Format Specification version 1.3 (RFC 1951, )"
3636+ >
3737+3838+3939+<link rel="apple-touch-icon"
4040+ sizes="180x180"
4141+ href="https://static.ietf.org/dt/12.54.0/ietf/images/ietf-logo-nor-180.png">
4242+<link rel="icon"
4343+ sizes="32x32"
4444+ href="https://static.ietf.org/dt/12.54.0/ietf/images/ietf-logo-nor-32.png">
4545+<link rel="icon"
4646+ sizes="16x16"
4747+ href="https://static.ietf.org/dt/12.54.0/ietf/images/ietf-logo-nor-16.png">
4848+<link rel="manifest" href="/site.webmanifest">
4949+<link rel="mask-icon"
5050+ href="https://static.ietf.org/dt/12.54.0/ietf/images/ietf-logo-nor-mask.svg"
5151+ color="#ffffff">
5252+<meta name="msapplication-TileColor"
5353+ content="#ffffff">
5454+<meta name="theme-color"
5555+ content="#ffffff">
5656+5757+5858+5959+6060+6161+<meta property="og:title" content="RFC 1951: DEFLATE Compressed Data Format Specification version 1.3">
6262+<meta property="og:url" content="https://datatracker.ietf.org/doc/html/rfc1951.txt">
6363+<link rel="canonical" href="https://datatracker.ietf.org/doc/html/rfc1951.txt">
6464+<meta property="og:site_name" content="IETF Datatracker">
6565+<meta property="og:description" content="This specification defines a lossless compressed data format that compresses data using a combination of the LZ77 algorithm and Huffman coding, with efficiency comparable to the best currently available general-purpose compression methods. This memo provides information for the Internet community. This memo does not specify an Internet standard of any kind.">
6666+<meta property="og:type" content="article">
6767+6868+<meta property="article:section" content="Individual Internet-Draft">
6969+7070+<meta property="article:author" content="L. Peter Deutsch">
7171+7272+7373+7474+7575+ <style>
7676+7777+ .diff-form .select2-selection__rendered {
7878+ direction: rtl;
7979+ text-align: left;
8080+ }
8181+ </style>
8282+ </head>
8383+ <body>
8484+8585+ <noscript><iframe class="status" title="Site status" src="/status/latest"></iframe></noscript>
8686+<div class="vue-embed" data-component="Status"></div>
8787+ <div class="btn-toolbar sidebar-toolbar position-fixed top-0 end-0 m-2 m-lg-3 d-print-none">
8888+ <div class="dropdown">
8989+ <button class="btn btn-outline-secondary btn-sm me-1 dropdown-toggle d-flex align-items-center"
9090+ id="bd-theme" type="button" aria-expanded="false" data-bs-toggle="dropdown"
9191+ aria-label="Toggle theme">
9292+ <i class="theme-icon-active bi bi-circle-half"></i>
9393+ </button>
9494+9595+ <ul class="dropdown-menu" aria-labelledby="bd-theme">
9696+ <li>
9797+ <button type="button" class="dropdown-item d-flex align-items-center"
9898+ data-bs-theme-value="light" aria-pressed="false">
9999+ <i class="me-2 opacity-50 theme-icon bi bi-sun-fill"></i>
100100+ Light<i class="bi bi-check2 ms-auto d-none"></i>
101101+ </button>
102102+ </li>
103103+ <li>
104104+ <button type="button" class="dropdown-item d-flex align-items-center"
105105+ data-bs-theme-value="dark" aria-pressed="false">
106106+ <i class="me-2 opacity-50 theme-icon bi bi-moon-stars-fill"></i>
107107+ Dark<i class="bi bi-check2 ms-auto d-none"></i>
108108+ </button>
109109+ </li>
110110+ <li>
111111+ <button type="button" class="dropdown-item d-flex align-items-center active"
112112+ data-bs-theme-value="auto" aria-pressed="true">
113113+ <i class="me-2 opacity-50 theme-icon bi bi-circle-half"></i>
114114+ Auto<i class="bi bi-check2 ms-auto d-none"></i>
115115+ </button>
116116+ </li>
117117+ </ul>
118118+ </div>
119119+ <button class="btn btn-outline-secondary btn-sm sidebar-toggle"
120120+ type="button"
121121+ data-bs-toggle="collapse"
122122+ data-bs-target="#sidebar"
123123+ aria-expanded="true"
124124+ aria-controls="sidebar"
125125+ aria-label="Toggle metadata sidebar"
126126+ title="Toggle metadata sidebar">
127127+ <i class="bi bi-arrow-bar-left sidebar-shown"></i>
128128+ <i class="bi bi-arrow-bar-right sidebar-collapsed"></i>
129129+ </button>
130130+ </div>
131131+ <nav class="navbar bg-light-subtle px-1 fixed-top d-print-none d-md-none">
132132+ <a class="nav-link ps-1"
133133+ href="/doc/rfc1951/">
134134+135135+ RFC 1951
136136+137137+ <br class="d-sm-none">
138138+139139+ <span class="ms-sm-3 badge rounded-pill badge-inf">
140140+141141+ Informational
142142+143143+ </span>
144144+ </a>
145145+ <button class="navbar-toggler p-1"
146146+ type="button"
147147+ data-bs-toggle="collapse"
148148+ data-bs-target="#docinfo-collapse"
149149+ aria-controls="docinfo-collapse"
150150+ aria-expanded="false"
151151+ aria-label="Show document information">
152152+ <span class="navbar-toggler-icon small"></span>
153153+ </button>
154154+ <div class="navbar-nav navbar-nav-scroll overscroll-none collapse pt-1" id="docinfo-collapse">
155155+ <div class="bg-light-subtle p-0">
156156+ <table class="table table-sm table-borderless small">
157157+ <tbody class="meta align-top">
158158+ <tr>
159159+ <th scope="row"></th>
160160+ <th scope="row">Title</th>
161161+ <td class="edit"></td>
162162+ <td>DEFLATE Compressed Data Format Specification version 1.3</td>
163163+ </tr>
164164+ </tbody>
165165+166166+167167+168168+169169+170170+171171+172172+173173+<tbody class="meta align-top ">
174174+ <tr>
175175+ <th scope="row">Document</th>
176176+ <th scope="row">Document type</th>
177177+ <td class="edit"></td>
178178+ <td>
179179+180180+181181+182182+183183+184184+185185+<span class="text-success">RFC
186186+187187+ - Informational
188188+189189+</span>
190190+191191+192192+193193+ <br>May 1996
194194+195195+ <br>
196196+197197+ <a class="btn btn-primary btn-sm my-1"
198198+ href="https://www.rfc-editor.org/errata_search.php?rfc=1951" title="Click to view errata." rel="nofollow">
199199+ View errata
200200+ </a>
201201+202202+203203+ <a class="btn btn-sm btn-warning"
204204+ title="Click to report an error in the document."
205205+ href="https://www.rfc-editor.org/errata.php#reportnew"
206206+ target="_blank">
207207+ Report errata
208208+ </a>
209209+210210+211211+212212+213213+214214+215215+216216+217217+218218+ <div>
219219+ Was
220220+ <a href="/doc/draft-deutsch-deflate-spec/03/">draft-deutsch-deflate-spec</a>
221221+ (individual)
222222+ </div>
223223+224224+225225+226226+227227+228228+229229+230230+231231+232232+233233+ <div class="alert alert-warning small p-2 mt-2" role="alert">
234234+ This RFC is labeled as "Legacy"; it was published before a formal source was recorded.
235235+ This RFC is <strong>not endorsed by the IETF</strong> and has <strong>no formal standing</strong> in the
236236+ <a href="/doc/rfc2026/">IETF standards process</a>.
237237+ </div>
238238+239239+240240+241241+242242+ </td>
243243+ </tr>
244244+245245+ <tr>
246246+ <td></td>
247247+ <th scope="row">Select version</th>
248248+ <td class="edit"></td>
249249+ <td>
250250+251251+252252+253253+254254+ <ul class="revision-list pagination pagination-sm text-center flex-wrap my-0">
255255+256256+257257+258258+259259+ <li class="page-item">
260260+ <a class="page-link"
261261+ href="/doc/html/draft-deutsch-deflate-spec-03"
262262+ rel="nofollow">
263263+ 03
264264+ </a>
265265+ </li>
266266+267267+268268+269269+ <li class="page-item rfc active">
270270+ <a class="page-link"
271271+ href="/doc/html/rfc1951">
272272+ RFC 1951
273273+ </a>
274274+ </li>
275275+276276+ </ul>
277277+278278+ </td>
279279+ </tr>
280280+281281+ <tr>
282282+ <td></td>
283283+ <th scope="row">Compare versions</th>
284284+ <td class="edit"></td>
285285+ <td>
286286+287287+288288+289289+290290+<form class="form-horizontal diff-form"
291291+ action="https://author-tools.ietf.org/iddiff"
292292+ method="get"
293293+ target="_blank">
294294+295295+ <select class="form-select form-select-sm mb-1 select2-field"
296296+ data-max-entries="1"
297297+ data-width="resolve"
298298+ data-allow-clear="false"
299299+ data-minimum-input-length="0"
300300+ aria-label="From revision"
301301+ name="url1">
302302+303303+ <option value="rfc1951">
304304+ RFC 1951
305305+306306+ </option>
307307+308308+ <option value="draft-deutsch-deflate-spec-03" selected>
309309+ draft-deutsch-deflate-spec-03
310310+311311+ </option>
312312+313313+ <option value="draft-deutsch-deflate-spec-02">
314314+ draft-deutsch-deflate-spec-02
315315+316316+ </option>
317317+318318+ <option value="draft-deutsch-deflate-spec-01">
319319+ draft-deutsch-deflate-spec-01
320320+321321+ </option>
322322+323323+ <option value="draft-deutsch-deflate-spec-00">
324324+ draft-deutsch-deflate-spec-00
325325+326326+ </option>
327327+328328+329329+ </select>
330330+331331+ <select class="form-select form-select-sm mb-1 select2-field"
332332+ data-max-entries="1"
333333+ data-width="resolve"
334334+ data-allow-clear="false"
335335+ data-minimum-input-length="0"
336336+ aria-label="To revision"
337337+ name="url2">
338338+339339+ <option value="rfc1951" selected>
340340+ RFC 1951
341341+342342+ </option>
343343+344344+ <option value="draft-deutsch-deflate-spec-03">
345345+ draft-deutsch-deflate-spec-03
346346+347347+ </option>
348348+349349+ <option value="draft-deutsch-deflate-spec-02">
350350+ draft-deutsch-deflate-spec-02
351351+352352+ </option>
353353+354354+ <option value="draft-deutsch-deflate-spec-01">
355355+ draft-deutsch-deflate-spec-01
356356+357357+ </option>
358358+359359+ <option value="draft-deutsch-deflate-spec-00">
360360+ draft-deutsch-deflate-spec-00
361361+362362+ </option>
363363+364364+365365+ </select>
366366+367367+ <button type="submit"
368368+ class="btn btn-primary btn-sm"
369369+ value="--html"
370370+ name="difftype">
371371+ Side-by-side
372372+ </button>
373373+374374+ <button type="submit"
375375+ class="btn btn-primary btn-sm"
376376+ value="--hwdiff"
377377+ name="difftype">
378378+ Inline
379379+ </button>
380380+381381+</form>
382382+ </td>
383383+ </tr>
384384+385385+386386+ <tr>
387387+ <td></td>
388388+ <th scope="row">Author</th>
389389+ <td class="edit">
390390+391391+ </td>
392392+ <td>
393393+394394+395395+ <span ><a
396396+ title="Datatracker profile of L. Peter Deutsch"
397397+ href="/person/ghost@aladdin.com" >L. Peter Deutsch</a> <a
398398+ href="mailto:ghost%40aladdin.com"
399399+ aria-label="Compose email to ghost@aladdin.com"
400400+ title="Compose email to ghost@aladdin.com">
401401+ <i class="bi bi-envelope"></i></a></span>
402402+403403+404404+ <br>
405405+ <a class="btn btn-primary btn-sm mt-1" href="mailto:rfc1951@ietf.org?subject=rfc1951" title="Send email to the document authors">Email authors</a>
406406+407407+ </td>
408408+ </tr>
409409+410410+411411+ <tr>
412412+ <td></td>
413413+ <th scope="row">
414414+ RFC stream
415415+ </th>
416416+ <td class="edit">
417417+418418+ </td>
419419+ <td >
420420+421421+422422+423423+424424+ Legacy
425425+426426+427427+428428+429429+ </td>
430430+ </tr>
431431+432432+ <tr>
433433+ <td></td>
434434+ <th scope="row">
435435+ Other formats
436436+ </th>
437437+ <td class="edit">
438438+ </td>
439439+ <td>
440440+441441+442442+ <div class="buttonlist">
443443+444444+445445+ <a class="btn btn-primary btn-sm"
446446+447447+ target="_blank"
448448+ href="https://www.rfc-editor.org/rfc/rfc1951.txt">
449449+450450+ <i class="bi bi-file-text"></i> txt
451451+452452+ </a>
453453+454454+455455+456456+ <a class="btn btn-primary btn-sm"
457457+458458+ target="_blank"
459459+ href="https://www.rfc-editor.org/rfc/rfc1951.html">
460460+461461+ <i class="bi bi-file-code"></i> html
462462+463463+ </a>
464464+465465+466466+467467+ <a class="btn btn-primary btn-sm"
468468+469469+ download="rfc1951.pdf"
470470+471471+472472+ target="_blank"
473473+ href="https://www.rfc-editor.org/rfc/rfc1951.pdf">
474474+475475+ <i class="bi bi-file-pdf"></i> pdf
476476+477477+ </a>
478478+479479+480480+481481+482482+483483+ <a class="btn btn-primary btn-sm"
484484+485485+ target="_blank"
486486+ href="/doc/rfc1951/bibtex/">
487487+488488+ <i class="bi bi-file-ruled"></i> bibtex
489489+490490+ </a>
491491+492492+493493+</div>
494494+495495+496496+ </td>
497497+ </tr>
498498+499499+500500+501501+502502+</tbody>
503503+ <tr>
504504+ <th scope="row"></th>
505505+ <th scope="row"></th>
506506+ <td class="edit"></td>
507507+ <td>
508508+ <a class="btn btn-sm btn-warning mb-3"
509509+ target="_blank"
510510+ href="https://github.com/ietf-tools/datatracker/issues/new/choose">
511511+ Report a bug
512512+ <i class="bi bi-bug"></i>
513513+ </a>
514514+ </td>
515515+ </tr>
516516+ </table>
517517+ </div>
518518+ </div>
519519+ </nav>
520520+ <div class="row g-0">
521521+ <div class="col-md-9 d-flex justify-content-center lh-sm"
522522+ data-bs-spy="scroll"
523523+ data-bs-target="#toc-nav"
524524+ data-bs-smooth-scroll="true"
525525+ tabindex="0"
526526+ id="content">
527527+528528+ <div class="rfcmarkup">
529529+ <br class="noprint">
530530+ <!-- [html-validate-disable-block attr-quotes, void-style, element-permitted-content, heading-level -- FIXME: rfcmarkup/rfc2html generates HTML with issues] -->
531531+ <div class="rfcmarkup"><pre>Network Working Group P. Deutsch
532532+Request for Comments: 1951 Aladdin Enterprises
533533+Category: Informational May 1996
534534+535535+536536+ <span class="h1">DEFLATE Compressed Data Format Specification version 1.3</span>
537537+538538+Status of This Memo
539539+540540+ This memo provides information for the Internet community. This memo
541541+ does not specify an Internet standard of any kind. Distribution of
542542+ this memo is unlimited.
543543+544544+IESG Note:
545545+546546+ The IESG takes no position on the validity of any Intellectual
547547+ Property Rights statements contained in this document.
548548+549549+Notices
550550+551551+ Copyright (c) 1996 L. Peter Deutsch
552552+553553+ Permission is granted to copy and distribute this document for any
554554+ purpose and without charge, including translations into other
555555+ languages and incorporation into compilations, provided that the
556556+ copyright notice and this notice are preserved, and that any
557557+ substantive changes or deletions from the original are clearly
558558+ marked.
559559+560560+ A pointer to the latest version of this and related documentation in
561561+ HTML format can be found at the URL
562562+ <<a href="ftp://ftp.uu.net/graphics/png/documents/zlib/zdoc-index.html">ftp://ftp.uu.net/graphics/png/documents/zlib/zdoc-index.html</a>>.
563563+564564+Abstract
565565+566566+ This specification defines a lossless compressed data format that
567567+ compresses data using a combination of the LZ77 algorithm and Huffman
568568+ coding, with efficiency comparable to the best currently available
569569+ general-purpose compression methods. The data can be produced or
570570+ consumed, even for an arbitrarily long sequentially presented input
571571+ data stream, using only an a priori bounded amount of intermediate
572572+ storage. The format can be implemented readily in a manner not
573573+ covered by patents.
574574+575575+576576+577577+578578+579579+580580+581581+582582+<span class="grey">Deutsch Informational [Page 1]</span></pre>
583583+<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-2" ></span>
584584+<span class="grey"><a href="/doc/html/rfc1951">RFC 1951</a> DEFLATE Compressed Data Format Specification May 1996</span>
585585+586586+587587+Table of Contents
588588+589589+ <a href="#section-1">1</a>. Introduction ................................................... <a href="#page-2">2</a>
590590+ <a href="#section-1.1">1.1</a>. Purpose ................................................... <a href="#page-2">2</a>
591591+ <a href="#section-1.2">1.2</a>. Intended audience ......................................... <a href="#page-3">3</a>
592592+ <a href="#section-1.3">1.3</a>. Scope ..................................................... <a href="#page-3">3</a>
593593+ <a href="#section-1.4">1.4</a>. Compliance ................................................ <a href="#page-3">3</a>
594594+ <a href="#section-1.5">1.5</a>. Definitions of terms and conventions used ................ <a href="#page-3">3</a>
595595+ <a href="#section-1.6">1.6</a>. Changes from previous versions ............................ <a href="#page-4">4</a>
596596+ <a href="#section-2">2</a>. Compressed representation overview ............................. <a href="#page-4">4</a>
597597+ <a href="#section-3">3</a>. Detailed specification ......................................... <a href="#page-5">5</a>
598598+ <a href="#section-3.1">3.1</a>. Overall conventions ....................................... <a href="#page-5">5</a>
599599+ <a href="#section-3.1.1">3.1.1</a>. Packing into bytes .................................. <a href="#page-5">5</a>
600600+ <a href="#section-3.2">3.2</a>. Compressed block format ................................... <a href="#page-6">6</a>
601601+ <a href="#section-3.2.1">3.2.1</a>. Synopsis of prefix and Huffman coding ............... <a href="#page-6">6</a>
602602+ <a href="#section-3.2.2">3.2.2</a>. Use of Huffman coding in the "deflate" format ....... <a href="#page-7">7</a>
603603+ <a href="#section-3.2.3">3.2.3</a>. Details of block format ............................. <a href="#page-9">9</a>
604604+ <a href="#section-3.2.4">3.2.4</a>. Non-compressed blocks (BTYPE=00) ................... <a href="#page-11">11</a>
605605+ <a href="#section-3.2.5">3.2.5</a>. Compressed blocks (length and distance codes) ...... <a href="#page-11">11</a>
606606+ <a href="#section-3.2.6">3.2.6</a>. Compression with fixed Huffman codes (BTYPE=01) .... <a href="#page-12">12</a>
607607+ <a href="#section-3.2.7">3.2.7</a>. Compression with dynamic Huffman codes (BTYPE=10) .. <a href="#page-13">13</a>
608608+ <a href="#section-3.3">3.3</a>. Compliance ............................................... <a href="#page-14">14</a>
609609+ <a href="#section-4">4</a>. Compression algorithm details ................................. <a href="#page-14">14</a>
610610+ <a href="#section-5">5</a>. References .................................................... <a href="#page-16">16</a>
611611+ <a href="#section-6">6</a>. Security Considerations ....................................... <a href="#page-16">16</a>
612612+ <a href="#section-7">7</a>. Source code ................................................... <a href="#page-16">16</a>
613613+ <a href="#section-8">8</a>. Acknowledgements .............................................. <a href="#page-16">16</a>
614614+ <a href="#section-9">9</a>. Author's Address .............................................. <a href="#page-17">17</a>
615615+616616+<span class="h2"><a class="selflink" id="section-1" href="#section-1">1</a>. Introduction</span>
617617+618618+ 1.1. Purpose
619619+620620+ The purpose of this specification is to define a lossless
621621+ compressed data format that:
622622+ * Is independent of CPU type, operating system, file system,
623623+ and character set, and hence can be used for interchange;
624624+ * Can be produced or consumed, even for an arbitrarily long
625625+ sequentially presented input data stream, using only an a
626626+ priori bounded amount of intermediate storage, and hence
627627+ can be used in data communications or similar structures
628628+ such as Unix filters;
629629+ * Compresses data with efficiency comparable to the best
630630+ currently available general-purpose compression methods,
631631+ and in particular considerably better than the "compress"
632632+ program;
633633+ * Can be implemented readily in a manner not covered by
634634+ patents, and hence can be practiced freely;
635635+636636+637637+638638+<span class="grey">Deutsch Informational [Page 2]</span></pre>
639639+<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-3" ></span>
640640+<span class="grey"><a href="/doc/html/rfc1951">RFC 1951</a> DEFLATE Compressed Data Format Specification May 1996</span>
641641+642642+643643+ * Is compatible with the file format produced by the current
644644+ widely used gzip utility, in that conforming decompressors
645645+ will be able to read data produced by the existing gzip
646646+ compressor.
647647+648648+ The data format defined by this specification does not attempt to:
649649+650650+ * Allow random access to compressed data;
651651+ * Compress specialized data (e.g., raster graphics) as well
652652+ as the best currently available specialized algorithms.
653653+654654+ A simple counting argument shows that no lossless compression
655655+ algorithm can compress every possible input data set. For the
656656+ format defined here, the worst case expansion is 5 bytes per 32K-
657657+ byte block, i.e., a size increase of 0.015% for large data sets.
658658+ English text usually compresses by a factor of 2.5 to 3;
659659+ executable files usually compress somewhat less; graphical data
660660+ such as raster images may compress much more.
661661+662662+ 1.2. Intended audience
663663+664664+ This specification is intended for use by implementors of software
665665+ to compress data into "deflate" format and/or decompress data from
666666+ "deflate" format.
667667+668668+ The text of the specification assumes a basic background in
669669+ programming at the level of bits and other primitive data
670670+ representations. Familiarity with the technique of Huffman coding
671671+ is helpful but not required.
672672+673673+ 1.3. Scope
674674+675675+ The specification specifies a method for representing a sequence
676676+ of bytes as a (usually shorter) sequence of bits, and a method for
677677+ packing the latter bit sequence into bytes.
678678+679679+ 1.4. Compliance
680680+681681+ Unless otherwise indicated below, a compliant decompressor must be
682682+ able to accept and decompress any data set that conforms to all
683683+ the specifications presented here; a compliant compressor must
684684+ produce data sets that conform to all the specifications presented
685685+ here.
686686+687687+ 1.5. Definitions of terms and conventions used
688688+689689+ Byte: 8 bits stored or transmitted as a unit (same as an octet).
690690+ For this specification, a byte is exactly 8 bits, even on machines
691691+692692+693693+694694+<span class="grey">Deutsch Informational [Page 3]</span></pre>
695695+<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-4" ></span>
696696+<span class="grey"><a href="/doc/html/rfc1951">RFC 1951</a> DEFLATE Compressed Data Format Specification May 1996</span>
697697+698698+699699+ which store a character on a number of bits different from eight.
700700+ See below, for the numbering of bits within a byte.
701701+702702+ String: a sequence of arbitrary bytes.
703703+704704+ 1.6. Changes from previous versions
705705+706706+ There have been no technical changes to the deflate format since
707707+ version 1.1 of this specification. In version 1.2, some
708708+ terminology was changed. Version 1.3 is a conversion of the
709709+ specification to RFC style.
710710+711711+<span class="h2"><a class="selflink" id="section-2" href="#section-2">2</a>. Compressed representation overview</span>
712712+713713+ A compressed data set consists of a series of blocks, corresponding
714714+ to successive blocks of input data. The block sizes are arbitrary,
715715+ except that non-compressible blocks are limited to 65,535 bytes.
716716+717717+ Each block is compressed using a combination of the LZ77 algorithm
718718+ and Huffman coding. The Huffman trees for each block are independent
719719+ of those for previous or subsequent blocks; the LZ77 algorithm may
720720+ use a reference to a duplicated string occurring in a previous block,
721721+ up to 32K input bytes before.
722722+723723+ Each block consists of two parts: a pair of Huffman code trees that
724724+ describe the representation of the compressed data part, and a
725725+ compressed data part. (The Huffman trees themselves are compressed
726726+ using Huffman encoding.) The compressed data consists of a series of
727727+ elements of two types: literal bytes (of strings that have not been
728728+ detected as duplicated within the previous 32K input bytes), and
729729+ pointers to duplicated strings, where a pointer is represented as a
730730+ pair <length, backward distance>. The representation used in the
731731+ "deflate" format limits distances to 32K bytes and lengths to 258
732732+ bytes, but does not limit the size of a block, except for
733733+ uncompressible blocks, which are limited as noted above.
734734+735735+ Each type of value (literals, distances, and lengths) in the
736736+ compressed data is represented using a Huffman code, using one code
737737+ tree for literals and lengths and a separate code tree for distances.
738738+ The code trees for each block appear in a compact form just before
739739+ the compressed data for that block.
740740+741741+742742+743743+744744+745745+746746+747747+748748+749749+750750+<span class="grey">Deutsch Informational [Page 4]</span></pre>
751751+<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-5" ></span>
752752+<span class="grey"><a href="/doc/html/rfc1951">RFC 1951</a> DEFLATE Compressed Data Format Specification May 1996</span>
753753+754754+755755+<span class="h2"><a class="selflink" id="section-3" href="#section-3">3</a>. Detailed specification</span>
756756+757757+ 3.1. Overall conventions In the diagrams below, a box like this:
758758+759759+ +---+
760760+ | | <-- the vertical bars might be missing
761761+ +---+
762762+763763+ represents one byte; a box like this:
764764+765765+ +==============+
766766+ | |
767767+ +==============+
768768+769769+ represents a variable number of bytes.
770770+771771+ Bytes stored within a computer do not have a "bit order", since
772772+ they are always treated as a unit. However, a byte considered as
773773+ an integer between 0 and 255 does have a most- and least-
774774+ significant bit, and since we write numbers with the most-
775775+ significant digit on the left, we also write bytes with the most-
776776+ significant bit on the left. In the diagrams below, we number the
777777+ bits of a byte so that bit 0 is the least-significant bit, i.e.,
778778+ the bits are numbered:
779779+780780+ +--------+
781781+ |76543210|
782782+ +--------+
783783+784784+ Within a computer, a number may occupy multiple bytes. All
785785+ multi-byte numbers in the format described here are stored with
786786+ the least-significant byte first (at the lower memory address).
787787+ For example, the decimal number 520 is stored as:
788788+789789+ 0 1
790790+ +--------+--------+
791791+ |00001000|00000010|
792792+ +--------+--------+
793793+ ^ ^
794794+ | |
795795+ | + more significant byte = 2 x 256
796796+ + less significant byte = 8
797797+798798+ 3.1.1. Packing into bytes
799799+800800+ This document does not address the issue of the order in which
801801+ bits of a byte are transmitted on a bit-sequential medium,
802802+ since the final data format described here is byte- rather than
803803+804804+805805+806806+<span class="grey">Deutsch Informational [Page 5]</span></pre>
807807+<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-6" ></span>
808808+<span class="grey"><a href="/doc/html/rfc1951">RFC 1951</a> DEFLATE Compressed Data Format Specification May 1996</span>
809809+810810+811811+ bit-oriented. However, we describe the compressed block format
812812+ in below, as a sequence of data elements of various bit
813813+ lengths, not a sequence of bytes. We must therefore specify
814814+ how to pack these data elements into bytes to form the final
815815+ compressed byte sequence:
816816+817817+ * Data elements are packed into bytes in order of
818818+ increasing bit number within the byte, i.e., starting
819819+ with the least-significant bit of the byte.
820820+ * Data elements other than Huffman codes are packed
821821+ starting with the least-significant bit of the data
822822+ element.
823823+ * Huffman codes are packed starting with the most-
824824+ significant bit of the code.
825825+826826+ In other words, if one were to print out the compressed data as
827827+ a sequence of bytes, starting with the first byte at the
828828+ *right* margin and proceeding to the *left*, with the most-
829829+ significant bit of each byte on the left as usual, one would be
830830+ able to parse the result from right to left, with fixed-width
831831+ elements in the correct MSB-to-LSB order and Huffman codes in
832832+ bit-reversed order (i.e., with the first bit of the code in the
833833+ relative LSB position).
834834+835835+ 3.2. Compressed block format
836836+837837+ 3.2.1. Synopsis of prefix and Huffman coding
838838+839839+ Prefix coding represents symbols from an a priori known
840840+ alphabet by bit sequences (codes), one code for each symbol, in
841841+ a manner such that different symbols may be represented by bit
842842+ sequences of different lengths, but a parser can always parse
843843+ an encoded string unambiguously symbol-by-symbol.
844844+845845+ We define a prefix code in terms of a binary tree in which the
846846+ two edges descending from each non-leaf node are labeled 0 and
847847+ 1 and in which the leaf nodes correspond one-for-one with (are
848848+ labeled with) the symbols of the alphabet; then the code for a
849849+ symbol is the sequence of 0's and 1's on the edges leading from
850850+ the root to the leaf labeled with that symbol. For example:
851851+852852+853853+854854+855855+856856+857857+858858+859859+860860+861861+862862+<span class="grey">Deutsch Informational [Page 6]</span></pre>
863863+<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-7" ></span>
864864+<span class="grey"><a href="/doc/html/rfc1951">RFC 1951</a> DEFLATE Compressed Data Format Specification May 1996</span>
865865+866866+867867+ /\ Symbol Code
868868+ 0 1 ------ ----
869869+ / \ A 00
870870+ /\ B B 1
871871+ 0 1 C 011
872872+ / \ D 010
873873+ A /\
874874+ 0 1
875875+ / \
876876+ D C
877877+878878+ A parser can decode the next symbol from an encoded input
879879+ stream by walking down the tree from the root, at each step
880880+ choosing the edge corresponding to the next input bit.
881881+882882+ Given an alphabet with known symbol frequencies, the Huffman
883883+ algorithm allows the construction of an optimal prefix code
884884+ (one which represents strings with those symbol frequencies
885885+ using the fewest bits of any possible prefix codes for that
886886+ alphabet). Such a code is called a Huffman code. (See
887887+ reference [<a href="#ref-1" title=""A Method for the Construction of Minimum Redundancy Codes"">1</a>] in Chapter 5, references for additional
888888+ information on Huffman codes.)
889889+890890+ Note that in the "deflate" format, the Huffman codes for the
891891+ various alphabets must not exceed certain maximum code lengths.
892892+ This constraint complicates the algorithm for computing code
893893+ lengths from symbol frequencies. Again, see Chapter 5,
894894+ references for details.
895895+896896+ 3.2.2. Use of Huffman coding in the "deflate" format
897897+898898+ The Huffman codes used for each alphabet in the "deflate"
899899+ format have two additional rules:
900900+901901+ * All codes of a given bit length have lexicographically
902902+ consecutive values, in the same order as the symbols
903903+ they represent;
904904+905905+ * Shorter codes lexicographically precede longer codes.
906906+907907+908908+909909+910910+911911+912912+913913+914914+915915+916916+917917+918918+<span class="grey">Deutsch Informational [Page 7]</span></pre>
919919+<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-8" ></span>
920920+<span class="grey"><a href="/doc/html/rfc1951">RFC 1951</a> DEFLATE Compressed Data Format Specification May 1996</span>
921921+922922+923923+ We could recode the example above to follow this rule as
924924+ follows, assuming that the order of the alphabet is ABCD:
925925+926926+ Symbol Code
927927+ ------ ----
928928+ A 10
929929+ B 0
930930+ C 110
931931+ D 111
932932+933933+ I.e., 0 precedes 10 which precedes 11x, and 110 and 111 are
934934+ lexicographically consecutive.
935935+936936+ Given this rule, we can define the Huffman code for an alphabet
937937+ just by giving the bit lengths of the codes for each symbol of
938938+ the alphabet in order; this is sufficient to determine the
939939+ actual codes. In our example, the code is completely defined
940940+ by the sequence of bit lengths (2, 1, 3, 3). The following
941941+ algorithm generates the codes as integers, intended to be read
942942+ from most- to least-significant bit. The code lengths are
943943+ initially in tree[I].Len; the codes are produced in
944944+ tree[I].Code.
945945+946946+ 1) Count the number of codes for each code length. Let
947947+ bl_count[N] be the number of codes of length N, N >= 1.
948948+949949+ 2) Find the numerical value of the smallest code for each
950950+ code length:
951951+952952+ code = 0;
953953+ bl_count[0] = 0;
954954+ for (bits = 1; bits <= MAX_BITS; bits++) {
955955+ code = (code + bl_count[bits-1]) << 1;
956956+ next_code[bits] = code;
957957+ }
958958+959959+ 3) Assign numerical values to all codes, using consecutive
960960+ values for all codes of the same length with the base
961961+ values determined at step 2. Codes that are never used
962962+ (which have a bit length of zero) must not be assigned a
963963+ value.
964964+965965+ for (n = 0; n <= max_code; n++) {
966966+ len = tree[n].Len;
967967+ if (len != 0) {
968968+ tree[n].Code = next_code[len];
969969+ next_code[len]++;
970970+ }
971971+972972+973973+974974+<span class="grey">Deutsch Informational [Page 8]</span></pre>
975975+<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-9" ></span>
976976+<span class="grey"><a href="/doc/html/rfc1951">RFC 1951</a> DEFLATE Compressed Data Format Specification May 1996</span>
977977+978978+979979+ }
980980+981981+ Example:
982982+983983+ Consider the alphabet ABCDEFGH, with bit lengths (3, 3, 3, 3,
984984+ 3, 2, 4, 4). After step 1, we have:
985985+986986+ N bl_count[N]
987987+ - -----------
988988+ 2 1
989989+ 3 5
990990+ 4 2
991991+992992+ Step 2 computes the following next_code values:
993993+994994+ N next_code[N]
995995+ - ------------
996996+ 1 0
997997+ 2 0
998998+ 3 2
999999+ 4 14
10001000+10011001+ Step 3 produces the following code values:
10021002+10031003+ Symbol Length Code
10041004+ ------ ------ ----
10051005+ A 3 010
10061006+ B 3 011
10071007+ C 3 100
10081008+ D 3 101
10091009+ E 3 110
10101010+ F 2 00
10111011+ G 4 1110
10121012+ H 4 1111
10131013+10141014+ 3.2.3. Details of block format
10151015+10161016+ Each block of compressed data begins with 3 header bits
10171017+ containing the following data:
10181018+10191019+ first bit BFINAL
10201020+ next 2 bits BTYPE
10211021+10221022+ Note that the header bits do not necessarily begin on a byte
10231023+ boundary, since a block does not necessarily occupy an integral
10241024+ number of bytes.
10251025+10261026+10271027+10281028+10291029+10301030+<span class="grey">Deutsch Informational [Page 9]</span></pre>
10311031+<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-10" ></span>
10321032+<span class="grey"><a href="/doc/html/rfc1951">RFC 1951</a> DEFLATE Compressed Data Format Specification May 1996</span>
10331033+10341034+10351035+ BFINAL is set if and only if this is the last block of the data
10361036+ set.
10371037+10381038+ BTYPE specifies how the data are compressed, as follows:
10391039+10401040+ 00 - no compression
10411041+ 01 - compressed with fixed Huffman codes
10421042+ 10 - compressed with dynamic Huffman codes
10431043+ 11 - reserved (error)
10441044+10451045+ The only difference between the two compressed cases is how the
10461046+ Huffman codes for the literal/length and distance alphabets are
10471047+ defined.
10481048+10491049+ In all cases, the decoding algorithm for the actual data is as
10501050+ follows:
10511051+10521052+ do
10531053+ read block header from input stream.
10541054+ if stored with no compression
10551055+ skip any remaining bits in current partially
10561056+ processed byte
10571057+ read LEN and NLEN (see next section)
10581058+ copy LEN bytes of data to output
10591059+ otherwise
10601060+ if compressed with dynamic Huffman codes
10611061+ read representation of code trees (see
10621062+ subsection below)
10631063+ loop (until end of block code recognized)
10641064+ decode literal/length value from input stream
10651065+ if value < 256
10661066+ copy value (literal byte) to output stream
10671067+ otherwise
10681068+ if value = end of block (256)
10691069+ break from loop
10701070+ otherwise (value = 257..285)
10711071+ decode distance from input stream
10721072+10731073+ move backwards distance bytes in the output
10741074+ stream, and copy length bytes from this
10751075+ position to the output stream.
10761076+ end loop
10771077+ while not last block
10781078+10791079+ Note that a duplicated string reference may refer to a string
10801080+ in a previous block; i.e., the backward distance may cross one
10811081+ or more block boundaries. However a distance cannot refer past
10821082+ the beginning of the output stream. (An application using a
10831083+10841084+10851085+10861086+<span class="grey">Deutsch Informational [Page 10]</span></pre>
10871087+<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-11" ></span>
10881088+<span class="grey"><a href="/doc/html/rfc1951">RFC 1951</a> DEFLATE Compressed Data Format Specification May 1996</span>
10891089+10901090+10911091+ preset dictionary might discard part of the output stream; a
10921092+ distance can refer to that part of the output stream anyway)
10931093+ Note also that the referenced string may overlap the current
10941094+ position; for example, if the last 2 bytes decoded have values
10951095+ X and Y, a string reference with <length = 5, distance = 2>
10961096+ adds X,Y,X,Y,X to the output stream.
10971097+10981098+ We now specify each compression method in turn.
10991099+11001100+ 3.2.4. Non-compressed blocks (BTYPE=00)
11011101+11021102+ Any bits of input up to the next byte boundary are ignored.
11031103+ The rest of the block consists of the following information:
11041104+11051105+ 0 1 2 3 4...
11061106+ +---+---+---+---+================================+
11071107+ | LEN | NLEN |... LEN bytes of literal data...|
11081108+ +---+---+---+---+================================+
11091109+11101110+ LEN is the number of data bytes in the block. NLEN is the
11111111+ one's complement of LEN.
11121112+11131113+ 3.2.5. Compressed blocks (length and distance codes)
11141114+11151115+ As noted above, encoded data blocks in the "deflate" format
11161116+ consist of sequences of symbols drawn from three conceptually
11171117+ distinct alphabets: either literal bytes, from the alphabet of
11181118+ byte values (0..255), or <length, backward distance> pairs,
11191119+ where the length is drawn from (3..258) and the distance is
11201120+ drawn from (1..32,768). In fact, the literal and length
11211121+ alphabets are merged into a single alphabet (0..285), where
11221122+ values 0..255 represent literal bytes, the value 256 indicates
11231123+ end-of-block, and values 257..285 represent length codes
11241124+ (possibly in conjunction with extra bits following the symbol
11251125+ code) as follows:
11261126+11271127+11281128+11291129+11301130+11311131+11321132+11331133+11341134+11351135+11361136+11371137+11381138+11391139+11401140+11411141+11421142+<span class="grey">Deutsch Informational [Page 11]</span></pre>
11431143+<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-12" ></span>
11441144+<span class="grey"><a href="/doc/html/rfc1951">RFC 1951</a> DEFLATE Compressed Data Format Specification May 1996</span>
11451145+11461146+11471147+ Extra Extra Extra
11481148+ Code Bits Length(s) Code Bits Lengths Code Bits Length(s)
11491149+ ---- ---- ------ ---- ---- ------- ---- ---- -------
11501150+ 257 0 3 267 1 15,16 277 4 67-82
11511151+ 258 0 4 268 1 17,18 278 4 83-98
11521152+ 259 0 5 269 2 19-22 279 4 99-114
11531153+ 260 0 6 270 2 23-26 280 4 115-130
11541154+ 261 0 7 271 2 27-30 281 5 131-162
11551155+ 262 0 8 272 2 31-34 282 5 163-194
11561156+ 263 0 9 273 3 35-42 283 5 195-226
11571157+ 264 0 10 274 3 43-50 284 5 227-257
11581158+ 265 1 11,12 275 3 51-58 285 0 258
11591159+ 266 1 13,14 276 3 59-66
11601160+11611161+ The extra bits should be interpreted as a machine integer
11621162+ stored with the most-significant bit first, e.g., bits 1110
11631163+ represent the value 14.
11641164+11651165+ Extra Extra Extra
11661166+ Code Bits Dist Code Bits Dist Code Bits Distance
11671167+ ---- ---- ---- ---- ---- ------ ---- ---- --------
11681168+ 0 0 1 10 4 33-48 20 9 1025-1536
11691169+ 1 0 2 11 4 49-64 21 9 1537-2048
11701170+ 2 0 3 12 5 65-96 22 10 2049-3072
11711171+ 3 0 4 13 5 97-128 23 10 3073-4096
11721172+ 4 1 5,6 14 6 129-192 24 11 4097-6144
11731173+ 5 1 7,8 15 6 193-256 25 11 6145-8192
11741174+ 6 2 9-12 16 7 257-384 26 12 8193-12288
11751175+ 7 2 13-16 17 7 385-512 27 12 12289-16384
11761176+ 8 3 17-24 18 8 513-768 28 13 16385-24576
11771177+ 9 3 25-32 19 8 769-1024 29 13 24577-32768
11781178+11791179+ 3.2.6. Compression with fixed Huffman codes (BTYPE=01)
11801180+11811181+ The Huffman codes for the two alphabets are fixed, and are not
11821182+ represented explicitly in the data. The Huffman code lengths
11831183+ for the literal/length alphabet are:
11841184+11851185+ Lit Value Bits Codes
11861186+ --------- ---- -----
11871187+ 0 - 143 8 00110000 through
11881188+ 10111111
11891189+ 144 - 255 9 110010000 through
11901190+ 111111111
11911191+ 256 - 279 7 0000000 through
11921192+ 0010111
11931193+ 280 - 287 8 11000000 through
11941194+ 11000111
11951195+11961196+11971197+11981198+<span class="grey">Deutsch Informational [Page 12]</span></pre>
11991199+<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-13" ></span>
12001200+<span class="grey"><a href="/doc/html/rfc1951">RFC 1951</a> DEFLATE Compressed Data Format Specification May 1996</span>
12011201+12021202+12031203+ The code lengths are sufficient to generate the actual codes,
12041204+ as described above; we show the codes in the table for added
12051205+ clarity. Literal/length values 286-287 will never actually
12061206+ occur in the compressed data, but participate in the code
12071207+ construction.
12081208+12091209+ Distance codes 0-31 are represented by (fixed-length) 5-bit
12101210+ codes, with possible additional bits as shown in the table
12111211+ shown in Paragraph 3.2.5, above. Note that distance codes 30-
12121212+ 31 will never actually occur in the compressed data.
12131213+12141214+ 3.2.7. Compression with dynamic Huffman codes (BTYPE=10)
12151215+12161216+ The Huffman codes for the two alphabets appear in the block
12171217+ immediately after the header bits and before the actual
12181218+ compressed data, first the literal/length code and then the
12191219+ distance code. Each code is defined by a sequence of code
12201220+ lengths, as discussed in Paragraph 3.2.2, above. For even
12211221+ greater compactness, the code length sequences themselves are
12221222+ compressed using a Huffman code. The alphabet for code lengths
12231223+ is as follows:
12241224+12251225+ 0 - 15: Represent code lengths of 0 - 15
12261226+ 16: Copy the previous code length 3 - 6 times.
12271227+ The next 2 bits indicate repeat length
12281228+ (0 = 3, ... , 3 = 6)
12291229+ Example: Codes 8, 16 (+2 bits 11),
12301230+ 16 (+2 bits 10) will expand to
12311231+ 12 code lengths of 8 (1 + 6 + 5)
12321232+ 17: Repeat a code length of 0 for 3 - 10 times.
12331233+ (3 bits of length)
12341234+ 18: Repeat a code length of 0 for 11 - 138 times
12351235+ (7 bits of length)
12361236+12371237+ A code length of 0 indicates that the corresponding symbol in
12381238+ the literal/length or distance alphabet will not occur in the
12391239+ block, and should not participate in the Huffman code
12401240+ construction algorithm given earlier. If only one distance
12411241+ code is used, it is encoded using one bit, not zero bits; in
12421242+ this case there is a single code length of one, with one unused
12431243+ code. One distance code of zero bits means that there are no
12441244+ distance codes used at all (the data is all literals).
12451245+12461246+ We can now define the format of the block:
12471247+12481248+ 5 Bits: HLIT, # of Literal/Length codes - 257 (257 - 286)
12491249+ 5 Bits: HDIST, # of Distance codes - 1 (1 - 32)
12501250+ 4 Bits: HCLEN, # of Code Length codes - 4 (4 - 19)
12511251+12521252+12531253+12541254+<span class="grey">Deutsch Informational [Page 13]</span></pre>
12551255+<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-14" ></span>
12561256+<span class="grey"><a href="/doc/html/rfc1951">RFC 1951</a> DEFLATE Compressed Data Format Specification May 1996</span>
12571257+12581258+12591259+ (HCLEN + 4) x 3 bits: code lengths for the code length
12601260+ alphabet given just above, in the order: 16, 17, 18,
12611261+ 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15
12621262+12631263+ These code lengths are interpreted as 3-bit integers
12641264+ (0-7); as above, a code length of 0 means the
12651265+ corresponding symbol (literal/length or distance code
12661266+ length) is not used.
12671267+12681268+ HLIT + 257 code lengths for the literal/length alphabet,
12691269+ encoded using the code length Huffman code
12701270+12711271+ HDIST + 1 code lengths for the distance alphabet,
12721272+ encoded using the code length Huffman code
12731273+12741274+ The actual compressed data of the block,
12751275+ encoded using the literal/length and distance Huffman
12761276+ codes
12771277+12781278+ The literal/length symbol 256 (end of data),
12791279+ encoded using the literal/length Huffman code
12801280+12811281+ The code length repeat codes can cross from HLIT + 257 to the
12821282+ HDIST + 1 code lengths. In other words, all code lengths form
12831283+ a single sequence of HLIT + HDIST + 258 values.
12841284+12851285+ 3.3. Compliance
12861286+12871287+ A compressor may limit further the ranges of values specified in
12881288+ the previous section and still be compliant; for example, it may
12891289+ limit the range of backward pointers to some value smaller than
12901290+ 32K. Similarly, a compressor may limit the size of blocks so that
12911291+ a compressible block fits in memory.
12921292+12931293+ A compliant decompressor must accept the full range of possible
12941294+ values defined in the previous section, and must accept blocks of
12951295+ arbitrary size.
12961296+12971297+<span class="h2"><a class="selflink" id="section-4" href="#section-4">4</a>. Compression algorithm details</span>
12981298+12991299+ While it is the intent of this document to define the "deflate"
13001300+ compressed data format without reference to any particular
13011301+ compression algorithm, the format is related to the compressed
13021302+ formats produced by LZ77 (Lempel-Ziv 1977, see reference [<a href="#ref-2" title=""A Universal Algorithm for Sequential Data Compression"">2</a>] below);
13031303+ since many variations of LZ77 are patented, it is strongly
13041304+ recommended that the implementor of a compressor follow the general
13051305+ algorithm presented here, which is known not to be patented per se.
13061306+ The material in this section is not part of the definition of the
13071307+13081308+13091309+13101310+<span class="grey">Deutsch Informational [Page 14]</span></pre>
13111311+<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-15" ></span>
13121312+<span class="grey"><a href="/doc/html/rfc1951">RFC 1951</a> DEFLATE Compressed Data Format Specification May 1996</span>
13131313+13141314+13151315+ specification per se, and a compressor need not follow it in order to
13161316+ be compliant.
13171317+13181318+ The compressor terminates a block when it determines that starting a
13191319+ new block with fresh trees would be useful, or when the block size
13201320+ fills up the compressor's block buffer.
13211321+13221322+ The compressor uses a chained hash table to find duplicated strings,
13231323+ using a hash function that operates on 3-byte sequences. At any
13241324+ given point during compression, let XYZ be the next 3 input bytes to
13251325+ be examined (not necessarily all different, of course). First, the
13261326+ compressor examines the hash chain for XYZ. If the chain is empty,
13271327+ the compressor simply writes out X as a literal byte and advances one
13281328+ byte in the input. If the hash chain is not empty, indicating that
13291329+ the sequence XYZ (or, if we are unlucky, some other 3 bytes with the
13301330+ same hash function value) has occurred recently, the compressor
13311331+ compares all strings on the XYZ hash chain with the actual input data
13321332+ sequence starting at the current point, and selects the longest
13331333+ match.
13341334+13351335+ The compressor searches the hash chains starting with the most recent
13361336+ strings, to favor small distances and thus take advantage of the
13371337+ Huffman encoding. The hash chains are singly linked. There are no
13381338+ deletions from the hash chains; the algorithm simply discards matches
13391339+ that are too old. To avoid a worst-case situation, very long hash
13401340+ chains are arbitrarily truncated at a certain length, determined by a
13411341+ run-time parameter.
13421342+13431343+ To improve overall compression, the compressor optionally defers the
13441344+ selection of matches ("lazy matching"): after a match of length N has
13451345+ been found, the compressor searches for a longer match starting at
13461346+ the next input byte. If it finds a longer match, it truncates the
13471347+ previous match to a length of one (thus producing a single literal
13481348+ byte) and then emits the longer match. Otherwise, it emits the
13491349+ original match, and, as described above, advances N bytes before
13501350+ continuing.
13511351+13521352+ Run-time parameters also control this "lazy match" procedure. If
13531353+ compression ratio is most important, the compressor attempts a
13541354+ complete second search regardless of the length of the first match.
13551355+ In the normal case, if the current match is "long enough", the
13561356+ compressor reduces the search for a longer match, thus speeding up
13571357+ the process. If speed is most important, the compressor inserts new
13581358+ strings in the hash table only when no match was found, or when the
13591359+ match is not "too long". This degrades the compression ratio but
13601360+ saves time since there are both fewer insertions and fewer searches.
13611361+13621362+13631363+13641364+13651365+13661366+<span class="grey">Deutsch Informational [Page 15]</span></pre>
13671367+<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-16" ></span>
13681368+<span class="grey"><a href="/doc/html/rfc1951">RFC 1951</a> DEFLATE Compressed Data Format Specification May 1996</span>
13691369+13701370+13711371+<span class="h2"><a class="selflink" id="section-5" href="#section-5">5</a>. References</span>
13721372+13731373+ [<a id="ref-1">1</a>] Huffman, D. A., "A Method for the Construction of Minimum
13741374+ Redundancy Codes", Proceedings of the Institute of Radio
13751375+ Engineers, September 1952, Volume 40, Number 9, pp. 1098-1101.
13761376+13771377+ [<a id="ref-2">2</a>] Ziv J., Lempel A., "A Universal Algorithm for Sequential Data
13781378+ Compression", IEEE Transactions on Information Theory, Vol. 23,
13791379+ No. 3, pp. 337-343.
13801380+13811381+ [<a id="ref-3">3</a>] Gailly, J.-L., and Adler, M., ZLIB documentation and sources,
13821382+ available in <a href="ftp://ftp.uu.net/pub/archiving/zip/doc/">ftp://ftp.uu.net/pub/archiving/zip/doc/</a>
13831383+13841384+ [<a id="ref-4">4</a>] Gailly, J.-L., and Adler, M., GZIP documentation and sources,
13851385+ available as gzip-*.tar in <a href="ftp://prep.ai.mit.edu/pub/gnu/">ftp://prep.ai.mit.edu/pub/gnu/</a>
13861386+13871387+ [<a id="ref-5">5</a>] Schwartz, E. S., and Kallick, B. "Generating a canonical prefix
13881388+ encoding." Comm. ACM, 7,3 (Mar. 1964), pp. 166-169.
13891389+13901390+ [<a id="ref-6">6</a>] Hirschberg and Lelewer, "Efficient decoding of prefix codes,"
13911391+ Comm. ACM, 33,4, April 1990, pp. 449-459.
13921392+13931393+<span class="h2"><a class="selflink" id="section-6" href="#section-6">6</a>. Security Considerations</span>
13941394+13951395+ Any data compression method involves the reduction of redundancy in
13961396+ the data. Consequently, any corruption of the data is likely to have
13971397+ severe effects and be difficult to correct. Uncompressed text, on
13981398+ the other hand, will probably still be readable despite the presence
13991399+ of some corrupted bytes.
14001400+14011401+ It is recommended that systems using this data format provide some
14021402+ means of validating the integrity of the compressed data. See
14031403+ reference [<a href="#ref-3" title="ZLIB documentation and sources">3</a>], for example.
14041404+14051405+<span class="h2"><a class="selflink" id="section-7" href="#section-7">7</a>. Source code</span>
14061406+14071407+ Source code for a C language implementation of a "deflate" compliant
14081408+ compressor and decompressor is available within the zlib package at
14091409+ <a href="ftp://ftp.uu.net/pub/archiving/zip/zlib/">ftp://ftp.uu.net/pub/archiving/zip/zlib/</a>.
14101410+14111411+<span class="h2"><a class="selflink" id="section-8" href="#section-8">8</a>. Acknowledgements</span>
14121412+14131413+ Trademarks cited in this document are the property of their
14141414+ respective owners.
14151415+14161416+ Phil Katz designed the deflate format. Jean-Loup Gailly and Mark
14171417+ Adler wrote the related software described in this specification.
14181418+ Glenn Randers-Pehrson converted this document to RFC and HTML format.
14191419+14201420+14211421+14221422+<span class="grey">Deutsch Informational [Page 16]</span></pre>
14231423+<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-17" ></span>
14241424+<span class="grey"><a href="/doc/html/rfc1951">RFC 1951</a> DEFLATE Compressed Data Format Specification May 1996</span>
14251425+14261426+14271427+<span class="h2"><a class="selflink" id="section-9" href="#section-9">9</a>. Author's Address</span>
14281428+14291429+ L. Peter Deutsch
14301430+ Aladdin Enterprises
14311431+ 203 Santa Margarita Ave.
14321432+ Menlo Park, CA 94025
14331433+14341434+ Phone: (415) 322-0103 (AM only)
14351435+ FAX: (415) 322-1734
14361436+ EMail: <ghost@aladdin.com>
14371437+14381438+ Questions about the technical content of this specification can be
14391439+ sent by email to:
14401440+14411441+ Jean-Loup Gailly <gzip@prep.ai.mit.edu> and
14421442+ Mark Adler <madler@alumni.caltech.edu>
14431443+14441444+ Editorial comments on this specification can be sent by email to:
14451445+14461446+ L. Peter Deutsch <ghost@aladdin.com> and
14471447+ Glenn Randers-Pehrson <randeg@alumni.rpi.edu>
14481448+14491449+14501450+14511451+14521452+14531453+14541454+14551455+14561456+14571457+14581458+14591459+14601460+14611461+14621462+14631463+14641464+14651465+14661466+14671467+14681468+14691469+14701470+14711471+14721472+14731473+14741474+14751475+14761476+14771477+14781478+Deutsch Informational [Page 17]
14791479+</pre></div>
14801480+ </div>
14811481+14821482+ </div>
14831483+ <div class="d-print-none col-md-3 bg-light-subtle collapse show" id="sidebar">
14841484+ <div class="position-fixed border-start sidebar overflow-scroll overscroll-none no-scrollbar">
14851485+ <div class="d-flex flex-column vh-100 pt-2 pt-lg-3 ps-3 pl-md-2 pl-lg-3">
14861486+ <div>
14871487+ <a class="btn btn-primary btn-sm" href="/doc/rfc1951/">Datatracker</a>
14881488+ <p class="fw-bold pt-2">
14891489+14901490+ RFC 1951
14911491+14921492+ <br>
14931493+14941494+14951495+14961496+14971497+14981498+14991499+<span class="text-success">RFC
15001500+15011501+ - Informational
15021502+15031503+</span>
15041504+15051505+ </p>
15061506+ </div>
15071507+15081508+ <ul class="nav nav-tabs nav-fill small me-2" role="tablist">
15091509+ <li class="nav-item" role="presentation" title="Document information">
15101510+ <button class="nav-link px-2"
15111511+ id="docinfo-tab"
15121512+ data-bs-toggle="tab"
15131513+ data-bs-target="#docinfo-tab-pane"
15141514+ type="button"
15151515+ role="tab"
15161516+ aria-controls="docinfo-tab-pane"
15171517+ aria-selected="true">
15181518+ <i class="bi bi-info-circle"></i><span class="d-none d-md-block d-xl-inline ms-xl-1">Info</span>
15191519+ </button>
15201520+ </li>
15211521+ <li class="nav-item" role="presentation" title="Table of contents">
15221522+ <button class="nav-link px-2"
15231523+ id="toc-tab"
15241524+ data-bs-toggle="tab"
15251525+ data-bs-target="#toc-tab-pane"
15261526+ type="button"
15271527+ role="tab"
15281528+ aria-controls="toc-tab-pane"
15291529+ aria-selected="false">
15301530+ <i class="bi bi-list-ol"></i><span class="d-none d-md-block d-xl-inline ms-xl-1">Contents</span>
15311531+ </button>
15321532+ </li>
15331533+ <li class="nav-item" role="presentation" title="Preferences">
15341534+ <button class="nav-link px-2"
15351535+ id="pref-tab"
15361536+ data-bs-toggle="tab"
15371537+ data-bs-target="#pref-tab-pane"
15381538+ type="button"
15391539+ role="tab"
15401540+ aria-controls="pref-tab-pane"
15411541+ aria-selected="false">
15421542+ <i class="bi bi-gear"></i><span class="d-none d-md-block d-xl-inline ms-xl-1">Prefs</span>
15431543+ </button>
15441544+ </li>
15451545+ </ul>
15461546+ <div class="overflow-auto tab-content pt-2 me-2">
15471547+ <div class="tab-pane"
15481548+ id="docinfo-tab-pane"
15491549+ role="tabpanel"
15501550+ aria-labelledby="docinfo-tab"
15511551+ tabindex="0">
15521552+ <table class="table table-sm table-borderless">
15531553+15541554+15551555+15561556+15571557+15581558+15591559+15601560+15611561+<tbody class="meta align-top ">
15621562+ <tr>
15631563+ <th scope="row">Document</th>
15641564+ <th scope="row">Document type</th>
15651565+ <td class="edit"></td>
15661566+ <td>
15671567+15681568+15691569+15701570+15711571+15721572+15731573+<span class="text-success">RFC
15741574+15751575+ - Informational
15761576+15771577+</span>
15781578+15791579+15801580+15811581+ <br>May 1996
15821582+15831583+ <br>
15841584+15851585+ <a class="btn btn-primary btn-sm my-1"
15861586+ href="https://www.rfc-editor.org/errata_search.php?rfc=1951" title="Click to view errata." rel="nofollow">
15871587+ View errata
15881588+ </a>
15891589+15901590+15911591+ <a class="btn btn-sm btn-warning"
15921592+ title="Click to report an error in the document."
15931593+ href="https://www.rfc-editor.org/errata.php#reportnew"
15941594+ target="_blank">
15951595+ Report errata
15961596+ </a>
15971597+15981598+15991599+16001600+16011601+16021602+16031603+16041604+16051605+16061606+ <div>
16071607+ Was
16081608+ <a href="/doc/draft-deutsch-deflate-spec/03/">draft-deutsch-deflate-spec</a>
16091609+ (individual)
16101610+ </div>
16111611+16121612+16131613+16141614+16151615+16161616+16171617+16181618+16191619+16201620+16211621+ <div class="alert alert-warning small p-2 mt-2" role="alert">
16221622+ This RFC is labeled as "Legacy"; it was published before a formal source was recorded.
16231623+ This RFC is <strong>not endorsed by the IETF</strong> and has <strong>no formal standing</strong> in the
16241624+ <a href="/doc/rfc2026/">IETF standards process</a>.
16251625+ </div>
16261626+16271627+16281628+16291629+16301630+ </td>
16311631+ </tr>
16321632+16331633+ <tr>
16341634+ <td></td>
16351635+ <th scope="row">Select version</th>
16361636+ <td class="edit"></td>
16371637+ <td>
16381638+16391639+16401640+16411641+16421642+ <ul class="revision-list pagination pagination-sm text-center flex-wrap my-0">
16431643+16441644+16451645+16461646+16471647+ <li class="page-item">
16481648+ <a class="page-link"
16491649+ href="/doc/html/draft-deutsch-deflate-spec-03"
16501650+ rel="nofollow">
16511651+ 03
16521652+ </a>
16531653+ </li>
16541654+16551655+16561656+16571657+ <li class="page-item rfc active">
16581658+ <a class="page-link"
16591659+ href="/doc/html/rfc1951">
16601660+ RFC 1951
16611661+ </a>
16621662+ </li>
16631663+16641664+ </ul>
16651665+16661666+ </td>
16671667+ </tr>
16681668+16691669+ <tr>
16701670+ <td></td>
16711671+ <th scope="row">Compare versions</th>
16721672+ <td class="edit"></td>
16731673+ <td>
16741674+16751675+16761676+16771677+16781678+<form class="form-horizontal diff-form"
16791679+ action="https://author-tools.ietf.org/iddiff"
16801680+ method="get"
16811681+ target="_blank">
16821682+16831683+ <select class="form-select form-select-sm mb-1 select2-field"
16841684+ data-max-entries="1"
16851685+ data-width="resolve"
16861686+ data-allow-clear="false"
16871687+ data-minimum-input-length="0"
16881688+ aria-label="From revision"
16891689+ name="url1">
16901690+16911691+ <option value="rfc1951">
16921692+ RFC 1951
16931693+16941694+ </option>
16951695+16961696+ <option value="draft-deutsch-deflate-spec-03" selected>
16971697+ draft-deutsch-deflate-spec-03
16981698+16991699+ </option>
17001700+17011701+ <option value="draft-deutsch-deflate-spec-02">
17021702+ draft-deutsch-deflate-spec-02
17031703+17041704+ </option>
17051705+17061706+ <option value="draft-deutsch-deflate-spec-01">
17071707+ draft-deutsch-deflate-spec-01
17081708+17091709+ </option>
17101710+17111711+ <option value="draft-deutsch-deflate-spec-00">
17121712+ draft-deutsch-deflate-spec-00
17131713+17141714+ </option>
17151715+17161716+17171717+ </select>
17181718+17191719+ <select class="form-select form-select-sm mb-1 select2-field"
17201720+ data-max-entries="1"
17211721+ data-width="resolve"
17221722+ data-allow-clear="false"
17231723+ data-minimum-input-length="0"
17241724+ aria-label="To revision"
17251725+ name="url2">
17261726+17271727+ <option value="rfc1951" selected>
17281728+ RFC 1951
17291729+17301730+ </option>
17311731+17321732+ <option value="draft-deutsch-deflate-spec-03">
17331733+ draft-deutsch-deflate-spec-03
17341734+17351735+ </option>
17361736+17371737+ <option value="draft-deutsch-deflate-spec-02">
17381738+ draft-deutsch-deflate-spec-02
17391739+17401740+ </option>
17411741+17421742+ <option value="draft-deutsch-deflate-spec-01">
17431743+ draft-deutsch-deflate-spec-01
17441744+17451745+ </option>
17461746+17471747+ <option value="draft-deutsch-deflate-spec-00">
17481748+ draft-deutsch-deflate-spec-00
17491749+17501750+ </option>
17511751+17521752+17531753+ </select>
17541754+17551755+ <button type="submit"
17561756+ class="btn btn-primary btn-sm"
17571757+ value="--html"
17581758+ name="difftype">
17591759+ Side-by-side
17601760+ </button>
17611761+17621762+ <button type="submit"
17631763+ class="btn btn-primary btn-sm"
17641764+ value="--hwdiff"
17651765+ name="difftype">
17661766+ Inline
17671767+ </button>
17681768+17691769+</form>
17701770+ </td>
17711771+ </tr>
17721772+17731773+17741774+ <tr>
17751775+ <td></td>
17761776+ <th scope="row">Author</th>
17771777+ <td class="edit">
17781778+17791779+ </td>
17801780+ <td>
17811781+17821782+17831783+ <span ><a
17841784+ title="Datatracker profile of L. Peter Deutsch"
17851785+ href="/person/ghost@aladdin.com" >L. Peter Deutsch</a> <a
17861786+ href="mailto:ghost%40aladdin.com"
17871787+ aria-label="Compose email to ghost@aladdin.com"
17881788+ title="Compose email to ghost@aladdin.com">
17891789+ <i class="bi bi-envelope"></i></a></span>
17901790+17911791+17921792+ <br>
17931793+ <a class="btn btn-primary btn-sm mt-1" href="mailto:rfc1951@ietf.org?subject=rfc1951" title="Send email to the document authors">Email authors</a>
17941794+17951795+ </td>
17961796+ </tr>
17971797+17981798+17991799+ <tr>
18001800+ <td></td>
18011801+ <th scope="row">
18021802+ RFC stream
18031803+ </th>
18041804+ <td class="edit">
18051805+18061806+ </td>
18071807+ <td >
18081808+18091809+18101810+18111811+18121812+ Legacy
18131813+18141814+18151815+18161816+18171817+ </td>
18181818+ </tr>
18191819+18201820+ <tr>
18211821+ <td></td>
18221822+ <th scope="row">
18231823+ Other formats
18241824+ </th>
18251825+ <td class="edit">
18261826+ </td>
18271827+ <td>
18281828+18291829+18301830+ <div class="buttonlist">
18311831+18321832+18331833+ <a class="btn btn-primary btn-sm"
18341834+18351835+ target="_blank"
18361836+ href="https://www.rfc-editor.org/rfc/rfc1951.txt">
18371837+18381838+ <i class="bi bi-file-text"></i> txt
18391839+18401840+ </a>
18411841+18421842+18431843+18441844+ <a class="btn btn-primary btn-sm"
18451845+18461846+ target="_blank"
18471847+ href="https://www.rfc-editor.org/rfc/rfc1951.html">
18481848+18491849+ <i class="bi bi-file-code"></i> html
18501850+18511851+ </a>
18521852+18531853+18541854+18551855+ <a class="btn btn-primary btn-sm"
18561856+18571857+ download="rfc1951.pdf"
18581858+18591859+18601860+ target="_blank"
18611861+ href="https://www.rfc-editor.org/rfc/rfc1951.pdf">
18621862+18631863+ <i class="bi bi-file-pdf"></i> pdf
18641864+18651865+ </a>
18661866+18671867+18681868+18691869+18701870+18711871+ <a class="btn btn-primary btn-sm"
18721872+18731873+ target="_blank"
18741874+ href="/doc/rfc1951/bibtex/">
18751875+18761876+ <i class="bi bi-file-ruled"></i> bibtex
18771877+18781878+ </a>
18791879+18801880+18811881+</div>
18821882+18831883+18841884+ </td>
18851885+ </tr>
18861886+18871887+18881888+18891889+18901890+</tbody>
18911891+ </table>
18921892+ <a class="btn btn-sm btn-warning mb-3"
18931893+ target="_blank"
18941894+ href="https://github.com/ietf-tools/datatracker/issues/new/choose">
18951895+ Report a datatracker bug
18961896+ <i class="bi bi-bug"></i>
18971897+ </a>
18981898+ </div>
18991899+ <div class="tab-pane mb-5"
19001900+ id="toc-tab-pane"
19011901+ role="tabpanel"
19021902+ aria-labelledby="toc-tab"
19031903+ tabindex="0">
19041904+ <nav class="nav nav-pills flex-column small" id="toc-nav">
19051905+ </nav>
19061906+ </div>
19071907+ <div class="tab-pane mb-5 small"
19081908+ id="pref-tab-pane"
19091909+ role="tabpanel"
19101910+ aria-labelledby="pref-tab"
19111911+ tabindex="0">
19121912+ <label class="form-label fw-bold mb-2">Show sidebar by default</label>
19131913+ <div class="btn-group-vertical btn-group-sm d-flex" role="group">
19141914+ <input type="radio" class="btn-check" name="sidebar" id="on-radio">
19151915+ <label class="btn btn-outline-primary" for="on-radio">Yes</label>
19161916+ <input type="radio" class="btn-check" name="sidebar" id="off-radio">
19171917+ <label class="btn btn-outline-primary" for="off-radio">No</label>
19181918+ </div>
19191919+ <label class="form-label fw-bold mt-4 mb-2">Tab to show by default</label>
19201920+ <div class="btn-group-vertical btn-group-sm d-flex" role="group">
19211921+ <input type="radio" class="btn-check" name="deftab" id="docinfo-radio">
19221922+ <label class="btn btn-outline-primary" for="docinfo-radio">
19231923+ <i class="bi bi-info-circle me-1"></i>Info
19241924+ </label>
19251925+ <input type="radio" class="btn-check" name="deftab" id="toc-radio">
19261926+ <label class="btn btn-outline-primary" for="toc-radio">
19271927+ <i class="bi bi-list-ol me-1"></i>Contents
19281928+ </label>
19291929+ </div>
19301930+ <label class="form-label fw-bold mt-4 mb-2">HTMLization configuration</label>
19311931+ <div class="btn-group-vertical btn-group-sm d-flex" role="group">
19321932+ <input type="radio" class="btn-check" name="htmlconf" id="txt-radio">
19331933+ <label class="btn btn-outline-primary" for="txt-radio" title="This is the traditional HTMLization method.">
19341934+ <i class="bi bi-badge-sd me-1"></i>HTMLize the plaintext
19351935+ </label>
19361936+ <input type="radio" class="btn-check" name="htmlconf" id="html-radio">
19371937+ <label class="btn btn-outline-primary" for="html-radio" title="This is the modern HTMLization method.">
19381938+ <i class="bi bi-badge-hd me-1"></i>Plaintextify the HTML
19391939+ </label>
19401940+ </div>
19411941+ <label class="form-label fw-bold mt-4 mb-2" for="ptsize">Maximum font size</label>
19421942+ <input type="range" class="form-range" min="7" max="16" id="ptsize" oninput="ptdemo.value = ptsize.value">
19431943+ <label class="form-label fw-bold mt-4 mb-2">Page dependencies</label>
19441944+ <div class="btn-group-vertical btn-group-sm d-flex" role="group">
19451945+ <input type="radio" class="btn-check" name="pagedeps" id="inline-radio">
19461946+ <label class="btn btn-outline-primary" for="inline-radio" title="Generate larger, standalone web pages that do not require network access to render.">
19471947+ <i class="bi bi-box me-1"></i>Inline
19481948+ </label>
19491949+ <input type="radio" class="btn-check" name="pagedeps" id="reference-radio">
19501950+ <label class="btn btn-outline-primary" for="reference-radio" title="Generate regular web pages that require network access to render.">
19511951+ <i class="bi bi-link-45deg me-1"></i>Reference
19521952+ </label>
19531953+ </div>
19541954+ <label class="form-label fw-bold mt-4 mb-2">Citation links</label>
19551955+ <div class="btn-group-vertical btn-group-sm d-flex" role="group">
19561956+ <input type="radio" class="btn-check" name="reflinks" id="refsection-radio">
19571957+ <label class="btn btn-outline-primary" for="refsection-radio" title="Citation links go to the reference section.">
19581958+ <i class="bi bi-arrow-clockwise"></i> Go to reference section
19591959+ </label>
19601960+ <input type="radio" class="btn-check" name="reflinks" id="citation-radio">
19611961+ <label class="btn btn-outline-primary" for="citation-radio" title="Citation links go directly to the cited document.">
19621962+ <i class="bi bi-link-45deg me-1"></i>Go to linked document
19631963+ </label>
19641964+ </div>
19651965+ </div>
19661966+ </div>
19671967+ </div>
19681968+ </div>
19691969+ </div>
19701970+ </div>
19711971+19721972+<script>
19731973+ var _paq = window._paq || [];
19741974+19751975+ _paq.push(['disableCookies']);
19761976+ _paq.push(['trackPageView']);
19771977+ _paq.push(['enableLinkTracking']);
19781978+ (function() {
19791979+ var u="//analytics.ietf.org/";
19801980+ _paq.push(['setTrackerUrl', u+'matomo.php']);
19811981+ _paq.push(['setSiteId', 7]);
19821982+ var d=document, g=d.createElement('script'), s=d.getElementsByTagName('script')[0];
19831983+ g.type='text/javascript'; g.async=true; g.defer=true; g.src=u+'matomo.js'; s.parentNode.insertBefore(g,s);
19841984+ })();
19851985+</script>
19861986+<noscript><p><img src="//analytics.ietf.org/matomo.php?idsite=7" style="border:0;" alt="" /></p></noscript>
19871987+19881988+ </body>
19891989+</html>
+3597
spec/rfc7616.txt
···11+22+<!DOCTYPE html>
33+44+55+66+77+88+99+1010+<html data-bs-theme="auto" lang="en">
1111+ <head>
1212+1313+ <meta charset="utf-8">
1414+ <meta http-equiv="X-UA-Compatible" content="IE=edge">
1515+ <title>
1616+1717+ RFC 7616 - HTTP Digest Access Authentication
1818+1919+ </title>
2020+ <meta name="viewport" content="width=device-width, initial-scale=1">
2121+ <link href="https://static.ietf.org/fonts/inter/import.css" rel="stylesheet">
2222+ <link href="https://static.ietf.org/fonts/noto-sans-mono/import.css" rel="stylesheet">
2323+2424+ <link rel="stylesheet" href="https://static.ietf.org/dt/12.54.0/ietf/css/document_html_referenced.css">
2525+2626+ <script type="module" crossorigin="" src="https://static.ietf.org/dt/12.54.0/assets/embedded-055c333d.js"></script>
2727+<link href="https://static.ietf.org/dt/12.54.0/assets/create-pinia-singleton-8312c5df.js" type="text/javascript" crossorigin="anonymous" rel="modulepreload" as="script" />
2828+<link href="https://static.ietf.org/dt/12.54.0/assets/Scrollbar-ad8c5330.js" type="text/javascript" crossorigin="anonymous" rel="modulepreload" as="script" />
2929+ <script src="https://static.ietf.org/dt/12.54.0/ietf/js/document_html.js"></script>
3030+ <script src="https://static.ietf.org/dt/12.54.0/ietf/js/theme.js"></script>
3131+3232+ <link rel="alternate" type="application/atom+xml" title="Document changes" href="/feed/document-changes/rfc7616/">
3333+ <meta name="description"
3434+3535+ content="HTTP Digest Access Authentication (RFC 7616, )"
3636+ >
3737+3838+3939+<link rel="apple-touch-icon"
4040+ sizes="180x180"
4141+ href="https://static.ietf.org/dt/12.54.0/ietf/images/ietf-logo-nor-180.png">
4242+<link rel="icon"
4343+ sizes="32x32"
4444+ href="https://static.ietf.org/dt/12.54.0/ietf/images/ietf-logo-nor-32.png">
4545+<link rel="icon"
4646+ sizes="16x16"
4747+ href="https://static.ietf.org/dt/12.54.0/ietf/images/ietf-logo-nor-16.png">
4848+<link rel="manifest" href="/site.webmanifest">
4949+<link rel="mask-icon"
5050+ href="https://static.ietf.org/dt/12.54.0/ietf/images/ietf-logo-nor-mask.svg"
5151+ color="#ffffff">
5252+<meta name="msapplication-TileColor"
5353+ content="#ffffff">
5454+<meta name="theme-color"
5555+ content="#ffffff">
5656+5757+5858+5959+6060+6161+<meta property="og:title" content="RFC 7616: HTTP Digest Access Authentication">
6262+<meta property="og:url" content="https://datatracker.ietf.org/doc/html/rfc7616.txt">
6363+<link rel="canonical" href="https://datatracker.ietf.org/doc/html/rfc7616.txt">
6464+<meta property="og:site_name" content="IETF Datatracker">
6565+<meta property="og:description" content="The Hypertext Transfer Protocol (HTTP) provides a simple challenge- response authentication mechanism that may be used by a server to challenge a client request and by a client to provide authentication information. This document defines the HTTP Digest Authentication scheme that can be used with the HTTP authentication mechanism.">
6666+<meta property="og:type" content="article">
6767+6868+<meta property="og:image" content="https://static.ietf.org/dt/12.54.0/ietf/images/ietf-logo-card.png">
6969+<meta property="og:image:alt" content="Logo of the IETF">
7070+<meta property="article:section" content="IETF - Internet Engineering Task Force">
7171+<meta property="og:image:type" content="image/png">
7272+<meta property="og:image:width" content="1200">
7373+<meta property="og:image:height" content="630">
7474+<meta name="twitter:card" content="summary_large_image">
7575+7676+<meta property="article:author" content="Rifaat Shekh-Yusef">
7777+<meta property="article:author" content="David Ahrens">
7878+<meta property="article:author" content="Sophie Bremer">
7979+8080+8181+8282+8383+ <style>
8484+8585+ .diff-form .select2-selection__rendered {
8686+ direction: rtl;
8787+ text-align: left;
8888+ }
8989+ </style>
9090+ </head>
9191+ <body>
9292+9393+ <noscript><iframe class="status" title="Site status" src="/status/latest"></iframe></noscript>
9494+<div class="vue-embed" data-component="Status"></div>
9595+ <div class="btn-toolbar sidebar-toolbar position-fixed top-0 end-0 m-2 m-lg-3 d-print-none">
9696+ <div class="dropdown">
9797+ <button class="btn btn-outline-secondary btn-sm me-1 dropdown-toggle d-flex align-items-center"
9898+ id="bd-theme" type="button" aria-expanded="false" data-bs-toggle="dropdown"
9999+ aria-label="Toggle theme">
100100+ <i class="theme-icon-active bi bi-circle-half"></i>
101101+ </button>
102102+103103+ <ul class="dropdown-menu" aria-labelledby="bd-theme">
104104+ <li>
105105+ <button type="button" class="dropdown-item d-flex align-items-center"
106106+ data-bs-theme-value="light" aria-pressed="false">
107107+ <i class="me-2 opacity-50 theme-icon bi bi-sun-fill"></i>
108108+ Light<i class="bi bi-check2 ms-auto d-none"></i>
109109+ </button>
110110+ </li>
111111+ <li>
112112+ <button type="button" class="dropdown-item d-flex align-items-center"
113113+ data-bs-theme-value="dark" aria-pressed="false">
114114+ <i class="me-2 opacity-50 theme-icon bi bi-moon-stars-fill"></i>
115115+ Dark<i class="bi bi-check2 ms-auto d-none"></i>
116116+ </button>
117117+ </li>
118118+ <li>
119119+ <button type="button" class="dropdown-item d-flex align-items-center active"
120120+ data-bs-theme-value="auto" aria-pressed="true">
121121+ <i class="me-2 opacity-50 theme-icon bi bi-circle-half"></i>
122122+ Auto<i class="bi bi-check2 ms-auto d-none"></i>
123123+ </button>
124124+ </li>
125125+ </ul>
126126+ </div>
127127+ <button class="btn btn-outline-secondary btn-sm sidebar-toggle"
128128+ type="button"
129129+ data-bs-toggle="collapse"
130130+ data-bs-target="#sidebar"
131131+ aria-expanded="true"
132132+ aria-controls="sidebar"
133133+ aria-label="Toggle metadata sidebar"
134134+ title="Toggle metadata sidebar">
135135+ <i class="bi bi-arrow-bar-left sidebar-shown"></i>
136136+ <i class="bi bi-arrow-bar-right sidebar-collapsed"></i>
137137+ </button>
138138+ </div>
139139+ <nav class="navbar bg-light-subtle px-1 fixed-top d-print-none d-md-none">
140140+ <a class="nav-link ps-1"
141141+ href="/doc/rfc7616/">
142142+143143+ RFC 7616
144144+145145+ <br class="d-sm-none">
146146+147147+ <span class="ms-sm-3 badge rounded-pill badge-ps">
148148+149149+ Proposed Standard
150150+151151+ </span>
152152+ </a>
153153+ <button class="navbar-toggler p-1"
154154+ type="button"
155155+ data-bs-toggle="collapse"
156156+ data-bs-target="#docinfo-collapse"
157157+ aria-controls="docinfo-collapse"
158158+ aria-expanded="false"
159159+ aria-label="Show document information">
160160+ <span class="navbar-toggler-icon small"></span>
161161+ </button>
162162+ <div class="navbar-nav navbar-nav-scroll overscroll-none collapse pt-1" id="docinfo-collapse">
163163+ <div class="bg-light-subtle p-0">
164164+ <table class="table table-sm table-borderless small">
165165+ <tbody class="meta align-top">
166166+ <tr>
167167+ <th scope="row"></th>
168168+ <th scope="row">Title</th>
169169+ <td class="edit"></td>
170170+ <td>HTTP Digest Access Authentication</td>
171171+ </tr>
172172+ </tbody>
173173+174174+175175+176176+177177+178178+179179+180180+181181+<tbody class="meta align-top ">
182182+ <tr>
183183+ <th scope="row">Document</th>
184184+ <th scope="row">Document type</th>
185185+ <td class="edit"></td>
186186+ <td>
187187+188188+189189+190190+191191+192192+193193+<span class="text-success">RFC
194194+195195+ - Proposed Standard
196196+197197+</span>
198198+199199+200200+201201+ <br>September 2015
202202+203203+ <br>
204204+205205+ <a class="btn btn-primary btn-sm my-1"
206206+ href="https://www.rfc-editor.org/errata_search.php?rfc=7616" title="Click to view errata." rel="nofollow">
207207+ View errata
208208+ </a>
209209+210210+211211+ <a class="btn btn-sm btn-warning"
212212+ title="Click to report an error in the document."
213213+ href="https://www.rfc-editor.org/errata.php#reportnew"
214214+ target="_blank">
215215+ Report errata
216216+ </a>
217217+218218+219219+ <a title="Click to view IPR declarations." class="btn btn-warning btn-sm my-1" href="/ipr/search/?submit=draft&id=rfc7616">IPR</a>
220220+221221+222222+223223+ <div>Obsoletes <a href="/doc/html/rfc2617" title="HTTP Authentication: Basic and Digest Access Authentication">RFC 2617</a></div>
224224+225225+226226+227227+228228+ <div>
229229+ Was
230230+ <a href="/doc/draft-ietf-httpauth-digest/19/">draft-ietf-httpauth-digest</a>
231231+ (<a href="/wg/httpauth/about/">httpauth WG</a>)
232232+ </div>
233233+234234+235235+236236+237237+238238+239239+240240+241241+242242+243243+244244+245245+246246+ </td>
247247+ </tr>
248248+249249+ <tr>
250250+ <td></td>
251251+ <th scope="row">Select version</th>
252252+ <td class="edit"></td>
253253+ <td>
254254+255255+256256+257257+258258+ <ul class="revision-list pagination pagination-sm text-center flex-wrap my-0">
259259+260260+261261+262262+263263+ <li class="page-item">
264264+ <a class="page-link"
265265+ href="/doc/html/draft-ietf-httpauth-digest-00"
266266+ rel="nofollow">
267267+ 00
268268+ </a>
269269+ </li>
270270+271271+ <li class="page-item">
272272+ <a class="page-link"
273273+ href="/doc/html/draft-ietf-httpauth-digest-01"
274274+ rel="nofollow">
275275+ 01
276276+ </a>
277277+ </li>
278278+279279+ <li class="page-item">
280280+ <a class="page-link"
281281+ href="/doc/html/draft-ietf-httpauth-digest-02"
282282+ rel="nofollow">
283283+ 02
284284+ </a>
285285+ </li>
286286+287287+ <li class="page-item">
288288+ <a class="page-link"
289289+ href="/doc/html/draft-ietf-httpauth-digest-03"
290290+ rel="nofollow">
291291+ 03
292292+ </a>
293293+ </li>
294294+295295+ <li class="page-item">
296296+ <a class="page-link"
297297+ href="/doc/html/draft-ietf-httpauth-digest-04"
298298+ rel="nofollow">
299299+ 04
300300+ </a>
301301+ </li>
302302+303303+ <li class="page-item">
304304+ <a class="page-link"
305305+ href="/doc/html/draft-ietf-httpauth-digest-05"
306306+ rel="nofollow">
307307+ 05
308308+ </a>
309309+ </li>
310310+311311+ <li class="page-item">
312312+ <a class="page-link"
313313+ href="/doc/html/draft-ietf-httpauth-digest-06"
314314+ rel="nofollow">
315315+ 06
316316+ </a>
317317+ </li>
318318+319319+ <li class="page-item">
320320+ <a class="page-link"
321321+ href="/doc/html/draft-ietf-httpauth-digest-07"
322322+ rel="nofollow">
323323+ 07
324324+ </a>
325325+ </li>
326326+327327+ <li class="page-item">
328328+ <a class="page-link"
329329+ href="/doc/html/draft-ietf-httpauth-digest-08"
330330+ rel="nofollow">
331331+ 08
332332+ </a>
333333+ </li>
334334+335335+ <li class="page-item">
336336+ <a class="page-link"
337337+ href="/doc/html/draft-ietf-httpauth-digest-09"
338338+ rel="nofollow">
339339+ 09
340340+ </a>
341341+ </li>
342342+343343+ <li class="page-item">
344344+ <a class="page-link"
345345+ href="/doc/html/draft-ietf-httpauth-digest-10"
346346+ rel="nofollow">
347347+ 10
348348+ </a>
349349+ </li>
350350+351351+ <li class="page-item">
352352+ <a class="page-link"
353353+ href="/doc/html/draft-ietf-httpauth-digest-11"
354354+ rel="nofollow">
355355+ 11
356356+ </a>
357357+ </li>
358358+359359+ <li class="page-item">
360360+ <a class="page-link"
361361+ href="/doc/html/draft-ietf-httpauth-digest-12"
362362+ rel="nofollow">
363363+ 12
364364+ </a>
365365+ </li>
366366+367367+ <li class="page-item">
368368+ <a class="page-link"
369369+ href="/doc/html/draft-ietf-httpauth-digest-13"
370370+ rel="nofollow">
371371+ 13
372372+ </a>
373373+ </li>
374374+375375+ <li class="page-item">
376376+ <a class="page-link"
377377+ href="/doc/html/draft-ietf-httpauth-digest-14"
378378+ rel="nofollow">
379379+ 14
380380+ </a>
381381+ </li>
382382+383383+ <li class="page-item">
384384+ <a class="page-link"
385385+ href="/doc/html/draft-ietf-httpauth-digest-15"
386386+ rel="nofollow">
387387+ 15
388388+ </a>
389389+ </li>
390390+391391+ <li class="page-item">
392392+ <a class="page-link"
393393+ href="/doc/html/draft-ietf-httpauth-digest-16"
394394+ rel="nofollow">
395395+ 16
396396+ </a>
397397+ </li>
398398+399399+ <li class="page-item">
400400+ <a class="page-link"
401401+ href="/doc/html/draft-ietf-httpauth-digest-17"
402402+ rel="nofollow">
403403+ 17
404404+ </a>
405405+ </li>
406406+407407+ <li class="page-item">
408408+ <a class="page-link"
409409+ href="/doc/html/draft-ietf-httpauth-digest-18"
410410+ rel="nofollow">
411411+ 18
412412+ </a>
413413+ </li>
414414+415415+ <li class="page-item">
416416+ <a class="page-link"
417417+ href="/doc/html/draft-ietf-httpauth-digest-19"
418418+ rel="nofollow">
419419+ 19
420420+ </a>
421421+ </li>
422422+423423+424424+425425+ <li class="page-item rfc active">
426426+ <a class="page-link"
427427+ href="/doc/html/rfc7616">
428428+ RFC 7616
429429+ </a>
430430+ </li>
431431+432432+ </ul>
433433+434434+ </td>
435435+ </tr>
436436+437437+ <tr>
438438+ <td></td>
439439+ <th scope="row">Compare versions</th>
440440+ <td class="edit"></td>
441441+ <td>
442442+443443+444444+445445+446446+<form class="form-horizontal diff-form"
447447+ action="https://author-tools.ietf.org/iddiff"
448448+ method="get"
449449+ target="_blank">
450450+451451+ <select class="form-select form-select-sm mb-1 select2-field"
452452+ data-max-entries="1"
453453+ data-width="resolve"
454454+ data-allow-clear="false"
455455+ data-minimum-input-length="0"
456456+ aria-label="From revision"
457457+ name="url1">
458458+459459+ <option value="rfc7616">
460460+ RFC 7616
461461+462462+ </option>
463463+464464+ <option value="draft-ietf-httpauth-digest-19" selected>
465465+ draft-ietf-httpauth-digest-19
466466+467467+ </option>
468468+469469+ <option value="draft-ietf-httpauth-digest-18">
470470+ draft-ietf-httpauth-digest-18
471471+472472+ </option>
473473+474474+ <option value="draft-ietf-httpauth-digest-17">
475475+ draft-ietf-httpauth-digest-17
476476+477477+ </option>
478478+479479+ <option value="draft-ietf-httpauth-digest-16">
480480+ draft-ietf-httpauth-digest-16
481481+482482+ </option>
483483+484484+ <option value="draft-ietf-httpauth-digest-15">
485485+ draft-ietf-httpauth-digest-15
486486+487487+ </option>
488488+489489+ <option value="draft-ietf-httpauth-digest-14">
490490+ draft-ietf-httpauth-digest-14
491491+492492+ </option>
493493+494494+ <option value="draft-ietf-httpauth-digest-13">
495495+ draft-ietf-httpauth-digest-13
496496+497497+ </option>
498498+499499+ <option value="draft-ietf-httpauth-digest-12">
500500+ draft-ietf-httpauth-digest-12
501501+502502+ </option>
503503+504504+ <option value="draft-ietf-httpauth-digest-11">
505505+ draft-ietf-httpauth-digest-11
506506+507507+ </option>
508508+509509+ <option value="draft-ietf-httpauth-digest-10">
510510+ draft-ietf-httpauth-digest-10
511511+512512+ </option>
513513+514514+ <option value="draft-ietf-httpauth-digest-09">
515515+ draft-ietf-httpauth-digest-09
516516+517517+ </option>
518518+519519+ <option value="draft-ietf-httpauth-digest-08">
520520+ draft-ietf-httpauth-digest-08
521521+522522+ </option>
523523+524524+ <option value="draft-ietf-httpauth-digest-07">
525525+ draft-ietf-httpauth-digest-07
526526+527527+ </option>
528528+529529+ <option value="draft-ietf-httpauth-digest-06">
530530+ draft-ietf-httpauth-digest-06
531531+532532+ </option>
533533+534534+ <option value="draft-ietf-httpauth-digest-05">
535535+ draft-ietf-httpauth-digest-05
536536+537537+ </option>
538538+539539+ <option value="draft-ietf-httpauth-digest-04">
540540+ draft-ietf-httpauth-digest-04
541541+542542+ </option>
543543+544544+ <option value="draft-ietf-httpauth-digest-03">
545545+ draft-ietf-httpauth-digest-03
546546+547547+ </option>
548548+549549+ <option value="draft-ietf-httpauth-digest-02">
550550+ draft-ietf-httpauth-digest-02
551551+552552+ </option>
553553+554554+ <option value="draft-ietf-httpauth-digest-01">
555555+ draft-ietf-httpauth-digest-01
556556+557557+ </option>
558558+559559+ <option value="draft-ietf-httpauth-digest-00">
560560+ draft-ietf-httpauth-digest-00
561561+562562+ </option>
563563+564564+565565+ </select>
566566+567567+ <select class="form-select form-select-sm mb-1 select2-field"
568568+ data-max-entries="1"
569569+ data-width="resolve"
570570+ data-allow-clear="false"
571571+ data-minimum-input-length="0"
572572+ aria-label="To revision"
573573+ name="url2">
574574+575575+ <option value="rfc7616" selected>
576576+ RFC 7616
577577+578578+ </option>
579579+580580+ <option value="draft-ietf-httpauth-digest-19">
581581+ draft-ietf-httpauth-digest-19
582582+583583+ </option>
584584+585585+ <option value="draft-ietf-httpauth-digest-18">
586586+ draft-ietf-httpauth-digest-18
587587+588588+ </option>
589589+590590+ <option value="draft-ietf-httpauth-digest-17">
591591+ draft-ietf-httpauth-digest-17
592592+593593+ </option>
594594+595595+ <option value="draft-ietf-httpauth-digest-16">
596596+ draft-ietf-httpauth-digest-16
597597+598598+ </option>
599599+600600+ <option value="draft-ietf-httpauth-digest-15">
601601+ draft-ietf-httpauth-digest-15
602602+603603+ </option>
604604+605605+ <option value="draft-ietf-httpauth-digest-14">
606606+ draft-ietf-httpauth-digest-14
607607+608608+ </option>
609609+610610+ <option value="draft-ietf-httpauth-digest-13">
611611+ draft-ietf-httpauth-digest-13
612612+613613+ </option>
614614+615615+ <option value="draft-ietf-httpauth-digest-12">
616616+ draft-ietf-httpauth-digest-12
617617+618618+ </option>
619619+620620+ <option value="draft-ietf-httpauth-digest-11">
621621+ draft-ietf-httpauth-digest-11
622622+623623+ </option>
624624+625625+ <option value="draft-ietf-httpauth-digest-10">
626626+ draft-ietf-httpauth-digest-10
627627+628628+ </option>
629629+630630+ <option value="draft-ietf-httpauth-digest-09">
631631+ draft-ietf-httpauth-digest-09
632632+633633+ </option>
634634+635635+ <option value="draft-ietf-httpauth-digest-08">
636636+ draft-ietf-httpauth-digest-08
637637+638638+ </option>
639639+640640+ <option value="draft-ietf-httpauth-digest-07">
641641+ draft-ietf-httpauth-digest-07
642642+643643+ </option>
644644+645645+ <option value="draft-ietf-httpauth-digest-06">
646646+ draft-ietf-httpauth-digest-06
647647+648648+ </option>
649649+650650+ <option value="draft-ietf-httpauth-digest-05">
651651+ draft-ietf-httpauth-digest-05
652652+653653+ </option>
654654+655655+ <option value="draft-ietf-httpauth-digest-04">
656656+ draft-ietf-httpauth-digest-04
657657+658658+ </option>
659659+660660+ <option value="draft-ietf-httpauth-digest-03">
661661+ draft-ietf-httpauth-digest-03
662662+663663+ </option>
664664+665665+ <option value="draft-ietf-httpauth-digest-02">
666666+ draft-ietf-httpauth-digest-02
667667+668668+ </option>
669669+670670+ <option value="draft-ietf-httpauth-digest-01">
671671+ draft-ietf-httpauth-digest-01
672672+673673+ </option>
674674+675675+ <option value="draft-ietf-httpauth-digest-00">
676676+ draft-ietf-httpauth-digest-00
677677+678678+ </option>
679679+680680+681681+ </select>
682682+683683+ <button type="submit"
684684+ class="btn btn-primary btn-sm"
685685+ value="--html"
686686+ name="difftype">
687687+ Side-by-side
688688+ </button>
689689+690690+ <button type="submit"
691691+ class="btn btn-primary btn-sm"
692692+ value="--hwdiff"
693693+ name="difftype">
694694+ Inline
695695+ </button>
696696+697697+</form>
698698+ </td>
699699+ </tr>
700700+701701+702702+ <tr>
703703+ <td></td>
704704+ <th scope="row">Authors</th>
705705+ <td class="edit">
706706+707707+ </td>
708708+ <td>
709709+710710+711711+ <span ><a
712712+ title="Datatracker profile of Rifaat Shekh-Yusef"
713713+ href="/person/rifaat.s.ietf@gmail.com" >Rifaat Shekh-Yusef</a> <a
714714+ href="mailto:rifaat.s.ietf%40gmail.com"
715715+ aria-label="Compose email to rifaat.s.ietf@gmail.com"
716716+ title="Compose email to rifaat.s.ietf@gmail.com">
717717+ <i class="bi bi-envelope"></i></a></span>,
718718+719719+ <span ><a
720720+ title="Datatracker profile of David Ahrens"
721721+ href="/person/ahrensdc@gmail.com" >David Ahrens</a> <a
722722+ href="mailto:ahrensdc%40gmail.com"
723723+ aria-label="Compose email to ahrensdc@gmail.com"
724724+ title="Compose email to ahrensdc@gmail.com">
725725+ <i class="bi bi-envelope"></i></a></span>,
726726+727727+ <span ><a
728728+ title="Datatracker profile of Sophie Bremer"
729729+ href="/person/ietf@sophiebremer.com" >Sophie Bremer</a> <a
730730+ href="mailto:ietf%40sophiebremer.com"
731731+ aria-label="Compose email to ietf@sophiebremer.com"
732732+ title="Compose email to ietf@sophiebremer.com">
733733+ <i class="bi bi-envelope"></i></a></span>
734734+735735+736736+ <br>
737737+ <a class="btn btn-primary btn-sm mt-1" href="mailto:rfc7616@ietf.org?subject=rfc7616" title="Send email to the document authors">Email authors</a>
738738+739739+ </td>
740740+ </tr>
741741+742742+743743+ <tr>
744744+ <td></td>
745745+ <th scope="row">
746746+ RFC stream
747747+ </th>
748748+ <td class="edit">
749749+750750+ </td>
751751+ <td >
752752+753753+754754+755755+756756+757757+758758+759759+760760+<img alt="IETF Logo"
761761+ class="d-lm-none w-25 mt-1"
762762+763763+764764+765765+ src="https://static.ietf.org/dt/12.54.0/ietf/images/ietf-logo-nor-white.svg"
766766+767767+768768+ >
769769+770770+<img alt="IETF Logo"
771771+ class="d-dm-none w-25 mt-1"
772772+773773+774774+775775+ src="https://static.ietf.org/dt/12.54.0/ietf/images/ietf-logo-nor.svg"
776776+777777+778778+ >
779779+780780+781781+782782+783783+ </td>
784784+ </tr>
785785+786786+ <tr>
787787+ <td></td>
788788+ <th scope="row">
789789+ Other formats
790790+ </th>
791791+ <td class="edit">
792792+ </td>
793793+ <td>
794794+795795+796796+ <div class="buttonlist">
797797+798798+799799+ <a class="btn btn-primary btn-sm"
800800+801801+ target="_blank"
802802+ href="https://www.rfc-editor.org/rfc/rfc7616.txt">
803803+804804+ <i class="bi bi-file-text"></i> txt
805805+806806+ </a>
807807+808808+809809+810810+ <a class="btn btn-primary btn-sm"
811811+812812+ target="_blank"
813813+ href="https://www.rfc-editor.org/rfc/rfc7616.html">
814814+815815+ <i class="bi bi-file-code"></i> html
816816+817817+ </a>
818818+819819+820820+821821+ <a class="btn btn-primary btn-sm"
822822+823823+ download="rfc7616.pdf"
824824+825825+826826+ target="_blank"
827827+ href="https://www.rfc-editor.org/rfc/pdfrfc/rfc7616.txt.pdf">
828828+829829+ <i class="bi bi-file-pdf"></i> pdf
830830+831831+ </a>
832832+833833+834834+835835+836836+837837+ <a class="btn btn-primary btn-sm"
838838+839839+ target="_blank"
840840+ href="https://www.rfc-editor.org/rfc/inline-errata/rfc7616.html">
841841+842842+ <i class="bi bi-file-diff"></i> w/errata
843843+844844+ </a>
845845+846846+847847+848848+ <a class="btn btn-primary btn-sm"
849849+850850+ target="_blank"
851851+ href="/doc/rfc7616/bibtex/">
852852+853853+ <i class="bi bi-file-ruled"></i> bibtex
854854+855855+ </a>
856856+857857+858858+</div>
859859+860860+861861+ </td>
862862+ </tr>
863863+864864+865865+866866+ <tr>
867867+ <td>
868868+ </td>
869869+ <th scope="row">
870870+ Additional resources
871871+ </th>
872872+ <td class="edit">
873873+874874+ </td>
875875+ <td>
876876+877877+878878+879879+880880+ <a href="https://mailarchive.ietf.org/arch/browse/http-auth/?q=rfc7616 OR %22draft-ietf-httpauth-digest%22">
881881+ Mailing list discussion
882882+ </a>
883883+884884+885885+886886+ </td>
887887+ </tr>
888888+889889+890890+</tbody>
891891+ <tr>
892892+ <th scope="row"></th>
893893+ <th scope="row"></th>
894894+ <td class="edit"></td>
895895+ <td>
896896+ <a class="btn btn-sm btn-warning mb-3"
897897+ target="_blank"
898898+ href="https://github.com/ietf-tools/datatracker/issues/new/choose">
899899+ Report a bug
900900+ <i class="bi bi-bug"></i>
901901+ </a>
902902+ </td>
903903+ </tr>
904904+ </table>
905905+ </div>
906906+ </div>
907907+ </nav>
908908+ <div class="row g-0">
909909+ <div class="col-md-9 d-flex justify-content-center lh-sm"
910910+ data-bs-spy="scroll"
911911+ data-bs-target="#toc-nav"
912912+ data-bs-smooth-scroll="true"
913913+ tabindex="0"
914914+ id="content">
915915+916916+ <div class="rfcmarkup">
917917+ <br class="noprint">
918918+ <!-- [html-validate-disable-block attr-quotes, void-style, element-permitted-content, heading-level -- FIXME: rfcmarkup/rfc2html generates HTML with issues] -->
919919+ <div class="rfcmarkup"><pre>Internet Engineering Task Force (IETF) R. Shekh-Yusef, Ed.
920920+Request for Comments: 7616 Avaya
921921+Obsoletes: <a href="/doc/html/rfc2617">2617</a> D. Ahrens
922922+Category: Standards Track Independent
923923+ISSN: 2070-1721 S. Bremer
924924+ Netzkonform
925925+ September 2015
926926+927927+928928+ <span class="h1">HTTP Digest Access Authentication</span>
929929+930930+Abstract
931931+932932+ The Hypertext Transfer Protocol (HTTP) provides a simple challenge-
933933+ response authentication mechanism that may be used by a server to
934934+ challenge a client request and by a client to provide authentication
935935+ information. This document defines the HTTP Digest Authentication
936936+ scheme that can be used with the HTTP authentication mechanism.
937937+938938+Status of This Memo
939939+940940+ This is an Internet Standards Track document.
941941+942942+ This document is a product of the Internet Engineering Task Force
943943+ (IETF). It represents the consensus of the IETF community. It has
944944+ received public review and has been approved for publication by the
945945+ Internet Engineering Steering Group (IESG). Further information on
946946+ Internet Standards is available in <a href="/doc/html/rfc5741#section-2">Section 2 of RFC 5741</a>.
947947+948948+ Information about the current status of this document, any errata,
949949+ and how to provide feedback on it may be obtained at
950950+ <a href="http://www.rfc-editor.org/info/rfc7616">http://www.rfc-editor.org/info/rfc7616</a>.
951951+952952+953953+954954+955955+956956+957957+958958+959959+960960+961961+962962+963963+964964+965965+966966+967967+968968+969969+970970+<span class="grey">Shekh-Yusef, et al. Standards Track [Page 1]</span></pre>
971971+<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-2" ></span>
972972+<span class="grey"><a href="/doc/html/rfc7616">RFC 7616</a> HTTP Digest Access Authentication September 2015</span>
973973+974974+975975+Copyright Notice
976976+977977+ Copyright (c) 2015 IETF Trust and the persons identified as the
978978+ document authors. All rights reserved.
979979+980980+ This document is subject to <a href="/doc/html/bcp78">BCP 78</a> and the IETF Trust's Legal
981981+ Provisions Relating to IETF Documents
982982+ (<a href="http://trustee.ietf.org/license-info">http://trustee.ietf.org/license-info</a>) in effect on the date of
983983+ publication of this document. Please review these documents
984984+ carefully, as they describe your rights and restrictions with respect
985985+ to this document. Code Components extracted from this document must
986986+ include Simplified BSD License text as described in Section 4.e of
987987+ the Trust Legal Provisions and are provided without warranty as
988988+ described in the Simplified BSD License.
989989+990990+ This document may contain material from IETF Documents or IETF
991991+ Contributions published or made publicly available before November
992992+ 10, 2008. The person(s) controlling the copyright in some of this
993993+ material may not have granted the IETF Trust the right to allow
994994+ modifications of such material outside the IETF Standards Process.
995995+ Without obtaining an adequate license from the person(s) controlling
996996+ the copyright in such materials, this document may not be modified
997997+ outside the IETF Standards Process, and derivative works of it may
998998+ not be created outside the IETF Standards Process, except to format
999999+ it for publication as an RFC or to translate it into languages other
10001000+ than English.
10011001+10021002+10031003+10041004+10051005+10061006+10071007+10081008+10091009+10101010+10111011+10121012+10131013+10141014+10151015+10161016+10171017+10181018+10191019+10201020+10211021+10221022+10231023+10241024+10251025+10261026+<span class="grey">Shekh-Yusef, et al. Standards Track [Page 2]</span></pre>
10271027+<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-3" ></span>
10281028+<span class="grey"><a href="/doc/html/rfc7616">RFC 7616</a> HTTP Digest Access Authentication September 2015</span>
10291029+10301030+10311031+Table of Contents
10321032+10331033+ <a href="#section-1">1</a>. Introduction . . . . . . . . . . . . . . . . . . . . . . . . <a href="#page-4">4</a>
10341034+ <a href="#section-1.1">1.1</a>. Terminology . . . . . . . . . . . . . . . . . . . . . . . <a href="#page-4">4</a>
10351035+ <a href="#section-2">2</a>. Syntax Convention . . . . . . . . . . . . . . . . . . . . . . <a href="#page-4">4</a>
10361036+ <a href="#section-2.1">2.1</a>. Examples . . . . . . . . . . . . . . . . . . . . . . . . <a href="#page-4">4</a>
10371037+ <a href="#section-2.2">2.2</a>. ABNF . . . . . . . . . . . . . . . . . . . . . . . . . . <a href="#page-4">4</a>
10381038+ <a href="#section-3">3</a>. Digest Access Authentication Scheme . . . . . . . . . . . . . <a href="#page-5">5</a>
10391039+ <a href="#section-3.1">3.1</a>. Overall Operation . . . . . . . . . . . . . . . . . . . . <a href="#page-5">5</a>
10401040+ <a href="#section-3.2">3.2</a>. Representation of Digest Values . . . . . . . . . . . . . <a href="#page-5">5</a>
10411041+ <a href="#section-3.3">3.3</a>. The WWW-Authenticate Response Header Field . . . . . . . <a href="#page-5">5</a>
10421042+ <a href="#section-3.4">3.4</a>. The Authorization Header Field . . . . . . . . . . . . . <a href="#page-9">9</a>
10431043+ <a href="#section-3.4.1">3.4.1</a>. Response . . . . . . . . . . . . . . . . . . . . . . <a href="#page-11">11</a>
10441044+ <a href="#section-3.4.2">3.4.2</a>. A1 . . . . . . . . . . . . . . . . . . . . . . . . . <a href="#page-11">11</a>
10451045+ <a href="#section-3.4.3">3.4.3</a>. A2 . . . . . . . . . . . . . . . . . . . . . . . . . <a href="#page-12">12</a>
10461046+ <a href="#section-3.4.4">3.4.4</a>. Username Hashing . . . . . . . . . . . . . . . . . . <a href="#page-12">12</a>
10471047+ <a href="#section-3.4.5">3.4.5</a>. Parameter Values and Quoted-String . . . . . . . . . <a href="#page-12">12</a>
10481048+ <a href="#section-3.4.6">3.4.6</a>. Various Considerations . . . . . . . . . . . . . . . <a href="#page-13">13</a>
10491049+ 3.5. The Authentication-Info and Proxy-Authentication-Info
10501050+ Header Fields . . . . . . . . . . . . . . . . . . . . . . <a href="#page-14">14</a>
10511051+ <a href="#section-3.6">3.6</a>. Digest Operation . . . . . . . . . . . . . . . . . . . . <a href="#page-15">15</a>
10521052+ <a href="#section-3.7">3.7</a>. Security Protocol Negotiation . . . . . . . . . . . . . . <a href="#page-16">16</a>
10531053+ <a href="#section-3.8">3.8</a>. Proxy-Authenticate and Proxy-Authorization . . . . . . . <a href="#page-17">17</a>
10541054+ <a href="#section-3.9">3.9</a>. Examples . . . . . . . . . . . . . . . . . . . . . . . . <a href="#page-18">18</a>
10551055+ <a href="#section-3.9.1">3.9.1</a>. Example with SHA-256 and MD5 . . . . . . . . . . . . <a href="#page-18">18</a>
10561056+ <a href="#section-3.9.2">3.9.2</a>. Example with SHA-512-256, Charset, and Userhash . . . <a href="#page-19">19</a>
10571057+ <a href="#section-4">4</a>. Internationalization Considerations . . . . . . . . . . . . . <a href="#page-20">20</a>
10581058+ <a href="#section-5">5</a>. Security Considerations . . . . . . . . . . . . . . . . . . . <a href="#page-21">21</a>
10591059+ <a href="#section-5.1">5.1</a>. Limitations . . . . . . . . . . . . . . . . . . . . . . . <a href="#page-21">21</a>
10601060+ <a href="#section-5.2">5.2</a>. Storing Passwords . . . . . . . . . . . . . . . . . . . . <a href="#page-21">21</a>
10611061+ <a href="#section-5.3">5.3</a>. Authentication of Clients Using Digest Authentication . . <a href="#page-22">22</a>
10621062+ <a href="#section-5.4">5.4</a>. Limited-Use Nonce Values . . . . . . . . . . . . . . . . <a href="#page-23">23</a>
10631063+ <a href="#section-5.5">5.5</a>. Replay Attacks . . . . . . . . . . . . . . . . . . . . . <a href="#page-23">23</a>
10641064+ <a href="#section-5.6">5.6</a>. Weakness Created by Multiple Authentication Schemes . . . <a href="#page-24">24</a>
10651065+ <a href="#section-5.7">5.7</a>. Online Dictionary Attacks . . . . . . . . . . . . . . . . <a href="#page-24">24</a>
10661066+ <a href="#section-5.8">5.8</a>. Man-in-the-Middle Attacks . . . . . . . . . . . . . . . . <a href="#page-25">25</a>
10671067+ <a href="#section-5.9">5.9</a>. Chosen Plaintext Attacks . . . . . . . . . . . . . . . . <a href="#page-25">25</a>
10681068+ <a href="#section-5.10">5.10</a>. Precomputed Dictionary Attacks . . . . . . . . . . . . . <a href="#page-26">26</a>
10691069+ <a href="#section-5.11">5.11</a>. Batch Brute-Force Attacks . . . . . . . . . . . . . . . . <a href="#page-26">26</a>
10701070+ <a href="#section-5.12">5.12</a>. Parameter Randomness . . . . . . . . . . . . . . . . . . <a href="#page-26">26</a>
10711071+ <a href="#section-5.13">5.13</a>. Summary . . . . . . . . . . . . . . . . . . . . . . . . . <a href="#page-26">26</a>
10721072+ <a href="#section-6">6</a>. IANA Considerations . . . . . . . . . . . . . . . . . . . . . <a href="#page-27">27</a>
10731073+ <a href="#section-6.1">6.1</a>. Hash Algorithms for HTTP Digest Authentication . . . . . <a href="#page-27">27</a>
10741074+ <a href="#section-6.2">6.2</a>. Digest Scheme Registration . . . . . . . . . . . . . . . <a href="#page-28">28</a>
10751075+ <a href="#section-7">7</a>. References . . . . . . . . . . . . . . . . . . . . . . . . . <a href="#page-28">28</a>
10761076+ <a href="#section-7.1">7.1</a>. Normative References . . . . . . . . . . . . . . . . . . <a href="#page-28">28</a>
10771077+ <a href="#section-7.2">7.2</a>. Informative References . . . . . . . . . . . . . . . . . <a href="#page-30">30</a>
10781078+ <a href="#appendix-A">Appendix A</a>. Changes from <a href="/doc/html/rfc2617">RFC 2617</a> . . . . . . . . . . . . . . . <a href="#page-31">31</a>
10791079+10801080+10811081+10821082+<span class="grey">Shekh-Yusef, et al. Standards Track [Page 3]</span></pre>
10831083+<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-4" ></span>
10841084+<span class="grey"><a href="/doc/html/rfc7616">RFC 7616</a> HTTP Digest Access Authentication September 2015</span>
10851085+10861086+10871087+ Acknowledgments . . . . . . . . . . . . . . . . . . . . . . . . . <a href="#page-31">31</a>
10881088+ Authors' Addresses . . . . . . . . . . . . . . . . . . . . . . . <a href="#page-32">32</a>
10891089+10901090+<span class="h2"><a class="selflink" id="section-1" href="#section-1">1</a>. Introduction</span>
10911091+10921092+ HTTP provides a simple challenge-response authentication mechanism
10931093+ that may be used by a server to challenge a client request and by a
10941094+ client to provide authentication information. This document defines
10951095+ the HTTP Digest Authentication scheme that can be used with the HTTP
10961096+ authentication mechanism.
10971097+10981098+ This document extends but is generally backward compatible with
10991099+ [<a href="/doc/html/rfc2617" title=""HTTP Authentication: Basic and Digest Access Authentication"">RFC2617</a>]. See <a href="#appendix-A">Appendix A</a> for the new capabilities introduced by
11001100+ this specification.
11011101+11021102+ The details of the challenge-response authentication mechanism are
11031103+ specified in the "Hypertext Transfer Protocol (HTTP/1.1):
11041104+ Authentication" [<a href="/doc/html/rfc7235" title=""Hypertext Transfer Protocol (HTTP/1.1): Authentication"">RFC7235</a>].
11051105+11061106+ The combination of this document with the definition of the "Basic"
11071107+ authentication scheme [<a href="/doc/html/rfc7617" title=""The 'Basic' HTTP Authentication Scheme"">RFC7617</a>], "HTTP Authentication-Info and Proxy-
11081108+ Authentication-Info Response Header Fields" [<a href="/doc/html/rfc7615" title=""HTTP Authentication-Info and Proxy- Authentication-Info Response Header Fields"">RFC7615</a>], and "Hypertext
11091109+ Transfer Protocol (HTTP/1.1): Authentication" [<a href="/doc/html/rfc7235" title=""Hypertext Transfer Protocol (HTTP/1.1): Authentication"">RFC7235</a>] obsolete
11101110+ [<a href="/doc/html/rfc2617" title=""HTTP Authentication: Basic and Digest Access Authentication"">RFC2617</a>].
11111111+11121112+<span class="h3"><a class="selflink" id="section-1.1" href="#section-1.1">1.1</a>. Terminology</span>
11131113+11141114+ The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT",
11151115+ "SHOULD", "SHOULD NOT", "RECOMMENDED", "NOT RECOMMENDED", "MAY", and
11161116+ "OPTIONAL" in this document are to be interpreted as described in
11171117+ [<a href="/doc/html/rfc2119" title=""Key words for use in RFCs to Indicate Requirement Levels"">RFC2119</a>].
11181118+11191119+<span class="h2"><a class="selflink" id="section-2" href="#section-2">2</a>. Syntax Convention</span>
11201120+11211121+<span class="h3"><a class="selflink" id="section-2.1" href="#section-2.1">2.1</a>. Examples</span>
11221122+11231123+ In the interest of clarity and readability, the extended parameters
11241124+ or the header fields and parameters in the examples in this document
11251125+ might be broken into multiple lines. Any line that is indented in
11261126+ this document is a continuation of the preceding line.
11271127+11281128+<span class="h3"><a class="selflink" id="section-2.2" href="#section-2.2">2.2</a>. ABNF</span>
11291129+11301130+ This specification uses the Augmented Backus-Naur Form (ABNF)
11311131+ notation of [<a href="/doc/html/rfc5234" title=""Augmented BNF for Syntax Specifications: ABNF"">RFC5234</a>] and the ABNF List Extension of [<a href="/doc/html/rfc7230" title=""Hypertext Transfer Protocol (HTTP/1.1): Message Syntax and Routing"">RFC7230</a>].
11321132+11331133+11341134+11351135+11361136+11371137+11381138+<span class="grey">Shekh-Yusef, et al. Standards Track [Page 4]</span></pre>
11391139+<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-5" ></span>
11401140+<span class="grey"><a href="/doc/html/rfc7616">RFC 7616</a> HTTP Digest Access Authentication September 2015</span>
11411141+11421142+11431143+<span class="h2"><a class="selflink" id="section-3" href="#section-3">3</a>. Digest Access Authentication Scheme</span>
11441144+11451145+<span class="h3"><a class="selflink" id="section-3.1" href="#section-3.1">3.1</a>. Overall Operation</span>
11461146+11471147+ The Digest scheme is based on a simple challenge-response paradigm.
11481148+ The Digest scheme challenges using a nonce value and might indicate
11491149+ that username hashing is supported. A valid response contains an
11501150+ unkeyed digest of the username, the password, the given nonce value,
11511151+ the HTTP method, and the requested URI. In this way, the password is
11521152+ never sent in the clear, and the username can be hashed, depending on
11531153+ the indication received from the server. The username and password
11541154+ must be prearranged in some fashion not addressed by this document.
11551155+11561156+<span class="h3"><a class="selflink" id="section-3.2" href="#section-3.2">3.2</a>. Representation of Digest Values</span>
11571157+11581158+ An optional header field allows the server to specify the algorithm
11591159+ used to create the unkeyed digest or digest. This document adds
11601160+ SHA-256 and SHA-512/256 algorithms. To maintain backwards
11611161+ compatibility with [<a href="/doc/html/rfc2617" title=""HTTP Authentication: Basic and Digest Access Authentication"">RFC2617</a>], the MD5 algorithm is still supported
11621162+ but NOT RECOMMENDED.
11631163+11641164+ The size of the digest depends on the algorithm used. The bits in
11651165+ the digest are converted from the most significant to the least
11661166+ significant bit, four bits at a time, to the ASCII representation as
11671167+ follows. Each sequence of four bits is represented by its familiar
11681168+ hexadecimal notation from the characters 0123456789abcdef; that is,
11691169+ binary 0000 is represented by the character '0', 0001 by '1' and so
11701170+ on up to the representation of 1111 as 'f'. If the MD5 algorithm is
11711171+ used to calculate the digest, then the MD5 digest will be represented
11721172+ as 32 hexadecimal characters, while SHA-256 and SHA-512/256 are
11731173+ represented as 64 hexadecimal characters.
11741174+11751175+<span class="h3"><a class="selflink" id="section-3.3" href="#section-3.3">3.3</a>. The WWW-Authenticate Response Header Field</span>
11761176+11771177+ If a server receives a request for an access-protected object, and an
11781178+ acceptable Authorization header field is not sent, the server
11791179+ responds with a "401 Unauthorized" status code and a WWW-Authenticate
11801180+ header field with Digest scheme as per the framework defined above.
11811181+ The value of the header field can include parameters from the
11821182+ following list:
11831183+11841184+ realm
11851185+11861186+ A string to be displayed to users so they know which username and
11871187+ password to use. This string should contain at least the name of
11881188+ the host performing the authentication and might additionally
11891189+ indicate the collection of users who might have access. An
11901190+11911191+11921192+11931193+11941194+<span class="grey">Shekh-Yusef, et al. Standards Track [Page 5]</span></pre>
11951195+<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-6" ></span>
11961196+<span class="grey"><a href="/doc/html/rfc7616">RFC 7616</a> HTTP Digest Access Authentication September 2015</span>
11971197+11981198+11991199+ example is "registered_users@example.com". (See <a href="/doc/html/rfc7235#section-2.2">Section 2.2 of
12001200+ [RFC7235]</a> for more details.)
12011201+12021202+ domain
12031203+12041204+ A quoted, space-separated list of URIs, as specified in [<a href="/doc/html/rfc3986" title=""Uniform Resource Identifier (URI): Generic Syntax"">RFC3986</a>],
12051205+ that define the protection space. If a URI is a path-absolute, it
12061206+ is relative to the canonical root URL. (See <a href="/doc/html/rfc7235#section-2.2">Section 2.2 of
12071207+ [RFC7235]</a>.) An absolute-URI in this list may refer to a different
12081208+ server than the web-origin [<a href="/doc/html/rfc6454" title=""The Web Origin Concept"">RFC6454</a>]. The client can use this
12091209+ list to determine the set of URIs for which the same
12101210+ authentication information may be sent: any URI that has a URI in
12111211+ this list as a prefix (after both have been made absolute) MAY be
12121212+ assumed to be in the same protection space. If this parameter is
12131213+ omitted or its value is empty, the client SHOULD assume that the
12141214+ protection space consists of all URIs on the web-origin.
12151215+12161216+ This parameter is not meaningful in Proxy-Authenticate header
12171217+ fields, for which the protection space is always the entire proxy;
12181218+ if present, it MUST be ignored.
12191219+12201220+ nonce
12211221+12221222+ A server-specified string which should be uniquely generated each
12231223+ time a 401 response is made. It is advised that this string be
12241224+ Base64 or hexadecimal data. Specifically, since the string is
12251225+ passed in the header field lines as a quoted string, the double-
12261226+ quote character is not allowed, unless suitably escaped.
12271227+12281228+ The contents of the nonce are implementation dependent. The
12291229+ quality of the implementation depends on a good choice. A nonce
12301230+ might, for example, be constructed as the Base64 encoding of
12311231+12321232+ timestamp H(timestamp ":" ETag ":" secret-data)
12331233+12341234+ where timestamp is a server-generated time, which preferably
12351235+ includes micro- or nanoseconds, or other non-repeating values;
12361236+ ETag is the value of the HTTP ETag header field associated with
12371237+ the requested entity; and secret-data is data known only to the
12381238+ server. With a nonce of this form, a server would recalculate the
12391239+ hash portion after receiving the client authentication header
12401240+ field and reject the request if it did not match the nonce from
12411241+ that header field or if the timestamp value is not recent enough.
12421242+ In this way, the server can limit the time of the nonce's
12431243+ validity. The inclusion of the ETag prevents a replay request for
12441244+ an updated version of the resource. Including the IP address of
12451245+ the client in the nonce would appear to offer the server the
12461246+ ability to limit the reuse of the nonce to the same client that
12471247+12481248+12491249+12501250+<span class="grey">Shekh-Yusef, et al. Standards Track [Page 6]</span></pre>
12511251+<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-7" ></span>
12521252+<span class="grey"><a href="/doc/html/rfc7616">RFC 7616</a> HTTP Digest Access Authentication September 2015</span>
12531253+12541254+12551255+ originally got it. However, that would break because requests
12561256+ from a single user often go through different proxies. Also, IP
12571257+ address spoofing is not that hard.
12581258+12591259+ An implementation might choose not to accept a previously used
12601260+ nonce or a previously used digest, in order to protect against a
12611261+ replay attack. Or, an implementation might choose to use one-time
12621262+ nonces or digests for POST or PUT requests and a timestamp for GET
12631263+ requests. For more details on the issues involved, see <a href="#section-5">Section 5</a>
12641264+ of this document.
12651265+12661266+ The nonce is opaque to the client.
12671267+12681268+ opaque
12691269+12701270+ A string of data, specified by the server, that SHOULD be returned
12711271+ by the client unchanged in the Authorization header field of
12721272+ subsequent requests with URIs in the same protection space. It is
12731273+ RECOMMENDED that this string be Base64 or hexadecimal data.
12741274+12751275+ stale
12761276+12771277+ A case-insensitive flag indicating that the previous request from
12781278+ the client was rejected because the nonce value was stale. If
12791279+ stale is true, the client may wish to simply retry the request
12801280+ with a new encrypted response, without re-prompting the user for a
12811281+ new username and password. The server SHOULD only set stale to
12821282+ true if it receives a request for which the nonce is invalid. If
12831283+ stale is false, or anything other than true, or the stale
12841284+ parameter is not present, the username and/or password are
12851285+ invalid, and new values MUST be obtained.
12861286+12871287+ algorithm
12881288+12891289+ A string indicating an algorithm used to produce the digest and an
12901290+ unkeyed digest. If this is not present, it is assumed to be
12911291+ "MD5". If the algorithm is not understood, the challenge SHOULD
12921292+ be ignored (and a different one used, if there is more than one).
12931293+12941294+ When used with the Digest mechanism, each one of the algorithms
12951295+ has two variants: Session variant and non-Session variant. The
12961296+ non-Session variant is denoted by "<algorithm>", e.g., "SHA-256",
12971297+ and the Session variant is denoted by "<algorithm>-sess", e.g.,
12981298+ "SHA-256-sess".
12991299+13001300+ In this document, the string obtained by applying the digest
13011301+ algorithm to the data "data" with secret "secret" will be denoted
13021302+ by KD(secret, data), and the string obtained by applying the
13031303+13041304+13051305+13061306+<span class="grey">Shekh-Yusef, et al. Standards Track [Page 7]</span></pre>
13071307+<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-8" ></span>
13081308+<span class="grey"><a href="/doc/html/rfc7616">RFC 7616</a> HTTP Digest Access Authentication September 2015</span>
13091309+13101310+13111311+ unkeyed digest algorithm to the data "data" will be denoted
13121312+ H(data). KD stands for Keyed Digest, and the notation unq(X)
13131313+ means the value of the quoted-string X without the surrounding
13141314+ quotes and with quoting slashes removed.
13151315+13161316+ For "<algorithm>" and "<algorithm>-sess"
13171317+13181318+ H(data) = <algorithm>(data)
13191319+13201320+ and
13211321+13221322+ KD(secret, data) = H(concat(secret, ":", data))
13231323+13241324+ For example:
13251325+13261326+ For the "SHA-256" and "SHA-256-sess" algorithms
13271327+13281328+ H(data) = SHA-256(data)
13291329+13301330+ i.e., the digest is the "<algorithm>" of the secret concatenated
13311331+ with a colon concatenated with the data. The "<algorithm>-sess"
13321332+ is intended to allow efficient third-party authentication servers;
13331333+ for the difference in usage, see the description in <a href="#section-3.4.2">Section 3.4.2</a>.
13341334+13351335+ qop
13361336+13371337+ This parameter MUST be used by all implementations. It is a
13381338+ quoted string of one or more tokens indicating the "quality of
13391339+ protection" values supported by the server. The value "auth"
13401340+ indicates authentication; the value "auth-int" indicates
13411341+ authentication with integrity protection. See the descriptions
13421342+ below for calculating the response parameter value for the
13431343+ application of this choice. Unrecognized options MUST be ignored.
13441344+13451345+ charset
13461346+13471347+ This is an OPTIONAL parameter that is used by the server to
13481348+ indicate the encoding scheme it supports. The only allowed value
13491349+ is "UTF-8".
13501350+13511351+ userhash
13521352+13531353+ This is an OPTIONAL parameter that is used by the server to
13541354+ indicate that it supports username hashing. Valid values are:
13551355+ "true" or "false". Default value is "false".
13561356+13571357+13581358+13591359+13601360+13611361+13621362+<span class="grey">Shekh-Yusef, et al. Standards Track [Page 8]</span></pre>
13631363+<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-9" ></span>
13641364+<span class="grey"><a href="/doc/html/rfc7616">RFC 7616</a> HTTP Digest Access Authentication September 2015</span>
13651365+13661366+13671367+ For historical reasons, a sender MUST only generate the quoted string
13681368+ syntax values for the following parameters: realm, domain, nonce,
13691369+ opaque, and qop.
13701370+13711371+ For historical reasons, a sender MUST NOT generate the quoted string
13721372+ syntax values for the following parameters: stale and algorithm.
13731373+13741374+<span class="h3"><a class="selflink" id="section-3.4" href="#section-3.4">3.4</a>. The Authorization Header Field</span>
13751375+13761376+ The client is expected to retry the request, passing an Authorization
13771377+ header field line with Digest scheme, which is defined according to
13781378+ the framework above. The values of the opaque and algorithm fields
13791379+ must be those supplied in the WWW-Authenticate response header field
13801380+ for the entity being requested.
13811381+13821382+ The request can include parameters from the following list:
13831383+13841384+ response
13851385+13861386+ A string of the hex digits computed as defined below; it proves
13871387+ that the user knows a password.
13881388+13891389+ username
13901390+13911391+ The user's name in the specified realm. The quoted string
13921392+ contains the name in plaintext or the hash code in hexadecimal
13931393+ notation. If the username contains characters not allowed inside
13941394+ the ABNF quoted-string production, the username* parameter can be
13951395+ used. Sending both username and username* in the same header
13961396+ option MUST be treated as an error.
13971397+13981398+ username*
13991399+14001400+ If the userhash parameter value is set "false" and the username
14011401+ contains characters not allowed inside the ABNF quoted-string
14021402+ production, the user's name can be sent with this parameter, using
14031403+ the extended notation defined in [<a href="/doc/html/rfc5987" title=""Character Set and Language Encoding for Hypertext Transfer Protocol (HTTP) Header Field Parameters"">RFC5987</a>].
14041404+14051405+ realm
14061406+14071407+ See "realm" definition in <a href="#section-3.3">Section 3.3</a>.
14081408+14091409+ uri
14101410+14111411+ The Effective Request URI (<a href="/doc/html/rfc7230#section-5.5">Section 5.5 of [RFC7230]</a>) of the HTTP
14121412+ request; duplicated here because proxies are allowed to change the
14131413+ request target ("request-target", <a href="/doc/html/rfc7230#section-3.1.1">Section 3.1.1 of [RFC7230]</a>) in
14141414+ transit.
14151415+14161416+14171417+14181418+<span class="grey">Shekh-Yusef, et al. Standards Track [Page 9]</span></pre>
14191419+<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-10" ></span>
14201420+<span class="grey"><a href="/doc/html/rfc7616">RFC 7616</a> HTTP Digest Access Authentication September 2015</span>
14211421+14221422+14231423+ qop
14241424+14251425+ Indicates what "quality of protection" the client has applied to
14261426+ the message. Its value MUST be one of the alternatives the server
14271427+ indicated it supports in the WWW-Authenticate header field. These
14281428+ values affect the computation of the response. Note that this is
14291429+ a single token, not a quoted list of alternatives as in WWW-
14301430+ Authenticate.
14311431+14321432+ cnonce
14331433+14341434+ This parameter MUST be used by all implementations. The cnonce
14351435+ value is an opaque quoted ASCII-only string value provided by the
14361436+ client and used by both client and server to avoid chosen
14371437+ plaintext attacks, to provide mutual authentication, and to
14381438+ provide some message integrity protection. See the descriptions
14391439+ below of the calculation of the rspauth and response values.
14401440+14411441+ nc
14421442+14431443+ This parameter MUST be used by all implementations. The nc
14441444+ parameter stands for "nonce count". The nc value is the
14451445+ hexadecimal count of the number of requests (including the current
14461446+ request) that the client has sent with the nonce value in this
14471447+ request. For example, in the first request sent in response to a
14481448+ given nonce value, the client sends "nc=00000001". The purpose of
14491449+ this parameter is to allow the server to detect request replays by
14501450+ maintaining its own copy of this count -- if the same nc value is
14511451+ seen twice, then the request is a replay. See the description
14521452+ below of the construction of the response value.
14531453+14541454+ userhash
14551455+14561456+ This OPTIONAL parameter is used by the client to indicate that the
14571457+ username has been hashed. Valid values are: "true" or "false".
14581458+ Default value is "false".
14591459+14601460+ For historical reasons, a sender MUST only generate the quoted string
14611461+ syntax for the following parameters: username, realm, nonce, uri,
14621462+ response, cnonce, and opaque.
14631463+14641464+ For historical reasons, a sender MUST NOT generate the quoted string
14651465+ syntax for the following parameters: algorithm, qop, and nc.
14661466+14671467+ If a parameter or its value is improper, or required parameters are
14681468+ missing, the proper response is a 4xx error code. If the response is
14691469+ invalid, then a login failure SHOULD be logged, since repeated login
14701470+ failures from a single client may indicate an attacker attempting to
14711471+14721472+14731473+14741474+<span class="grey">Shekh-Yusef, et al. Standards Track [Page 10]</span></pre>
14751475+<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-11" ></span>
14761476+<span class="grey"><a href="/doc/html/rfc7616">RFC 7616</a> HTTP Digest Access Authentication September 2015</span>
14771477+14781478+14791479+ guess passwords. The server implementation SHOULD be careful with
14801480+ the information being logged so that it won't put a cleartext
14811481+ password (e.g., entered into the username field) into the log.
14821482+14831483+ The definition of the response above indicates the encoding for its
14841484+ value. The following definitions show how the value is computed.
14851485+14861486+<span class="h4"><a class="selflink" id="section-3.4.1" href="#section-3.4.1">3.4.1</a>. Response</span>
14871487+14881488+ If the qop value is "auth" or "auth-int":
14891489+14901490+ response = <"> < KD ( H(A1), unq(nonce)
14911491+ ":" nc
14921492+ ":" unq(cnonce)
14931493+ ":" unq(qop)
14941494+ ":" H(A2)
14951495+ ) <">
14961496+14971497+ See below for the definitions for A1 and A2.
14981498+14991499+<span class="h4"><a class="selflink" id="section-3.4.2" href="#section-3.4.2">3.4.2</a>. A1</span>
15001500+15011501+ If the algorithm parameter's value is "<algorithm>", e.g., "SHA-256",
15021502+ then A1 is:
15031503+15041504+ A1 = unq(username) ":" unq(realm) ":" passwd
15051505+15061506+ where
15071507+15081508+ passwd = < user's password >
15091509+15101510+ If the algorithm parameter's value is "<algorithm>-sess", e.g., "SHA-
15111511+ 256-sess", then A1 is calculated using the nonce value provided in
15121512+ the challenge from the server, and cnonce value from the request by
15131513+ the client following receipt of a WWW-Authenticate challenge from the
15141514+ server. It uses the server nonce from that challenge, herein called
15151515+ nonce-prime, and the client nonce value from the response, herein
15161516+ called cnonce-prime, to construct A1 as follows:
15171517+15181518+ A1 = H( unq(username) ":" unq(realm) ":" passwd )
15191519+ ":" unq(nonce-prime) ":" unq(cnonce-prime)
15201520+15211521+ This creates a "session key" for the authentication of subsequent
15221522+ requests and responses that is different for each "authentication
15231523+ session", thus limiting the amount of material hashed with any one
15241524+ key. (Note: see further discussion of the authentication session in
15251525+ <a href="#section-3.6">Section 3.6</a>.) Because the server needs only use the hash of the user
15261526+ credentials in order to create the A1 value, this construction could
15271527+15281528+15291529+15301530+<span class="grey">Shekh-Yusef, et al. Standards Track [Page 11]</span></pre>
15311531+<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-12" ></span>
15321532+<span class="grey"><a href="/doc/html/rfc7616">RFC 7616</a> HTTP Digest Access Authentication September 2015</span>
15331533+15341534+15351535+ be used in conjunction with a third-party authentication service so
15361536+ that the web server would not need the actual password value. The
15371537+ specification of such a protocol is beyond the scope of this
15381538+ specification.
15391539+15401540+<span class="h4"><a class="selflink" id="section-3.4.3" href="#section-3.4.3">3.4.3</a>. A2</span>
15411541+15421542+ If the qop parameter's value is "auth" or is unspecified, then A2 is:
15431543+15441544+ A2 = Method ":" request-uri
15451545+15461546+ If the qop value is "auth-int", then A2 is:
15471547+15481548+ A2 = Method ":" request-uri ":" H(entity-body)
15491549+15501550+<span class="h4"><a class="selflink" id="section-3.4.4" href="#section-3.4.4">3.4.4</a>. Username Hashing</span>
15511551+15521552+ To protect the transport of the username from the client to the
15531553+ server, the server SHOULD set the userhash parameter with the value
15541554+ of "true" in the WWW-Authentication header field.
15551555+15561556+ If the client supports the userhash parameter, and the userhash
15571557+ parameter value in the WWW-Authentication header field is set to
15581558+ "true", then the client MUST calculate a hash of the username after
15591559+ any other hash calculation and include the userhash parameter with
15601560+ the value of "true" in the Authorization header field. If the client
15611561+ does not provide the username as a hash value or the userhash
15621562+ parameter with the value of "true", the server MAY reject the
15631563+ request.
15641564+15651565+ The following is the operation that the client will perform to hash
15661566+ the username, using the same algorithm used to hash the credentials:
15671567+15681568+ username = H( unq(username) ":" unq(realm) )
15691569+15701570+<span class="h4"><a class="selflink" id="section-3.4.5" href="#section-3.4.5">3.4.5</a>. Parameter Values and Quoted-String</span>
15711571+15721572+ Note that the value of many of the parameters, such as username
15731573+ value, are defined as a "quoted-string". However, the "unq" notation
15741574+ indicates that surrounding quotation marks are removed in forming the
15751575+ string A1. Thus, if the Authorization header field includes the
15761576+ fields
15771577+15781578+ username="Mufasa", realm="myhost@example.com"
15791579+15801580+ and the user Mufasa has password "Circle Of Life", then H(A1) would
15811581+ be H(Mufasa:myhost@example.com:Circle Of Life) with no quotation
15821582+ marks in the digested string.
15831583+15841584+15851585+15861586+<span class="grey">Shekh-Yusef, et al. Standards Track [Page 12]</span></pre>
15871587+<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-13" ></span>
15881588+<span class="grey"><a href="/doc/html/rfc7616">RFC 7616</a> HTTP Digest Access Authentication September 2015</span>
15891589+15901590+15911591+ No white space is allowed in any of the strings to which the digest
15921592+ function H() is applied, unless that white space exists in the quoted
15931593+ strings or entity body whose contents make up the string to be
15941594+ digested. For example, the string A1 illustrated above must be
15951595+15961596+ Mufasa:myhost@example.com:Circle Of Life
15971597+15981598+ with no white space on either side of the colons, but with the white
15991599+ space between the words used in the password value. Likewise, the
16001600+ other strings digested by H() must not have white space on either
16011601+ side of the colons that delimit their fields, unless that white space
16021602+ was in the quoted strings or entity body being digested.
16031603+16041604+ Also, note that if integrity protection is applied (qop=auth-int),
16051605+ the H(entity-body) is the hash of the entity body, not the message
16061606+ body -- it is computed before any transfer encoding is applied by the
16071607+ sender and after it has been removed by the recipient. Note that
16081608+ this includes multipart boundaries and embedded header fields in each
16091609+ part of any multipart content-type.
16101610+16111611+<span class="h4"><a class="selflink" id="section-3.4.6" href="#section-3.4.6">3.4.6</a>. Various Considerations</span>
16121612+16131613+ The "Method" value is the HTTP request method, in US-ASCII letters,
16141614+ as specified in <a href="/doc/html/rfc7230#section-3.1.1">Section 3.1.1 of [RFC7230]</a>. The "request-target"
16151615+ value is the request-target from the request line as specified in
16161616+ <a href="/doc/html/rfc7230#section-3.1.1">Section 3.1.1 of [RFC7230]</a>. This MAY be "*", an "absolute-URI", or
16171617+ an "absolute-path" as specified in <a href="/doc/html/rfc7230#section-2.7">Section 2.7 of [RFC7230]</a>, but it
16181618+ MUST agree with the request-target. In particular, it MUST be an
16191619+ "absolute-URI" if the request-target is an "absolute-URI". The
16201620+ cnonce value is a client-chosen value whose purpose is to foil chosen
16211621+ plaintext attacks.
16221622+16231623+ The authenticating server MUST assure that the resource designated by
16241624+ the "uri" parameter is the same as the resource specified in the
16251625+ Request-Line; if they are not, the server SHOULD return a 400 Bad
16261626+ Request error. (Since this may be a symptom of an attack, server
16271627+ implementers may want to consider logging such errors.) The purpose
16281628+ of duplicating information from the request URL in this field is to
16291629+ deal with the possibility that an intermediate proxy may alter the
16301630+ client's Request-Line. This altered (but presumably semantically
16311631+ equivalent) request would not result in the same digest as that
16321632+ calculated by the client.
16331633+16341634+ Implementers should be aware of how authenticated transactions need
16351635+ to interact with shared caches (see [<a href="/doc/html/rfc7234" title=""Hypertext Transfer Protocol (HTTP/1.1): Caching"">RFC7234</a>]).
16361636+16371637+16381638+16391639+16401640+16411641+16421642+<span class="grey">Shekh-Yusef, et al. Standards Track [Page 13]</span></pre>
16431643+<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-14" ></span>
16441644+<span class="grey"><a href="/doc/html/rfc7616">RFC 7616</a> HTTP Digest Access Authentication September 2015</span>
16451645+16461646+16471647+<span class="h3"><a class="selflink" id="section-3.5" href="#section-3.5">3.5</a>. The Authentication-Info and Proxy-Authentication-Info Header</span>
16481648+<span class="h3"> Fields</span>
16491649+16501650+ The Authentication-Info header field and the Proxy-Authentication-
16511651+ Info header field [<a href="/doc/html/rfc7615" title=""HTTP Authentication-Info and Proxy- Authentication-Info Response Header Fields"">RFC7615</a>] are generic fields that MAY be used by a
16521652+ server to communicate some information regarding the successful
16531653+ authentication of a client response.
16541654+16551655+ The Digest Authentication scheme MAY add the Authentication-Info
16561656+ header field in the confirmation request and include parameters from
16571657+ the following list:
16581658+16591659+ nextnonce
16601660+16611661+ The value of the nextnonce parameter is the nonce the server
16621662+ wishes the client to use for a future authentication response.
16631663+ The server MAY send the Authentication-Info header field with a
16641664+ nextnonce field as a means of implementing one-time nonces or
16651665+ otherwise changing nonces. If the nextnonce field is present, the
16661666+ client SHOULD use it when constructing the Authorization header
16671667+ field for its next request. Failure of the client to do so MAY
16681668+ result in a request to re-authenticate from the server with the
16691669+ "stale=true".
16701670+16711671+ Server implementations SHOULD carefully consider the
16721672+ performance implications of the use of this mechanism;
16731673+ pipelined requests will not be possible if every response
16741674+ includes a nextnonce parameter that MUST be used on the next
16751675+ request received by the server. Consideration SHOULD be given
16761676+ to the performance vs. security tradeoffs of allowing an old
16771677+ nonce value to be used for a limited time to permit request
16781678+ pipelining. Use of the nc parameter can retain most of the
16791679+ security advantages of a new server nonce without the
16801680+ deleterious effects on pipelining.
16811681+16821682+ qop
16831683+16841684+ Indicates the "quality of protection" options applied to the
16851685+ response by the server. The value "auth" indicates
16861686+ authentication; the value "auth-int" indicates authentication with
16871687+ integrity protection. The server SHOULD use the same value for
16881688+ the qop parameter in the response as was sent by the client in the
16891689+ corresponding request.
16901690+16911691+16921692+16931693+16941694+16951695+16961696+16971697+16981698+<span class="grey">Shekh-Yusef, et al. Standards Track [Page 14]</span></pre>
16991699+<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-15" ></span>
17001700+<span class="grey"><a href="/doc/html/rfc7616">RFC 7616</a> HTTP Digest Access Authentication September 2015</span>
17011701+17021702+17031703+ rspauth
17041704+17051705+ The optional response digest in the rspauth parameter supports
17061706+ mutual authentication -- the server proves that it knows the
17071707+ user's secret, and with qop=auth-int also provides limited
17081708+ integrity protection of the response. The rspauth value is
17091709+ calculated as for the response in the Authorization header field,
17101710+ except that if qop is set to "auth" or is not specified in the
17111711+ Authorization header field for the request, A2 is
17121712+17131713+ A2 = ":" request-uri
17141714+17151715+ and if "qop=auth-int", then A2 is
17161716+17171717+ A2 = ":" request-uri ":" H(entity-body)
17181718+17191719+ cnonce and nc
17201720+17211721+ The cnonce value and nc value MUST be the ones for the client
17221722+ request to which this message is the response. The rspauth,
17231723+ cnonce, and nc parameters MUST be present if "qop=auth" or
17241724+ "qop=auth-int" is specified.
17251725+17261726+ The Authentication-Info header field is allowed in the trailer of an
17271727+ HTTP message transferred via chunked transfer coding.
17281728+17291729+ For historical reasons, a sender MUST only generate the quoted string
17301730+ syntax for the following parameters: nextnonce, rspauth, and cnonce.
17311731+17321732+ For historical reasons, a sender MUST NOT generate the quoted string
17331733+ syntax for the following parameters: qop and nc.
17341734+17351735+ For historical reasons, the nc value MUST be exactly 8 hexadecimal
17361736+ digits.
17371737+17381738+<span class="h3"><a class="selflink" id="section-3.6" href="#section-3.6">3.6</a>. Digest Operation</span>
17391739+17401740+ Upon receiving the Authorization header field, the server MAY check
17411741+ its validity by looking up the password that corresponds to the
17421742+ submitted username. Then, the server MUST perform the same digest
17431743+ operation (e.g., MD5, SHA-256) performed by the client and compare
17441744+ the result to the given response value.
17451745+17461746+ Note that the HTTP server does not actually need to know the user's
17471747+ cleartext password. As long as H(A1) is available to the server, the
17481748+ validity of an Authorization header field can be verified.
17491749+17501750+17511751+17521752+17531753+17541754+<span class="grey">Shekh-Yusef, et al. Standards Track [Page 15]</span></pre>
17551755+<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-16" ></span>
17561756+<span class="grey"><a href="/doc/html/rfc7616">RFC 7616</a> HTTP Digest Access Authentication September 2015</span>
17571757+17581758+17591759+ The client response to a WWW-Authenticate challenge for a protection
17601760+ space starts an authentication session with that protection space.
17611761+ The authentication session lasts until the client receives another
17621762+ WWW-Authenticate challenge from any server in the protection space.
17631763+ A client SHOULD remember the username, password, nonce, nonce count,
17641764+ and opaque values associated with an authentication session to use to
17651765+ construct the Authorization header field in future requests within
17661766+ that protection space. The Authorization header field MAY be
17671767+ included preemptively; doing so improves server efficiency and avoids
17681768+ extra round trips for authentication challenges. The server MAY
17691769+ choose to accept the old Authorization header field information, even
17701770+ though the nonce value included might not be fresh. Alternatively,
17711771+ the server MAY return a 401 response with a new nonce value in the
17721772+ WWW-Authenticate header field, causing the client to retry the
17731773+ request; by specifying "stale=true" with this response, the server
17741774+ tells the client to retry with the new nonce, but without prompting
17751775+ for a new username and password.
17761776+17771777+ Because the client is required to return the value of the opaque
17781778+ parameter given to it by the server for the duration of a session,
17791779+ the opaque data can be used to transport authentication session state
17801780+ information. (Note that any such use can also be accomplished more
17811781+ easily and safely by including the state in the nonce.) For example,
17821782+ a server could be responsible for authenticating content that
17831783+ actually sits on another server. It would achieve this by having the
17841784+ first 401 response include a domain parameter whose value includes a
17851785+ URI on the second server, and an opaque parameter whose value
17861786+ contains the state information. The client will retry the request,
17871787+ at which time the server might respond with "HTTP Redirection"
17881788+ (<a href="/doc/html/rfc7231#section-6.4">Section 6.4 of [RFC7231]</a>), pointing to the URI on the second server.
17891789+ The client will follow the redirection and pass an Authorization
17901790+ header field, including the <opaque> data.
17911791+17921792+ Proxies MUST be completely transparent in the Digest access
17931793+ authentication scheme. That is, they MUST forward the WWW-
17941794+ Authenticate, Authentication-Info, and Authorization header fields
17951795+ untouched. If a proxy wants to authenticate a client before a
17961796+ request is forwarded to the server, it can be done using the Proxy-
17971797+ Authenticate and Proxy-Authorization header fields described in
17981798+ <a href="#section-3.8">Section 3.8</a> below.
17991799+18001800+<span class="h3"><a class="selflink" id="section-3.7" href="#section-3.7">3.7</a>. Security Protocol Negotiation</span>
18011801+18021802+ It is useful for a server to be able to know which security schemes a
18031803+ client is capable of handling.
18041804+18051805+ It is possible that a server wants to require Digest as its
18061806+ authentication method, even if the server does not know that the
18071807+18081808+18091809+18101810+<span class="grey">Shekh-Yusef, et al. Standards Track [Page 16]</span></pre>
18111811+<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-17" ></span>
18121812+<span class="grey"><a href="/doc/html/rfc7616">RFC 7616</a> HTTP Digest Access Authentication September 2015</span>
18131813+18141814+18151815+ client supports it. A client is encouraged to fail gracefully if the
18161816+ server specifies only authentication schemes it cannot handle.
18171817+18181818+ When a server receives a request to access a resource, the server
18191819+ might challenge the client by responding with "401 Unauthorized"
18201820+ response and include one or more WWW-Authenticate header fields. If
18211821+ the server responds with multiple challenges, then each one of these
18221822+ challenges MUST use a different digest algorithm. The server MUST
18231823+ add these challenges to the response in order of preference, starting
18241824+ with the most preferred algorithm, followed by the less preferred
18251825+ algorithm.
18261826+18271827+ This specification defines the following algorithms:
18281828+18291829+ o SHA2-256 (mandatory to implement)
18301830+18311831+ o SHA2-512/256 (as a backup algorithm)
18321832+18331833+ o MD5 (for backward compatibility).
18341834+18351835+ When the client receives the first challenge, it SHOULD use the first
18361836+ challenge it supports, unless a local policy dictates otherwise.
18371837+18381838+<span class="h3"><a class="selflink" id="section-3.8" href="#section-3.8">3.8</a>. Proxy-Authenticate and Proxy-Authorization</span>
18391839+18401840+ The Digest Authentication scheme can also be used for authenticating
18411841+ users to proxies, proxies to proxies, or proxies to origin servers by
18421842+ use of the Proxy-Authenticate and Proxy-Authorization header fields.
18431843+ These header fields are instances of the Proxy-Authenticate and
18441844+ Proxy-Authorization header fields specified in Sections <a href="#section-4.3">4.3</a> and <a href="#section-4.4">4.4</a>
18451845+ of the HTTP/1.1 specification [<a href="/doc/html/rfc7235" title=""Hypertext Transfer Protocol (HTTP/1.1): Authentication"">RFC7235</a>], and their behavior is
18461846+ subject to restrictions described there. The transactions for proxy
18471847+ authentication are very similar to those already described. Upon
18481848+ receiving a request that requires authentication, the proxy/server
18491849+ MUST issue the "407 Proxy Authentication Required" response with a
18501850+ "Proxy-Authenticate" header field. The digest-challenge used in the
18511851+ Proxy-Authenticate header field is the same as that for the WWW-
18521852+ Authenticate header field as defined above in <a href="#section-3.3">Section 3.3</a>.
18531853+18541854+ The client/proxy MUST then reissue the request with a Proxy-
18551855+ Authorization header field, with parameters as specified for the
18561856+ Authorization header field in <a href="#section-3.4">Section 3.4</a> above.
18571857+18581858+ On subsequent responses, the server sends Proxy-Authentication-Info
18591859+ with parameters the same as those for the Authentication-Info header
18601860+ field.
18611861+18621862+18631863+18641864+18651865+18661866+<span class="grey">Shekh-Yusef, et al. Standards Track [Page 17]</span></pre>
18671867+<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-18" ></span>
18681868+<span class="grey"><a href="/doc/html/rfc7616">RFC 7616</a> HTTP Digest Access Authentication September 2015</span>
18691869+18701870+18711871+ Note that, in principle, a client could be asked to authenticate
18721872+ itself to both a proxy and an end-server, but never in the same
18731873+ response.
18741874+18751875+<span class="h3"><a class="selflink" id="section-3.9" href="#section-3.9">3.9</a>. Examples</span>
18761876+18771877+<span class="h4"><a class="selflink" id="section-3.9.1" href="#section-3.9.1">3.9.1</a>. Example with SHA-256 and MD5</span>
18781878+18791879+ The following example assumes that an access-protected document is
18801880+ being requested from the server via a GET request. The URI of the
18811881+ document is "http://www.example.org/dir/index.html". Both client and
18821882+ server know that the username for this document is "Mufasa" and the
18831883+ password is "Circle of Life" (with one space between each of the
18841884+ three words).
18851885+18861886+ The first time the client requests the document, no Authorization
18871887+ header field is sent, so the server responds with:
18881888+18891889+ HTTP/1.1 401 Unauthorized
18901890+ WWW-Authenticate: Digest
18911891+ realm="http-auth@example.org",
18921892+ qop="auth, auth-int",
18931893+ algorithm=SHA-256,
18941894+ nonce="7ypf/xlj9XXwfDPEoM4URrv/xwf94BcCAzFZH4GiTo0v",
18951895+ opaque="FQhe/qaU925kfnzjCev0ciny7QMkPqMAFRtzCUYo5tdS"
18961896+ WWW-Authenticate: Digest
18971897+ realm="http-auth@example.org",
18981898+ qop="auth, auth-int",
18991899+ algorithm=MD5,
19001900+ nonce="7ypf/xlj9XXwfDPEoM4URrv/xwf94BcCAzFZH4GiTo0v",
19011901+ opaque="FQhe/qaU925kfnzjCev0ciny7QMkPqMAFRtzCUYo5tdS"
19021902+19031903+ The client can prompt the user for their username and password, after
19041904+ which it will respond with a new request, including the following
19051905+ Authorization header field if the client chooses MD5 digest:
19061906+19071907+ Authorization: Digest username="Mufasa",
19081908+ realm="http-auth@example.org",
19091909+ uri="/dir/index.html",
19101910+ algorithm=MD5,
19111911+ nonce="7ypf/xlj9XXwfDPEoM4URrv/xwf94BcCAzFZH4GiTo0v",
19121912+ nc=00000001,
19131913+ cnonce="f2/wE4q74E6zIJEtWaHKaf5wv/H5QzzpXusqGemxURZJ",
19141914+ qop=auth,
19151915+ response="8ca523f5e9506fed4657c9700eebdbec",
19161916+ opaque="FQhe/qaU925kfnzjCev0ciny7QMkPqMAFRtzCUYo5tdS"
19171917+19181918+19191919+19201920+19211921+19221922+<span class="grey">Shekh-Yusef, et al. Standards Track [Page 18]</span></pre>
19231923+<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-19" ></span>
19241924+<span class="grey"><a href="/doc/html/rfc7616">RFC 7616</a> HTTP Digest Access Authentication September 2015</span>
19251925+19261926+19271927+ If the client chooses to use the SHA-256 algorithm for calculating
19281928+ the response, the client responds with a new request including the
19291929+ following Authorization header field:
19301930+19311931+ Authorization: Digest username="Mufasa",
19321932+ realm="http-auth@example.org",
19331933+ uri="/dir/index.html",
19341934+ algorithm=SHA-256,
19351935+ nonce="7ypf/xlj9XXwfDPEoM4URrv/xwf94BcCAzFZH4GiTo0v",
19361936+ nc=00000001,
19371937+ cnonce="f2/wE4q74E6zIJEtWaHKaf5wv/H5QzzpXusqGemxURZJ",
19381938+ qop=auth,
19391939+ response="753927fa0e85d155564e2e272a28d1802ca10daf449
19401940+ 6794697cf8db5856cb6c1",
19411941+ opaque="FQhe/qaU925kfnzjCev0ciny7QMkPqMAFRtzCUYo5tdS"
19421942+19431943+<span class="h4"><a class="selflink" id="section-3.9.2" href="#section-3.9.2">3.9.2</a>. Example with SHA-512-256, Charset, and Userhash</span>
19441944+19451945+ The following example assumes that an access-protected document is
19461946+ being requested from the server via a GET request. The URI for the
19471947+ request is "http://api.example.org/doe.json". Both client and server
19481948+ know the userhash of the username, support the UTF-8 character
19491949+ encoding scheme, and use the SHA-512-256 algorithm. The username for
19501950+ the request is a variation of "Jason Doe", where the 'a' actually is
19511951+ Unicode code point U+00E4 ("LATIN SMALL LETTER A WITH DIAERESIS"),
19521952+ and the first 'o' is Unicode code point U+00F8 ("LATIN SMALL LETTER O
19531953+ WITH STROKE"), leading to the octet sequence using the UTF-8 encoding
19541954+ scheme:
19551955+19561956+ J U+00E4 s U+00F8 n D o e
19571957+ 4A C3A4 73 C3B8 6E 20 44 6F 65
19581958+19591959+ The password is "Secret, or not?".
19601960+19611961+ The first time the client requests the document, no Authorization
19621962+ header field is sent, so the server responds with:
19631963+19641964+ HTTP/1.1 401 Unauthorized
19651965+ WWW-Authenticate: Digest
19661966+ realm="api@example.org",
19671967+ qop="auth",
19681968+ algorithm=SHA-512-256,
19691969+ nonce="5TsQWLVdgBdmrQ0XsxbDODV+57QdFR34I9HAbC/RVvkK",
19701970+ opaque="HRPCssKJSGjCrkzDg8OhwpzCiGPChXYjwrI2QmXDnsOS",
19711971+ charset=UTF-8,
19721972+ userhash=true
19731973+19741974+19751975+19761976+19771977+19781978+<span class="grey">Shekh-Yusef, et al. Standards Track [Page 19]</span></pre>
19791979+<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-20" ></span>
19801980+<span class="grey"><a href="/doc/html/rfc7616">RFC 7616</a> HTTP Digest Access Authentication September 2015</span>
19811981+19821982+19831983+ The client can prompt the user for the required credentials and send
19841984+ a new request with following Authorization header field:
19851985+19861986+ Authorization: Digest
19871987+ username="488869477bf257147b804c45308cd62ac4e25eb717
19881988+ b12b298c79e62dcea254ec",
19891989+ realm="api@example.org",
19901990+ uri="/doe.json",
19911991+ algorithm=SHA-512-256,
19921992+ nonce="5TsQWLVdgBdmrQ0XsxbDODV+57QdFR34I9HAbC/RVvkK",
19931993+ nc=00000001,
19941994+ cnonce="NTg6RKcb9boFIAS3KrFK9BGeh+iDa/sm6jUMp2wds69v",
19951995+ qop=auth,
19961996+ response="ae66e67d6b427bd3f120414a82e4acff38e8ecd9101d
19971997+ 6c861229025f607a79dd",
19981998+ opaque="HRPCssKJSGjCrkzDg8OhwpzCiGPChXYjwrI2QmXDnsOS",
19991999+ userhash=true
20002000+20012001+ If the client cannot provide a hashed username for any reason, the
20022002+ client can try a request with this Authorization header field:
20032003+20042004+ Authorization: Digest
20052005+ username*=UTF-8''J%C3%A4s%C3%B8n%20Doe,
20062006+ realm="api@example.org",
20072007+ uri="/doe.json",
20082008+ algorithm=SHA-512-256,
20092009+ nonce="5TsQWLVdgBdmrQ0XsxbDODV+57QdFR34I9HAbC/RVvkK",
20102010+ nc=00000001,
20112011+ cnonce="NTg6RKcb9boFIAS3KrFK9BGeh+iDa/sm6jUMp2wds69v",
20122012+ qop=auth,
20132013+ response="ae66e67d6b427bd3f120414a82e4acff38e8ecd9101d
20142014+ 6c861229025f607a79dd",
20152015+ opaque="HRPCssKJSGjCrkzDg8OhwpzCiGPChXYjwrI2QmXDnsOS",
20162016+ userhash=false
20172017+20182018+<span class="h2"><a class="selflink" id="section-4" href="#section-4">4</a>. Internationalization Considerations</span>
20192019+20202020+ In challenges, servers SHOULD use the "charset" authentication
20212021+ parameter (case-insensitive) to express the character encoding they
20222022+ expect the user agent to use when generating A1 (see <a href="#section-3.4.2">Section 3.4.2</a>)
20232023+ and username hashing (see <a href="#section-3.4.4">Section 3.4.4</a>).
20242024+20252025+ The only allowed value is "UTF-8", to be matched case-insensitively
20262026+ (see <a href="/doc/html/rfc2978#section-2.3">Section 2.3 in [RFC2978]</a>). It indicates that the server expects
20272027+ the username and password to be converted to Unicode Normalization
20282028+ Form C ("NFC", see <a href="/doc/html/rfc5198#section-3">Section 3 of [RFC5198]</a>) and to be encoded into
20292029+ octets using the UTF-8 character encoding scheme [<a href="/doc/html/rfc3629" title=""UTF-8, a transformation format of ISO 10646"">RFC3629</a>].
20302030+20312031+20322032+20332033+20342034+<span class="grey">Shekh-Yusef, et al. Standards Track [Page 20]</span></pre>
20352035+<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-21" ></span>
20362036+<span class="grey"><a href="/doc/html/rfc7616">RFC 7616</a> HTTP Digest Access Authentication September 2015</span>
20372037+20382038+20392039+ For the username, recipients MUST support all characters defined in
20402040+ the "UsernameCasePreserved" profile defined in <a href="/doc/html/rfc7613#section-3.3">Section 3.3 of
20412041+ [RFC7613]</a>, with the exception of the colon (":") character.
20422042+20432043+ For the password, recipients MUST support all characters defined in
20442044+ the "OpaqueString" profile defined in <a href="/doc/html/rfc7613#section-4.2">Section 4.2 of [RFC7613]</a>.
20452045+20462046+ If the user agent does not support the encoding indicated by the
20472047+ server, it can fail the request.
20482048+20492049+ When usernames cannot be sent hashed and include non-ASCII
20502050+ characters, clients can include the username* parameter instead
20512051+ (using the value encoding defined in [<a href="/doc/html/rfc5987" title=""Character Set and Language Encoding for Hypertext Transfer Protocol (HTTP) Header Field Parameters"">RFC5987</a>]).
20522052+20532053+<span class="h2"><a class="selflink" id="section-5" href="#section-5">5</a>. Security Considerations</span>
20542054+20552055+<span class="h3"><a class="selflink" id="section-5.1" href="#section-5.1">5.1</a>. Limitations</span>
20562056+20572057+ HTTP Digest Authentication, when used with human-memorable passwords,
20582058+ is vulnerable to dictionary attacks. Such attacks are much easier
20592059+ than cryptographic attacks on any widely used algorithm, including
20602060+ those that are no longer considered secure. In other words,
20612061+ algorithm agility does not make this usage any more secure.
20622062+20632063+ As a result, Digest Authentication SHOULD be used only with passwords
20642064+ that have a reasonable amount of entropy, e.g., 128-bit or more.
20652065+ Such passwords typically cannot be memorized by humans but can be
20662066+ used for automated web services.
20672067+20682068+ If Digest Authentication is being used, it SHOULD be over a secure
20692069+ channel like HTTPS [<a href="/doc/html/rfc2818" title=""HTTP Over TLS"">RFC2818</a>].
20702070+20712071+<span class="h3"><a class="selflink" id="section-5.2" href="#section-5.2">5.2</a>. Storing Passwords</span>
20722072+20732073+ Digest Authentication requires that the authenticating agent (usually
20742074+ the server) store some data derived from the user's name and password
20752075+ in a "password file" associated with a given realm. Normally, this
20762076+ might contain pairs consisting of username and H(A1), where H(A1) is
20772077+ the digested value of the username, realm, and password as described
20782078+ above.
20792079+20802080+ The security implications of this are that if this password file is
20812081+ compromised, then an attacker gains immediate access to documents on
20822082+ the server using this realm. Unlike, say, a standard UNIX password
20832083+ file, this information needs not be decrypted in order to access
20842084+ documents in the server realm associated with this file. On the
20852085+ other hand, decryption, or more likely a brute-force attack, would be
20862086+ necessary to obtain the user's password. This is the reason that the
20872087+20882088+20892089+20902090+<span class="grey">Shekh-Yusef, et al. Standards Track [Page 21]</span></pre>
20912091+<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-22" ></span>
20922092+<span class="grey"><a href="/doc/html/rfc7616">RFC 7616</a> HTTP Digest Access Authentication September 2015</span>
20932093+20942094+20952095+ realm is part of the digested data stored in the password file. It
20962096+ means that if one Digest Authentication password file is compromised,
20972097+ it does not automatically compromise others with the same username
20982098+ and password (though it does expose them to brute-force attack).
20992099+21002100+ There are two important security consequences of this. First, the
21012101+ password file must be protected as if it contained unencrypted
21022102+ passwords, because, for the purpose of accessing documents in its
21032103+ realm, it effectively does.
21042104+21052105+ A second consequence of this is that the realm string SHOULD be
21062106+ unique among all realms that any single user is likely to use. In
21072107+ particular, a realm string SHOULD include the name of the host doing
21082108+ the authentication. The inability of the client to authenticate the
21092109+ server is a weakness of Digest Authentication.
21102110+21112111+<span class="h3"><a class="selflink" id="section-5.3" href="#section-5.3">5.3</a>. Authentication of Clients Using Digest Authentication</span>
21122112+21132113+ Digest Authentication does not provide a strong authentication
21142114+ mechanism, when compared to public-key-based mechanisms, for example.
21152115+21162116+ However, it is significantly stronger than, e.g., CRAM-MD5, which has
21172117+ been proposed for use with Lightweight Directory Access Protocol
21182118+ (LDAP) [<a href="/doc/html/rfc4513" title=""Lightweight Directory Access Protocol (LDAP): Authentication Methods and Security Mechanisms"">RFC4513</a>] and IMAP/POP (see [<a href="/doc/html/rfc2195" title=""IMAP/POP AUTHorize Extension for Simple Challenge/Response"">RFC2195</a>]). It was intended to
21192119+ replace the much weaker and even more dangerous Basic mechanism.
21202120+21212121+ Digest Authentication offers no confidentiality protection beyond
21222122+ protecting the actual username and password. All of the rest of the
21232123+ request and response are available to an eavesdropper.
21242124+21252125+ Digest Authentication offers only limited integrity protection for
21262126+ the messages in either direction. If the "qop=auth-int" mechanism is
21272127+ used, those parts of the message used in the calculation of the WWW-
21282128+ Authenticate and Authorization header field response parameter values
21292129+ (see <a href="#section-3.2">Section 3.2</a> above) are protected. Most header fields and their
21302130+ values could be modified as a part of a man-in-the-middle attack.
21312131+21322132+ Many needs for secure HTTP transactions cannot be met by Digest
21332133+ Authentication. For those needs, TLS is a more appropriate protocol.
21342134+ In particular, Digest Authentication cannot be used for any
21352135+ transaction requiring confidentiality protection. Nevertheless, many
21362136+ functions remain for which Digest Authentication is both useful and
21372137+ appropriate.
21382138+21392139+21402140+21412141+21422142+21432143+21442144+21452145+21462146+<span class="grey">Shekh-Yusef, et al. Standards Track [Page 22]</span></pre>
21472147+<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-23" ></span>
21482148+<span class="grey"><a href="/doc/html/rfc7616">RFC 7616</a> HTTP Digest Access Authentication September 2015</span>
21492149+21502150+21512151+<span class="h3"><a class="selflink" id="section-5.4" href="#section-5.4">5.4</a>. Limited-Use Nonce Values</span>
21522152+21532153+ The Digest scheme uses a server-specified nonce to seed the
21542154+ generation of the response value (as specified in <a href="#section-3.4.1">Section 3.4.1</a>
21552155+ above). As shown in the example nonce in <a href="#section-3.3">Section 3.3</a>, the server is
21562156+ free to construct the nonce such that it MAY only be used from a
21572157+ particular client, for a particular resource, for a limited period of
21582158+ time or number of uses, or any other restrictions. Doing so
21592159+ strengthens the protection provided against, for example, replay
21602160+ attacks (see <a href="#section-5.5">Section 5.5</a>). However, it should be noted that the
21612161+ method chosen for generating and checking the nonce also has
21622162+ performance and resource implications. For example, a server MAY
21632163+ choose to allow each nonce value to be used only once by maintaining
21642164+ a record of whether or not each recently issued nonce has been
21652165+ returned and sending a next-nonce parameter in the Authentication-
21662166+ Info header field of every response. This protects against even an
21672167+ immediate replay attack, but it has a high cost due to checking nonce
21682168+ values; perhaps more important, it will cause authentication failures
21692169+ for any pipelined requests (presumably returning a stale nonce
21702170+ indication). Similarly, incorporating a request-specific element
21712171+ such as the ETag value for a resource limits the use of the nonce to
21722172+ that version of the resource and also defeats pipelining. Thus, it
21732173+ MAY be useful to do so for methods with side effects but have
21742174+ unacceptable performance for those that do not.
21752175+21762176+<span class="h3"><a class="selflink" id="section-5.5" href="#section-5.5">5.5</a>. Replay Attacks</span>
21772177+21782178+ A replay attack against Digest Authentication would usually be
21792179+ pointless for a simple GET request since an eavesdropper would
21802180+ already have seen the only document he could obtain with a replay.
21812181+ This is because the URI of the requested document is digested in the
21822182+ client request, and the server will only deliver that document. By
21832183+ contrast, under Basic Authentication, once the eavesdropper has the
21842184+ user's password, any document protected by that password is open to
21852185+ him.
21862186+21872187+ Thus, for some purposes, it is necessary to protect against replay
21882188+ attacks. A good Digest implementation can do this in various ways.
21892189+ The server-created "nonce" value is implementation dependent, but if
21902190+ it contains a digest of the client IP, a timestamp, the resource
21912191+ ETag, and a private server key (as recommended above), then a replay
21922192+ attack is not simple. An attacker must convince the server that the
21932193+ request is coming from a false IP address and must cause the server
21942194+ to deliver the document to an IP address different from the address
21952195+ to which it believes it is sending the document. An attack can only
21962196+ succeed in the period before the timestamp expires. Digesting the
21972197+ client IP and timestamp in the nonce permits an implementation that
21982198+ does not maintain state between transactions.
21992199+22002200+22012201+22022202+<span class="grey">Shekh-Yusef, et al. Standards Track [Page 23]</span></pre>
22032203+<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-24" ></span>
22042204+<span class="grey"><a href="/doc/html/rfc7616">RFC 7616</a> HTTP Digest Access Authentication September 2015</span>
22052205+22062206+22072207+ For applications where no possibility of replay attack can be
22082208+ tolerated, the server can use one-time nonce values that will not be
22092209+ honored for a second use. This requires the overhead of the server
22102210+ remembering which nonce values have been used until the nonce
22112211+ timestamp (and hence the digest built with it) has expired, but it
22122212+ effectively protects against replay attacks.
22132213+22142214+ An implementation must give special attention to the possibility of
22152215+ replay attacks with POST and PUT requests. Unless the server employs
22162216+ one-time or otherwise limited-use nonces and/or insists on the use of
22172217+ the integrity protection of "qop=auth-int", an attacker could replay
22182218+ valid credentials from a successful request with counterfeit data or
22192219+ other message body. Even with the use of integrity protection, most
22202220+ metadata in header fields is not protected. Proper nonce generation
22212221+ and checking provides some protection against replay of previously
22222222+ used valid credentials, but see <a href="#section-5.8">Section 5.8</a>.
22232223+22242224+<span class="h3"><a class="selflink" id="section-5.6" href="#section-5.6">5.6</a>. Weakness Created by Multiple Authentication Schemes</span>
22252225+22262226+ An HTTP/1.1 server MAY return multiple challenges with a 401
22272227+ (Authenticate) response, and each challenge MAY use a different auth-
22282228+ scheme. A user agent MUST choose to use the strongest auth-scheme it
22292229+ understands and request credentials from the user based upon that
22302230+ challenge.
22312231+22322232+ When the server offers choices of authentication schemes using the
22332233+ WWW-Authenticate header field, the strength of the resulting
22342234+ authentication is only as good as that of the of the weakest of the
22352235+ authentication schemes. See <a href="#section-5.7">Section 5.7</a> below for discussion of
22362236+ particular attack scenarios that exploit multiple authentication
22372237+ schemes.
22382238+22392239+<span class="h3"><a class="selflink" id="section-5.7" href="#section-5.7">5.7</a>. Online Dictionary Attacks</span>
22402240+22412241+ If the attacker can eavesdrop, then it can test any overheard nonce/
22422242+ response pairs against a list of common words. Such a list is
22432243+ usually much smaller than the total number of possible passwords.
22442244+ The cost of computing the response for each password on the list is
22452245+ paid once for each challenge.
22462246+22472247+ The server can mitigate this attack by not allowing users to select
22482248+ passwords that are in a dictionary.
22492249+22502250+22512251+22522252+22532253+22542254+22552255+22562256+22572257+22582258+<span class="grey">Shekh-Yusef, et al. Standards Track [Page 24]</span></pre>
22592259+<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-25" ></span>
22602260+<span class="grey"><a href="/doc/html/rfc7616">RFC 7616</a> HTTP Digest Access Authentication September 2015</span>
22612261+22622262+22632263+<span class="h3"><a class="selflink" id="section-5.8" href="#section-5.8">5.8</a>. Man-in-the-Middle Attacks</span>
22642264+22652265+ Digest Authentication is vulnerable to man-in-the-middle (MITM)
22662266+ attacks, for example, from a hostile or compromised proxy. Clearly,
22672267+ this would present all the problems of eavesdropping. But, it also
22682268+ offers some additional opportunities to the attacker.
22692269+22702270+ A possible man-in-the-middle attack would be to add a weak
22712271+ authentication scheme to the set of choices, hoping that the client
22722272+ will use one that exposes the user's credentials (e.g., password).
22732273+ For this reason, the client SHOULD always use the strongest scheme
22742274+ that it understands from the choices offered.
22752275+22762276+ An even better MITM attack would be to remove all offered choices,
22772277+ replacing them with a challenge that requests only Basic
22782278+ authentication, then uses the cleartext credentials from the Basic
22792279+ authentication to authenticate to the origin server using the
22802280+ stronger scheme it requested. A particularly insidious way to mount
22812281+ such a MITM attack would be to offer a "free" proxy caching service
22822282+ to gullible users.
22832283+22842284+ User agents should consider measures such as presenting a visual
22852285+ indication at the time of the credentials request of what
22862286+ authentication scheme is to be used, or remembering the strongest
22872287+ authentication scheme ever requested by a server and producing a
22882288+ warning message before using a weaker one. It might also be a good
22892289+ idea for the user agent to be configured to demand Digest
22902290+ authentication in general or from specific sites.
22912291+22922292+ Or, a hostile proxy might spoof the client into making a request the
22932293+ attacker wanted rather than one the client wanted. Of course, this
22942294+ is still much harder than a comparable attack against Basic
22952295+ Authentication.
22962296+22972297+<span class="h3"><a class="selflink" id="section-5.9" href="#section-5.9">5.9</a>. Chosen Plaintext Attacks</span>
22982298+22992299+ With Digest Authentication, a MITM or a malicious server can
23002300+ arbitrarily choose the nonce that the client will use to compute the
23012301+ response. This is called a "chosen plaintext" attack. The ability
23022302+ to choose the nonce is known to make cryptanalysis much easier.
23032303+23042304+ However, a method to analyze the one-way functions used by Digest
23052305+ using chosen plaintext is not currently known.
23062306+23072307+ The countermeasure against this attack is for clients to use the
23082308+ cnonce parameter; this allows the client to vary the input to the
23092309+ hash in a way not chosen by the attacker.
23102310+23112311+23122312+23132313+23142314+<span class="grey">Shekh-Yusef, et al. Standards Track [Page 25]</span></pre>
23152315+<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-26" ></span>
23162316+<span class="grey"><a href="/doc/html/rfc7616">RFC 7616</a> HTTP Digest Access Authentication September 2015</span>
23172317+23182318+23192319+<span class="h3"><a class="selflink" id="section-5.10" href="#section-5.10">5.10</a>. Precomputed Dictionary Attacks</span>
23202320+23212321+ With Digest Authentication, if the attacker can execute a chosen
23222322+ plaintext attack, the attacker can precompute the response for many
23232323+ common words to a nonce of its choice and store a dictionary of
23242324+ response/password pairs. Such precomputation can often be done in
23252325+ parallel on many machines. It can then use the chosen plaintext
23262326+ attack to acquire a response corresponding to that challenge and just
23272327+ look up the password in the dictionary. Even if most passwords are
23282328+ not in the dictionary, some might be. Since the attacker gets to
23292329+ pick the challenge, the cost of computing the response for each
23302330+ password on the list can be amortized over finding many passwords. A
23312331+ dictionary with 100 million password/response pairs would take about
23322332+ 3.2 gigabytes of disk storage.
23332333+23342334+ The countermeasure against this attack is for clients to use the
23352335+ cnonce parameter.
23362336+23372337+<span class="h3"><a class="selflink" id="section-5.11" href="#section-5.11">5.11</a>. Batch Brute-Force Attacks</span>
23382338+23392339+ With Digest Authentication, a MITM can execute a chosen plaintext
23402340+ attack and can gather responses from many users to the same nonce.
23412341+ It can then find all the passwords within any subset of password
23422342+ space that would generate one of the nonce/response pairs in a single
23432343+ pass over that space. It also reduces the time to find the first
23442344+ password by a factor equal to the number of nonce/response pairs
23452345+ gathered. This search of the password space can often be done in
23462346+ parallel on many machines, and even a single machine can search large
23472347+ subsets of the password space very quickly -- reports exist of
23482348+ searching all passwords with six or fewer letters in a few hours.
23492349+23502350+ The countermeasure against this attack is for clients to use the
23512351+ cnonce parameter.
23522352+23532353+<span class="h3"><a class="selflink" id="section-5.12" href="#section-5.12">5.12</a>. Parameter Randomness</span>
23542354+23552355+ The security of this protocol is critically dependent on the
23562356+ randomness of the randomly chosen parameters, such as client and
23572357+ server nonces. These should be generated by a strong random or
23582358+ properly seeded pseudorandom source (see [<a href="/doc/html/rfc4086" title=""Randomness Requirements for Security"">RFC4086</a>]).
23592359+23602360+<span class="h3"><a class="selflink" id="section-5.13" href="#section-5.13">5.13</a>. Summary</span>
23612361+23622362+ By modern cryptographic standards, Digest Authentication is weak.
23632363+ But, for a large range of purposes, it is valuable as a replacement
23642364+ for Basic Authentication. It remedies some, but not all, weaknesses
23652365+ of Basic Authentication. Its strength may vary depending on the
23662366+ implementation. In particular, the structure of the nonce (which is
23672367+23682368+23692369+23702370+<span class="grey">Shekh-Yusef, et al. Standards Track [Page 26]</span></pre>
23712371+<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-27" ></span>
23722372+<span class="grey"><a href="/doc/html/rfc7616">RFC 7616</a> HTTP Digest Access Authentication September 2015</span>
23732373+23742374+23752375+ dependent on the server implementation) may affect the ease of
23762376+ mounting a replay attack. A range of server options is appropriate
23772377+ since, for example, some implementations may be willing to accept the
23782378+ server overhead of one-time nonces or digests to eliminate the
23792379+ possibility of replay. Others may be satisfied with a nonce like the
23802380+ one recommended above, i.e., restricted to a single IP address and a
23812381+ single ETag or with a limited lifetime.
23822382+23832383+ The bottom line is that *any* compliant implementation will be
23842384+ relatively weak by cryptographic standards, but *any* compliant
23852385+ implementation will be far superior to Basic Authentication.
23862386+23872387+<span class="h2"><a class="selflink" id="section-6" href="#section-6">6</a>. IANA Considerations</span>
23882388+23892389+<span class="h3"><a class="selflink" id="section-6.1" href="#section-6.1">6.1</a>. Hash Algorithms for HTTP Digest Authentication</span>
23902390+23912391+ This specification creates a new IANA registry named "Hash Algorithms
23922392+ for HTTP Digest Authentication" under the existing "Hypertext
23932393+ Transfer Protocol (HTTP) Digest Algorithm Values" category. This
23942394+ registry lists the hash algorithms that can be used in HTTP Digest
23952395+ Authentication.
23962396+23972397+ When registering a new hash algorithm, the following information MUST
23982398+ be provided:
23992399+24002400+ Hash Algorithm
24012401+24022402+ The textual name of the hash algorithm.
24032403+24042404+ Digest Size
24052405+24062406+ The size of the algorithm's output in bits.
24072407+24082408+ Reference
24092409+24102410+ A reference to the specification adding the algorithm to this
24112411+ registry.
24122412+24132413+ The update policy for this registry shall be Specification Required
24142414+ [<a href="/doc/html/rfc5226" title="">RFC5226</a>].
24152415+24162416+24172417+24182418+24192419+24202420+24212421+24222422+24232423+24242424+24252425+24262426+<span class="grey">Shekh-Yusef, et al. Standards Track [Page 27]</span></pre>
24272427+<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-28" ></span>
24282428+<span class="grey"><a href="/doc/html/rfc7616">RFC 7616</a> HTTP Digest Access Authentication September 2015</span>
24292429+24302430+24312431+ The initial registry contains the following entries:
24322432+24332433+ +----------------+-------------+-----------+
24342434+ | Hash Algorithm | Digest Size | Reference |
24352435+ +----------------+-------------+-----------+
24362436+ | "MD5" | 128 | <a href="/doc/html/rfc7616">RFC 7616</a> |
24372437+ | "SHA-512-256" | 256 | <a href="/doc/html/rfc7616">RFC 7616</a> |
24382438+ | "SHA-256" | 256 | <a href="/doc/html/rfc7616">RFC 7616</a> |
24392439+ +----------------+-------------+-----------+
24402440+24412441+ Each one of the algorithms defined in the registry might have a
24422442+ "-sess" variant, e.g., MD5-sess, SHA-256-sess, etc.
24432443+24442444+ To clarify the purpose of the existing "HTTP Digest Algorithm Values"
24452445+ registry and to avoid confusion between the two registries, IANA has
24462446+ added the following description to the existing "HTTP Digest
24472447+ Algorithm Values" registry:
24482448+24492449+ This registry lists the algorithms that can be used when creating
24502450+ digests of an HTTP message body, as specified in <a href="/doc/html/rfc3230">RFC 3230</a>.
24512451+24522452+<span class="h3"><a class="selflink" id="section-6.2" href="#section-6.2">6.2</a>. Digest Scheme Registration</span>
24532453+24542454+ This specification updates the existing entry of the Digest scheme in
24552455+ the "Hypertext Transfer Protocol (HTTP) Authentication Scheme
24562456+ Registry" and adds a new reference to this specification.
24572457+24582458+ Authentication Scheme Name: Digest
24592459+24602460+ Pointer to specification text: <a href="/doc/html/rfc7616">RFC 7616</a>
24612461+24622462+<span class="h2"><a class="selflink" id="section-7" href="#section-7">7</a>. References</span>
24632463+24642464+<span class="h3"><a class="selflink" id="section-7.1" href="#section-7.1">7.1</a>. Normative References</span>
24652465+24662466+ [<a id="ref-RFC2119">RFC2119</a>] Bradner, S., "Key words for use in RFCs to Indicate
24672467+ Requirement Levels", <a href="/doc/html/bcp14">BCP 14</a>, <a href="/doc/html/rfc2119">RFC 2119</a>,
24682468+ DOI 10.17487/RFC2119, March 1997,
24692469+ <<a href="http://www.rfc-editor.org/info/rfc2119">http://www.rfc-editor.org/info/rfc2119</a>>.
24702470+24712471+ [<a id="ref-RFC2978">RFC2978</a>] Freed, N. and J. Postel, "IANA Charset Registration
24722472+ Procedures", <a href="/doc/html/bcp19">BCP 19</a>, <a href="/doc/html/rfc2978">RFC 2978</a>, DOI 10.17487/RFC2978,
24732473+ October 2000, <<a href="http://www.rfc-editor.org/info/rfc2978">http://www.rfc-editor.org/info/rfc2978</a>>.
24742474+24752475+ [<a id="ref-RFC3629">RFC3629</a>] Yergeau, F., "UTF-8, a transformation format of ISO
24762476+ 10646", STD 63, <a href="/doc/html/rfc3629">RFC 3629</a>, DOI 10.17487/RFC3629, November
24772477+ 2003, <<a href="http://www.rfc-editor.org/info/rfc3629">http://www.rfc-editor.org/info/rfc3629</a>>.
24782478+24792479+24802480+24812481+24822482+<span class="grey">Shekh-Yusef, et al. Standards Track [Page 28]</span></pre>
24832483+<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-29" ></span>
24842484+<span class="grey"><a href="/doc/html/rfc7616">RFC 7616</a> HTTP Digest Access Authentication September 2015</span>
24852485+24862486+24872487+ [<a id="ref-RFC3986">RFC3986</a>] Berners-Lee, T., Fielding, R., and L. Masinter, "Uniform
24882488+ Resource Identifier (URI): Generic Syntax", STD 66,
24892489+ <a href="/doc/html/rfc3986">RFC 3986</a>, DOI 10.17487/RFC3986, January 2005,
24902490+ <<a href="http://www.rfc-editor.org/info/rfc3986">http://www.rfc-editor.org/info/rfc3986</a>>.
24912491+24922492+ [<a id="ref-RFC4086">RFC4086</a>] Eastlake 3rd, D., Schiller, J., and S. Crocker,
24932493+ "Randomness Requirements for Security", <a href="/doc/html/bcp106">BCP 106</a>, <a href="/doc/html/rfc4086">RFC 4086</a>,
24942494+ DOI 10.17487/RFC4086, June 2005,
24952495+ <<a href="http://www.rfc-editor.org/info/rfc4086">http://www.rfc-editor.org/info/rfc4086</a>>.
24962496+24972497+ [<a id="ref-RFC5198">RFC5198</a>] Klensin, J. and M. Padlipsky, "Unicode Format for Network
24982498+ Interchange", <a href="/doc/html/rfc5198">RFC 5198</a>, DOI 10.17487/RFC5198, March 2008,
24992499+ <<a href="http://www.rfc-editor.org/info/rfc5198">http://www.rfc-editor.org/info/rfc5198</a>>.
25002500+25012501+ [<a id="ref-RFC5234">RFC5234</a>] Crocker, D., Ed. and P. Overell, "Augmented BNF for Syntax
25022502+ Specifications: ABNF", STD 68, <a href="/doc/html/rfc5234">RFC 5234</a>,
25032503+ DOI 10.17487/RFC5234, January 2008,
25042504+ <<a href="http://www.rfc-editor.org/info/rfc5234">http://www.rfc-editor.org/info/rfc5234</a>>.
25052505+25062506+ [<a id="ref-RFC5987">RFC5987</a>] Reschke, J., "Character Set and Language Encoding for
25072507+ Hypertext Transfer Protocol (HTTP) Header Field
25082508+ Parameters", <a href="/doc/html/rfc5987">RFC 5987</a>, DOI 10.17487/RFC5987, August 2010,
25092509+ <<a href="http://www.rfc-editor.org/info/rfc5987">http://www.rfc-editor.org/info/rfc5987</a>>.
25102510+25112511+ [<a id="ref-RFC6454">RFC6454</a>] Barth, A., "The Web Origin Concept", <a href="/doc/html/rfc6454">RFC 6454</a>,
25122512+ DOI 10.17487/RFC6454, December 2011,
25132513+ <<a href="http://www.rfc-editor.org/info/rfc6454">http://www.rfc-editor.org/info/rfc6454</a>>.
25142514+25152515+ [<a id="ref-RFC7230">RFC7230</a>] Fielding, R., Ed. and J. Reschke, Ed., "Hypertext Transfer
25162516+ Protocol (HTTP/1.1): Message Syntax and Routing",
25172517+ <a href="/doc/html/rfc7230">RFC 7230</a>, DOI 10.17487/RFC7230, June 2014,
25182518+ <<a href="http://www.rfc-editor.org/info/rfc7230">http://www.rfc-editor.org/info/rfc7230</a>>.
25192519+25202520+ [<a id="ref-RFC7231">RFC7231</a>] Fielding, R., Ed. and J. Reschke, Ed., "Hypertext Transfer
25212521+ Protocol (HTTP/1.1): Semantics and Content", <a href="/doc/html/rfc7231">RFC 7231</a>,
25222522+ DOI 10.17487/RFC7231, June 2014,
25232523+ <<a href="http://www.rfc-editor.org/info/rfc7231">http://www.rfc-editor.org/info/rfc7231</a>>.
25242524+25252525+ [<a id="ref-RFC7234">RFC7234</a>] Fielding, R., Ed., Nottingham, M., Ed., and J. Reschke,
25262526+ Ed., "Hypertext Transfer Protocol (HTTP/1.1): Caching",
25272527+ <a href="/doc/html/rfc7234">RFC 7234</a>, DOI 10.17487/RFC7234, June 2014,
25282528+ <<a href="http://www.rfc-editor.org/info/rfc7234">http://www.rfc-editor.org/info/rfc7234</a>>.
25292529+25302530+ [<a id="ref-RFC7235">RFC7235</a>] Fielding, R., Ed. and J. Reschke, Ed., "Hypertext Transfer
25312531+ Protocol (HTTP/1.1): Authentication", <a href="/doc/html/rfc7235">RFC 7235</a>,
25322532+ DOI 10.17487/RFC7235, June 2014,
25332533+ <<a href="http://www.rfc-editor.org/info/rfc7235">http://www.rfc-editor.org/info/rfc7235</a>>.
25342534+25352535+25362536+25372537+25382538+<span class="grey">Shekh-Yusef, et al. Standards Track [Page 29]</span></pre>
25392539+<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-30" ></span>
25402540+<span class="grey"><a href="/doc/html/rfc7616">RFC 7616</a> HTTP Digest Access Authentication September 2015</span>
25412541+25422542+25432543+ [<a id="ref-RFC7613">RFC7613</a>] Saint-Andre, P. and A. Melnikov, "Preparation,
25442544+ Enforcement, and Comparison of Internationalized Strings
25452545+ Representing Usernames and Passwords", <a href="/doc/html/rfc7613">RFC 7613</a>,
25462546+ DOI 10.17487/RFC7613, August 2015,
25472547+ <<a href="http://www.rfc-editor.org/info/rfc7613">http://www.rfc-editor.org/info/rfc7613</a>>.
25482548+25492549+ [<a id="ref-RFC7615">RFC7615</a>] Reschke, J., "HTTP Authentication-Info and Proxy-
25502550+ Authentication-Info Response Header Fields", <a href="/doc/html/rfc7615">RFC 7615</a>,
25512551+ DOI 10.17487/RFC7615, September 2015,
25522552+ <<a href="http://www.rfc-editor.org/info/rfc7615">http://www.rfc-editor.org/info/rfc7615</a>>.
25532553+25542554+<span class="h3"><a class="selflink" id="section-7.2" href="#section-7.2">7.2</a>. Informative References</span>
25552555+25562556+ [<a id="ref-RFC2195">RFC2195</a>] Klensin, J., Catoe, R., and P. Krumviede, "IMAP/POP
25572557+ AUTHorize Extension for Simple Challenge/Response",
25582558+ <a href="/doc/html/rfc2195">RFC 2195</a>, DOI 10.17487/RFC2195, September 1997,
25592559+ <<a href="http://www.rfc-editor.org/info/rfc2195">http://www.rfc-editor.org/info/rfc2195</a>>.
25602560+25612561+ [<a id="ref-RFC2617">RFC2617</a>] Franks, J., Hallam-Baker, P., Hostetler, J., Lawrence, S.,
25622562+ Leach, P., Luotonen, A., and L. Stewart, "HTTP
25632563+ Authentication: Basic and Digest Access Authentication",
25642564+ <a href="/doc/html/rfc2617">RFC 2617</a>, DOI 10.17487/RFC2617, June 1999,
25652565+ <<a href="http://www.rfc-editor.org/info/rfc2617">http://www.rfc-editor.org/info/rfc2617</a>>.
25662566+25672567+ [<a id="ref-RFC2818">RFC2818</a>] Rescorla, E., "HTTP Over TLS", <a href="/doc/html/rfc2818">RFC 2818</a>,
25682568+ DOI 10.17487/RFC2818, May 2000,
25692569+ <<a href="http://www.rfc-editor.org/info/rfc2818">http://www.rfc-editor.org/info/rfc2818</a>>.
25702570+25712571+ [<a id="ref-RFC4513">RFC4513</a>] Harrison, R., Ed., "Lightweight Directory Access Protocol
25722572+ (LDAP): Authentication Methods and Security Mechanisms",
25732573+ <a href="/doc/html/rfc4513">RFC 4513</a>, DOI 10.17487/RFC4513, June 2006,
25742574+ <<a href="http://www.rfc-editor.org/info/rfc4513">http://www.rfc-editor.org/info/rfc4513</a>>.
25752575+25762576+ [<a id="ref-RFC5226">RFC5226</a>] Narten, T. and H. Alvestrand, "Guidelines for Writing an
25772577+ IANA Considerations Section in RFCs", <a href="/doc/html/bcp26">BCP 26</a>, <a href="/doc/html/rfc5226">RFC 5226</a>,
25782578+ DOI 10.17487/RFC5226, May 2008,
25792579+ <<a href="http://www.rfc-editor.org/info/rfc5226">http://www.rfc-editor.org/info/rfc5226</a>>.
25802580+25812581+ [<a id="ref-RFC7617">RFC7617</a>] Reschke, J., "The 'Basic' HTTP Authentication Scheme",
25822582+ <a href="/doc/html/rfc7617">RFC 7617</a>, DOI 10.17487/RFC7617, September 2015,
25832583+ <<a href="http://www.rfc-editor.org/info/rfc7617">http://www.rfc-editor.org/info/rfc7617</a>>.
25842584+25852585+25862586+25872587+25882588+25892589+25902590+25912591+25922592+25932593+25942594+<span class="grey">Shekh-Yusef, et al. Standards Track [Page 30]</span></pre>
25952595+<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-31" ></span>
25962596+<span class="grey"><a href="/doc/html/rfc7616">RFC 7616</a> HTTP Digest Access Authentication September 2015</span>
25972597+25982598+25992599+<span class="h2"><a class="selflink" id="appendix-A" href="#appendix-A">Appendix A</a>. Changes from <a href="/doc/html/rfc2617">RFC 2617</a></span>
26002600+26012601+ This document introduces the following changes:
26022602+26032603+ o Adds support for two new algorithms, SHA2-256 as mandatory and
26042604+ SHA2-512/256 as a backup, and defines the proper algorithm
26052605+ negotiation. The document keeps the MD5 algorithm support but
26062606+ only for backward compatibility.
26072607+26082608+ o Introduces the username hashing capability and the parameter
26092609+ associated with that, mainly for privacy reasons.
26102610+26112611+ o Adds various internationalization considerations that impact the
26122612+ A1 calculation and username and password encoding.
26132613+26142614+ o Introduces a new IANA registry, "Hash Algorithms for HTTP Digest
26152615+ Authentication", that lists the hash algorithms that can be used
26162616+ in HTTP Digest Authentication.
26172617+26182618+ o Deprecates backward compatibility with <a href="/doc/html/rfc2069">RFC 2069</a>.
26192619+26202620+Acknowledgments
26212621+26222622+ To provide a complete description for the Digest mechanism and its
26232623+ operation, this document borrows text heavily from [<a href="/doc/html/rfc2617" title=""HTTP Authentication: Basic and Digest Access Authentication"">RFC2617</a>]. The
26242624+ authors of this document would like to thank John Franks, Phillip M.
26252625+ Hallam-Baker, Jeffery L. Hostetler, Scott D. Lawrence, Paul J. Leach,
26262626+ Ari Luotonen, and Lawrence C. Stewart for their work on that
26272627+ specification.
26282628+26292629+ Special thanks to Julian Reschke for his many reviews, comments,
26302630+ suggestions, and text provided to various areas in this document.
26312631+26322632+ The authors would like to thank Stephen Farrell, Yoav Nir, Phillip
26332633+ Hallam-Baker, Manu Sporny, Paul Hoffman, Yaron Sheffer, Sean Turner,
26342634+ Geoff Baskwill, Eric Cooper, Bjoern Hoehrmann, Martin Durst, Peter
26352635+ Saint-Andre, Michael Sweet, Daniel Stenberg, Brett Tate, Paul Leach,
26362636+ Ilari Liusvaara, Gary Mort, Alexey Melnikov, Benjamin Kaduk, Kathleen
26372637+ Moriarty, Francis Dupont, Hilarie Orman, and Ben Campbell for their
26382638+ careful review and comments.
26392639+26402640+ The authors would like to thank Jonathan Stoke, Nico Williams, Harry
26412641+ Halpin, and Phil Hunt for their comments on the mailing list when
26422642+ discussing various aspects of this document.
26432643+26442644+ The authors would like to thank Paul Kyzivat and Dale Worley for
26452645+ their careful review and feedback on some aspects of this document.
26462646+26472647+26482648+26492649+26502650+<span class="grey">Shekh-Yusef, et al. Standards Track [Page 31]</span></pre>
26512651+<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-32" ></span>
26522652+<span class="grey"><a href="/doc/html/rfc7616">RFC 7616</a> HTTP Digest Access Authentication September 2015</span>
26532653+26542654+26552655+ The authors would like to thank Barry Leiba for his help with the
26562656+ registry.
26572657+26582658+Authors' Addresses
26592659+26602660+ Rifaat Shekh-Yusef (editor)
26612661+ Avaya
26622662+ 250 Sidney Street
26632663+ Belleville, Ontario
26642664+ Canada
26652665+26662666+ Phone: +1-613-967-5267
26672667+ Email: rifaat.ietf@gmail.com
26682668+26692669+26702670+ David Ahrens
26712671+ Independent
26722672+ California
26732673+ United States
26742674+26752675+ Email: ahrensdc@gmail.com
26762676+26772677+26782678+ Sophie Bremer
26792679+ Netzkonform
26802680+ Germany
26812681+26822682+ Email: sophie.bremer@netzkonform.de
26832683+26842684+26852685+26862686+26872687+26882688+26892689+26902690+26912691+26922692+26932693+26942694+26952695+26962696+26972697+26982698+26992699+27002700+27012701+27022702+27032703+27042704+27052705+27062706+Shekh-Yusef, et al. Standards Track [Page 32]
27072707+</pre></div>
27082708+ </div>
27092709+27102710+ </div>
27112711+ <div class="d-print-none col-md-3 bg-light-subtle collapse show" id="sidebar">
27122712+ <div class="position-fixed border-start sidebar overflow-scroll overscroll-none no-scrollbar">
27132713+ <div class="d-flex flex-column vh-100 pt-2 pt-lg-3 ps-3 pl-md-2 pl-lg-3">
27142714+ <div>
27152715+ <a class="btn btn-primary btn-sm" href="/doc/rfc7616/">Datatracker</a>
27162716+ <p class="fw-bold pt-2">
27172717+27182718+ RFC 7616
27192719+27202720+ <br>
27212721+27222722+27232723+27242724+27252725+27262726+27272727+<span class="text-success">RFC
27282728+27292729+ - Proposed Standard
27302730+27312731+</span>
27322732+27332733+ </p>
27342734+ </div>
27352735+27362736+ <ul class="nav nav-tabs nav-fill small me-2" role="tablist">
27372737+ <li class="nav-item" role="presentation" title="Document information">
27382738+ <button class="nav-link px-2"
27392739+ id="docinfo-tab"
27402740+ data-bs-toggle="tab"
27412741+ data-bs-target="#docinfo-tab-pane"
27422742+ type="button"
27432743+ role="tab"
27442744+ aria-controls="docinfo-tab-pane"
27452745+ aria-selected="true">
27462746+ <i class="bi bi-info-circle"></i><span class="d-none d-md-block d-xl-inline ms-xl-1">Info</span>
27472747+ </button>
27482748+ </li>
27492749+ <li class="nav-item" role="presentation" title="Table of contents">
27502750+ <button class="nav-link px-2"
27512751+ id="toc-tab"
27522752+ data-bs-toggle="tab"
27532753+ data-bs-target="#toc-tab-pane"
27542754+ type="button"
27552755+ role="tab"
27562756+ aria-controls="toc-tab-pane"
27572757+ aria-selected="false">
27582758+ <i class="bi bi-list-ol"></i><span class="d-none d-md-block d-xl-inline ms-xl-1">Contents</span>
27592759+ </button>
27602760+ </li>
27612761+ <li class="nav-item" role="presentation" title="Preferences">
27622762+ <button class="nav-link px-2"
27632763+ id="pref-tab"
27642764+ data-bs-toggle="tab"
27652765+ data-bs-target="#pref-tab-pane"
27662766+ type="button"
27672767+ role="tab"
27682768+ aria-controls="pref-tab-pane"
27692769+ aria-selected="false">
27702770+ <i class="bi bi-gear"></i><span class="d-none d-md-block d-xl-inline ms-xl-1">Prefs</span>
27712771+ </button>
27722772+ </li>
27732773+ </ul>
27742774+ <div class="overflow-auto tab-content pt-2 me-2">
27752775+ <div class="tab-pane"
27762776+ id="docinfo-tab-pane"
27772777+ role="tabpanel"
27782778+ aria-labelledby="docinfo-tab"
27792779+ tabindex="0">
27802780+ <table class="table table-sm table-borderless">
27812781+27822782+27832783+27842784+27852785+27862786+27872787+27882788+27892789+<tbody class="meta align-top ">
27902790+ <tr>
27912791+ <th scope="row">Document</th>
27922792+ <th scope="row">Document type</th>
27932793+ <td class="edit"></td>
27942794+ <td>
27952795+27962796+27972797+27982798+27992799+28002800+28012801+<span class="text-success">RFC
28022802+28032803+ - Proposed Standard
28042804+28052805+</span>
28062806+28072807+28082808+28092809+ <br>September 2015
28102810+28112811+ <br>
28122812+28132813+ <a class="btn btn-primary btn-sm my-1"
28142814+ href="https://www.rfc-editor.org/errata_search.php?rfc=7616" title="Click to view errata." rel="nofollow">
28152815+ View errata
28162816+ </a>
28172817+28182818+28192819+ <a class="btn btn-sm btn-warning"
28202820+ title="Click to report an error in the document."
28212821+ href="https://www.rfc-editor.org/errata.php#reportnew"
28222822+ target="_blank">
28232823+ Report errata
28242824+ </a>
28252825+28262826+28272827+ <a title="Click to view IPR declarations." class="btn btn-warning btn-sm my-1" href="/ipr/search/?submit=draft&id=rfc7616">IPR</a>
28282828+28292829+28302830+28312831+ <div>Obsoletes <a href="/doc/html/rfc2617" title="HTTP Authentication: Basic and Digest Access Authentication">RFC 2617</a></div>
28322832+28332833+28342834+28352835+28362836+ <div>
28372837+ Was
28382838+ <a href="/doc/draft-ietf-httpauth-digest/19/">draft-ietf-httpauth-digest</a>
28392839+ (<a href="/wg/httpauth/about/">httpauth WG</a>)
28402840+ </div>
28412841+28422842+28432843+28442844+28452845+28462846+28472847+28482848+28492849+28502850+28512851+28522852+28532853+28542854+ </td>
28552855+ </tr>
28562856+28572857+ <tr>
28582858+ <td></td>
28592859+ <th scope="row">Select version</th>
28602860+ <td class="edit"></td>
28612861+ <td>
28622862+28632863+28642864+28652865+28662866+ <ul class="revision-list pagination pagination-sm text-center flex-wrap my-0">
28672867+28682868+28692869+28702870+28712871+ <li class="page-item">
28722872+ <a class="page-link"
28732873+ href="/doc/html/draft-ietf-httpauth-digest-00"
28742874+ rel="nofollow">
28752875+ 00
28762876+ </a>
28772877+ </li>
28782878+28792879+ <li class="page-item">
28802880+ <a class="page-link"
28812881+ href="/doc/html/draft-ietf-httpauth-digest-01"
28822882+ rel="nofollow">
28832883+ 01
28842884+ </a>
28852885+ </li>
28862886+28872887+ <li class="page-item">
28882888+ <a class="page-link"
28892889+ href="/doc/html/draft-ietf-httpauth-digest-02"
28902890+ rel="nofollow">
28912891+ 02
28922892+ </a>
28932893+ </li>
28942894+28952895+ <li class="page-item">
28962896+ <a class="page-link"
28972897+ href="/doc/html/draft-ietf-httpauth-digest-03"
28982898+ rel="nofollow">
28992899+ 03
29002900+ </a>
29012901+ </li>
29022902+29032903+ <li class="page-item">
29042904+ <a class="page-link"
29052905+ href="/doc/html/draft-ietf-httpauth-digest-04"
29062906+ rel="nofollow">
29072907+ 04
29082908+ </a>
29092909+ </li>
29102910+29112911+ <li class="page-item">
29122912+ <a class="page-link"
29132913+ href="/doc/html/draft-ietf-httpauth-digest-05"
29142914+ rel="nofollow">
29152915+ 05
29162916+ </a>
29172917+ </li>
29182918+29192919+ <li class="page-item">
29202920+ <a class="page-link"
29212921+ href="/doc/html/draft-ietf-httpauth-digest-06"
29222922+ rel="nofollow">
29232923+ 06
29242924+ </a>
29252925+ </li>
29262926+29272927+ <li class="page-item">
29282928+ <a class="page-link"
29292929+ href="/doc/html/draft-ietf-httpauth-digest-07"
29302930+ rel="nofollow">
29312931+ 07
29322932+ </a>
29332933+ </li>
29342934+29352935+ <li class="page-item">
29362936+ <a class="page-link"
29372937+ href="/doc/html/draft-ietf-httpauth-digest-08"
29382938+ rel="nofollow">
29392939+ 08
29402940+ </a>
29412941+ </li>
29422942+29432943+ <li class="page-item">
29442944+ <a class="page-link"
29452945+ href="/doc/html/draft-ietf-httpauth-digest-09"
29462946+ rel="nofollow">
29472947+ 09
29482948+ </a>
29492949+ </li>
29502950+29512951+ <li class="page-item">
29522952+ <a class="page-link"
29532953+ href="/doc/html/draft-ietf-httpauth-digest-10"
29542954+ rel="nofollow">
29552955+ 10
29562956+ </a>
29572957+ </li>
29582958+29592959+ <li class="page-item">
29602960+ <a class="page-link"
29612961+ href="/doc/html/draft-ietf-httpauth-digest-11"
29622962+ rel="nofollow">
29632963+ 11
29642964+ </a>
29652965+ </li>
29662966+29672967+ <li class="page-item">
29682968+ <a class="page-link"
29692969+ href="/doc/html/draft-ietf-httpauth-digest-12"
29702970+ rel="nofollow">
29712971+ 12
29722972+ </a>
29732973+ </li>
29742974+29752975+ <li class="page-item">
29762976+ <a class="page-link"
29772977+ href="/doc/html/draft-ietf-httpauth-digest-13"
29782978+ rel="nofollow">
29792979+ 13
29802980+ </a>
29812981+ </li>
29822982+29832983+ <li class="page-item">
29842984+ <a class="page-link"
29852985+ href="/doc/html/draft-ietf-httpauth-digest-14"
29862986+ rel="nofollow">
29872987+ 14
29882988+ </a>
29892989+ </li>
29902990+29912991+ <li class="page-item">
29922992+ <a class="page-link"
29932993+ href="/doc/html/draft-ietf-httpauth-digest-15"
29942994+ rel="nofollow">
29952995+ 15
29962996+ </a>
29972997+ </li>
29982998+29992999+ <li class="page-item">
30003000+ <a class="page-link"
30013001+ href="/doc/html/draft-ietf-httpauth-digest-16"
30023002+ rel="nofollow">
30033003+ 16
30043004+ </a>
30053005+ </li>
30063006+30073007+ <li class="page-item">
30083008+ <a class="page-link"
30093009+ href="/doc/html/draft-ietf-httpauth-digest-17"
30103010+ rel="nofollow">
30113011+ 17
30123012+ </a>
30133013+ </li>
30143014+30153015+ <li class="page-item">
30163016+ <a class="page-link"
30173017+ href="/doc/html/draft-ietf-httpauth-digest-18"
30183018+ rel="nofollow">
30193019+ 18
30203020+ </a>
30213021+ </li>
30223022+30233023+ <li class="page-item">
30243024+ <a class="page-link"
30253025+ href="/doc/html/draft-ietf-httpauth-digest-19"
30263026+ rel="nofollow">
30273027+ 19
30283028+ </a>
30293029+ </li>
30303030+30313031+30323032+30333033+ <li class="page-item rfc active">
30343034+ <a class="page-link"
30353035+ href="/doc/html/rfc7616">
30363036+ RFC 7616
30373037+ </a>
30383038+ </li>
30393039+30403040+ </ul>
30413041+30423042+ </td>
30433043+ </tr>
30443044+30453045+ <tr>
30463046+ <td></td>
30473047+ <th scope="row">Compare versions</th>
30483048+ <td class="edit"></td>
30493049+ <td>
30503050+30513051+30523052+30533053+30543054+<form class="form-horizontal diff-form"
30553055+ action="https://author-tools.ietf.org/iddiff"
30563056+ method="get"
30573057+ target="_blank">
30583058+30593059+ <select class="form-select form-select-sm mb-1 select2-field"
30603060+ data-max-entries="1"
30613061+ data-width="resolve"
30623062+ data-allow-clear="false"
30633063+ data-minimum-input-length="0"
30643064+ aria-label="From revision"
30653065+ name="url1">
30663066+30673067+ <option value="rfc7616">
30683068+ RFC 7616
30693069+30703070+ </option>
30713071+30723072+ <option value="draft-ietf-httpauth-digest-19" selected>
30733073+ draft-ietf-httpauth-digest-19
30743074+30753075+ </option>
30763076+30773077+ <option value="draft-ietf-httpauth-digest-18">
30783078+ draft-ietf-httpauth-digest-18
30793079+30803080+ </option>
30813081+30823082+ <option value="draft-ietf-httpauth-digest-17">
30833083+ draft-ietf-httpauth-digest-17
30843084+30853085+ </option>
30863086+30873087+ <option value="draft-ietf-httpauth-digest-16">
30883088+ draft-ietf-httpauth-digest-16
30893089+30903090+ </option>
30913091+30923092+ <option value="draft-ietf-httpauth-digest-15">
30933093+ draft-ietf-httpauth-digest-15
30943094+30953095+ </option>
30963096+30973097+ <option value="draft-ietf-httpauth-digest-14">
30983098+ draft-ietf-httpauth-digest-14
30993099+31003100+ </option>
31013101+31023102+ <option value="draft-ietf-httpauth-digest-13">
31033103+ draft-ietf-httpauth-digest-13
31043104+31053105+ </option>
31063106+31073107+ <option value="draft-ietf-httpauth-digest-12">
31083108+ draft-ietf-httpauth-digest-12
31093109+31103110+ </option>
31113111+31123112+ <option value="draft-ietf-httpauth-digest-11">
31133113+ draft-ietf-httpauth-digest-11
31143114+31153115+ </option>
31163116+31173117+ <option value="draft-ietf-httpauth-digest-10">
31183118+ draft-ietf-httpauth-digest-10
31193119+31203120+ </option>
31213121+31223122+ <option value="draft-ietf-httpauth-digest-09">
31233123+ draft-ietf-httpauth-digest-09
31243124+31253125+ </option>
31263126+31273127+ <option value="draft-ietf-httpauth-digest-08">
31283128+ draft-ietf-httpauth-digest-08
31293129+31303130+ </option>
31313131+31323132+ <option value="draft-ietf-httpauth-digest-07">
31333133+ draft-ietf-httpauth-digest-07
31343134+31353135+ </option>
31363136+31373137+ <option value="draft-ietf-httpauth-digest-06">
31383138+ draft-ietf-httpauth-digest-06
31393139+31403140+ </option>
31413141+31423142+ <option value="draft-ietf-httpauth-digest-05">
31433143+ draft-ietf-httpauth-digest-05
31443144+31453145+ </option>
31463146+31473147+ <option value="draft-ietf-httpauth-digest-04">
31483148+ draft-ietf-httpauth-digest-04
31493149+31503150+ </option>
31513151+31523152+ <option value="draft-ietf-httpauth-digest-03">
31533153+ draft-ietf-httpauth-digest-03
31543154+31553155+ </option>
31563156+31573157+ <option value="draft-ietf-httpauth-digest-02">
31583158+ draft-ietf-httpauth-digest-02
31593159+31603160+ </option>
31613161+31623162+ <option value="draft-ietf-httpauth-digest-01">
31633163+ draft-ietf-httpauth-digest-01
31643164+31653165+ </option>
31663166+31673167+ <option value="draft-ietf-httpauth-digest-00">
31683168+ draft-ietf-httpauth-digest-00
31693169+31703170+ </option>
31713171+31723172+31733173+ </select>
31743174+31753175+ <select class="form-select form-select-sm mb-1 select2-field"
31763176+ data-max-entries="1"
31773177+ data-width="resolve"
31783178+ data-allow-clear="false"
31793179+ data-minimum-input-length="0"
31803180+ aria-label="To revision"
31813181+ name="url2">
31823182+31833183+ <option value="rfc7616" selected>
31843184+ RFC 7616
31853185+31863186+ </option>
31873187+31883188+ <option value="draft-ietf-httpauth-digest-19">
31893189+ draft-ietf-httpauth-digest-19
31903190+31913191+ </option>
31923192+31933193+ <option value="draft-ietf-httpauth-digest-18">
31943194+ draft-ietf-httpauth-digest-18
31953195+31963196+ </option>
31973197+31983198+ <option value="draft-ietf-httpauth-digest-17">
31993199+ draft-ietf-httpauth-digest-17
32003200+32013201+ </option>
32023202+32033203+ <option value="draft-ietf-httpauth-digest-16">
32043204+ draft-ietf-httpauth-digest-16
32053205+32063206+ </option>
32073207+32083208+ <option value="draft-ietf-httpauth-digest-15">
32093209+ draft-ietf-httpauth-digest-15
32103210+32113211+ </option>
32123212+32133213+ <option value="draft-ietf-httpauth-digest-14">
32143214+ draft-ietf-httpauth-digest-14
32153215+32163216+ </option>
32173217+32183218+ <option value="draft-ietf-httpauth-digest-13">
32193219+ draft-ietf-httpauth-digest-13
32203220+32213221+ </option>
32223222+32233223+ <option value="draft-ietf-httpauth-digest-12">
32243224+ draft-ietf-httpauth-digest-12
32253225+32263226+ </option>
32273227+32283228+ <option value="draft-ietf-httpauth-digest-11">
32293229+ draft-ietf-httpauth-digest-11
32303230+32313231+ </option>
32323232+32333233+ <option value="draft-ietf-httpauth-digest-10">
32343234+ draft-ietf-httpauth-digest-10
32353235+32363236+ </option>
32373237+32383238+ <option value="draft-ietf-httpauth-digest-09">
32393239+ draft-ietf-httpauth-digest-09
32403240+32413241+ </option>
32423242+32433243+ <option value="draft-ietf-httpauth-digest-08">
32443244+ draft-ietf-httpauth-digest-08
32453245+32463246+ </option>
32473247+32483248+ <option value="draft-ietf-httpauth-digest-07">
32493249+ draft-ietf-httpauth-digest-07
32503250+32513251+ </option>
32523252+32533253+ <option value="draft-ietf-httpauth-digest-06">
32543254+ draft-ietf-httpauth-digest-06
32553255+32563256+ </option>
32573257+32583258+ <option value="draft-ietf-httpauth-digest-05">
32593259+ draft-ietf-httpauth-digest-05
32603260+32613261+ </option>
32623262+32633263+ <option value="draft-ietf-httpauth-digest-04">
32643264+ draft-ietf-httpauth-digest-04
32653265+32663266+ </option>
32673267+32683268+ <option value="draft-ietf-httpauth-digest-03">
32693269+ draft-ietf-httpauth-digest-03
32703270+32713271+ </option>
32723272+32733273+ <option value="draft-ietf-httpauth-digest-02">
32743274+ draft-ietf-httpauth-digest-02
32753275+32763276+ </option>
32773277+32783278+ <option value="draft-ietf-httpauth-digest-01">
32793279+ draft-ietf-httpauth-digest-01
32803280+32813281+ </option>
32823282+32833283+ <option value="draft-ietf-httpauth-digest-00">
32843284+ draft-ietf-httpauth-digest-00
32853285+32863286+ </option>
32873287+32883288+32893289+ </select>
32903290+32913291+ <button type="submit"
32923292+ class="btn btn-primary btn-sm"
32933293+ value="--html"
32943294+ name="difftype">
32953295+ Side-by-side
32963296+ </button>
32973297+32983298+ <button type="submit"
32993299+ class="btn btn-primary btn-sm"
33003300+ value="--hwdiff"
33013301+ name="difftype">
33023302+ Inline
33033303+ </button>
33043304+33053305+</form>
33063306+ </td>
33073307+ </tr>
33083308+33093309+33103310+ <tr>
33113311+ <td></td>
33123312+ <th scope="row">Authors</th>
33133313+ <td class="edit">
33143314+33153315+ </td>
33163316+ <td>
33173317+33183318+33193319+ <span ><a
33203320+ title="Datatracker profile of Rifaat Shekh-Yusef"
33213321+ href="/person/rifaat.s.ietf@gmail.com" >Rifaat Shekh-Yusef</a> <a
33223322+ href="mailto:rifaat.s.ietf%40gmail.com"
33233323+ aria-label="Compose email to rifaat.s.ietf@gmail.com"
33243324+ title="Compose email to rifaat.s.ietf@gmail.com">
33253325+ <i class="bi bi-envelope"></i></a></span>,
33263326+33273327+ <span ><a
33283328+ title="Datatracker profile of David Ahrens"
33293329+ href="/person/ahrensdc@gmail.com" >David Ahrens</a> <a
33303330+ href="mailto:ahrensdc%40gmail.com"
33313331+ aria-label="Compose email to ahrensdc@gmail.com"
33323332+ title="Compose email to ahrensdc@gmail.com">
33333333+ <i class="bi bi-envelope"></i></a></span>,
33343334+33353335+ <span ><a
33363336+ title="Datatracker profile of Sophie Bremer"
33373337+ href="/person/ietf@sophiebremer.com" >Sophie Bremer</a> <a
33383338+ href="mailto:ietf%40sophiebremer.com"
33393339+ aria-label="Compose email to ietf@sophiebremer.com"
33403340+ title="Compose email to ietf@sophiebremer.com">
33413341+ <i class="bi bi-envelope"></i></a></span>
33423342+33433343+33443344+ <br>
33453345+ <a class="btn btn-primary btn-sm mt-1" href="mailto:rfc7616@ietf.org?subject=rfc7616" title="Send email to the document authors">Email authors</a>
33463346+33473347+ </td>
33483348+ </tr>
33493349+33503350+33513351+ <tr>
33523352+ <td></td>
33533353+ <th scope="row">
33543354+ RFC stream
33553355+ </th>
33563356+ <td class="edit">
33573357+33583358+ </td>
33593359+ <td >
33603360+33613361+33623362+33633363+33643364+33653365+33663366+33673367+33683368+<img alt="IETF Logo"
33693369+ class="d-lm-none w-25 mt-1"
33703370+33713371+33723372+33733373+ src="https://static.ietf.org/dt/12.54.0/ietf/images/ietf-logo-nor-white.svg"
33743374+33753375+33763376+ >
33773377+33783378+<img alt="IETF Logo"
33793379+ class="d-dm-none w-25 mt-1"
33803380+33813381+33823382+33833383+ src="https://static.ietf.org/dt/12.54.0/ietf/images/ietf-logo-nor.svg"
33843384+33853385+33863386+ >
33873387+33883388+33893389+33903390+33913391+ </td>
33923392+ </tr>
33933393+33943394+ <tr>
33953395+ <td></td>
33963396+ <th scope="row">
33973397+ Other formats
33983398+ </th>
33993399+ <td class="edit">
34003400+ </td>
34013401+ <td>
34023402+34033403+34043404+ <div class="buttonlist">
34053405+34063406+34073407+ <a class="btn btn-primary btn-sm"
34083408+34093409+ target="_blank"
34103410+ href="https://www.rfc-editor.org/rfc/rfc7616.txt">
34113411+34123412+ <i class="bi bi-file-text"></i> txt
34133413+34143414+ </a>
34153415+34163416+34173417+34183418+ <a class="btn btn-primary btn-sm"
34193419+34203420+ target="_blank"
34213421+ href="https://www.rfc-editor.org/rfc/rfc7616.html">
34223422+34233423+ <i class="bi bi-file-code"></i> html
34243424+34253425+ </a>
34263426+34273427+34283428+34293429+ <a class="btn btn-primary btn-sm"
34303430+34313431+ download="rfc7616.pdf"
34323432+34333433+34343434+ target="_blank"
34353435+ href="https://www.rfc-editor.org/rfc/pdfrfc/rfc7616.txt.pdf">
34363436+34373437+ <i class="bi bi-file-pdf"></i> pdf
34383438+34393439+ </a>
34403440+34413441+34423442+34433443+34443444+34453445+ <a class="btn btn-primary btn-sm"
34463446+34473447+ target="_blank"
34483448+ href="https://www.rfc-editor.org/rfc/inline-errata/rfc7616.html">
34493449+34503450+ <i class="bi bi-file-diff"></i> w/errata
34513451+34523452+ </a>
34533453+34543454+34553455+34563456+ <a class="btn btn-primary btn-sm"
34573457+34583458+ target="_blank"
34593459+ href="/doc/rfc7616/bibtex/">
34603460+34613461+ <i class="bi bi-file-ruled"></i> bibtex
34623462+34633463+ </a>
34643464+34653465+34663466+</div>
34673467+34683468+34693469+ </td>
34703470+ </tr>
34713471+34723472+34733473+34743474+ <tr>
34753475+ <td>
34763476+ </td>
34773477+ <th scope="row">
34783478+ Additional resources
34793479+ </th>
34803480+ <td class="edit">
34813481+34823482+ </td>
34833483+ <td>
34843484+34853485+34863486+34873487+34883488+ <a href="https://mailarchive.ietf.org/arch/browse/http-auth/?q=rfc7616 OR %22draft-ietf-httpauth-digest%22">
34893489+ Mailing list discussion
34903490+ </a>
34913491+34923492+34933493+34943494+ </td>
34953495+ </tr>
34963496+34973497+34983498+</tbody>
34993499+ </table>
35003500+ <a class="btn btn-sm btn-warning mb-3"
35013501+ target="_blank"
35023502+ href="https://github.com/ietf-tools/datatracker/issues/new/choose">
35033503+ Report a datatracker bug
35043504+ <i class="bi bi-bug"></i>
35053505+ </a>
35063506+ </div>
35073507+ <div class="tab-pane mb-5"
35083508+ id="toc-tab-pane"
35093509+ role="tabpanel"
35103510+ aria-labelledby="toc-tab"
35113511+ tabindex="0">
35123512+ <nav class="nav nav-pills flex-column small" id="toc-nav">
35133513+ </nav>
35143514+ </div>
35153515+ <div class="tab-pane mb-5 small"
35163516+ id="pref-tab-pane"
35173517+ role="tabpanel"
35183518+ aria-labelledby="pref-tab"
35193519+ tabindex="0">
35203520+ <label class="form-label fw-bold mb-2">Show sidebar by default</label>
35213521+ <div class="btn-group-vertical btn-group-sm d-flex" role="group">
35223522+ <input type="radio" class="btn-check" name="sidebar" id="on-radio">
35233523+ <label class="btn btn-outline-primary" for="on-radio">Yes</label>
35243524+ <input type="radio" class="btn-check" name="sidebar" id="off-radio">
35253525+ <label class="btn btn-outline-primary" for="off-radio">No</label>
35263526+ </div>
35273527+ <label class="form-label fw-bold mt-4 mb-2">Tab to show by default</label>
35283528+ <div class="btn-group-vertical btn-group-sm d-flex" role="group">
35293529+ <input type="radio" class="btn-check" name="deftab" id="docinfo-radio">
35303530+ <label class="btn btn-outline-primary" for="docinfo-radio">
35313531+ <i class="bi bi-info-circle me-1"></i>Info
35323532+ </label>
35333533+ <input type="radio" class="btn-check" name="deftab" id="toc-radio">
35343534+ <label class="btn btn-outline-primary" for="toc-radio">
35353535+ <i class="bi bi-list-ol me-1"></i>Contents
35363536+ </label>
35373537+ </div>
35383538+ <label class="form-label fw-bold mt-4 mb-2">HTMLization configuration</label>
35393539+ <div class="btn-group-vertical btn-group-sm d-flex" role="group">
35403540+ <input type="radio" class="btn-check" name="htmlconf" id="txt-radio">
35413541+ <label class="btn btn-outline-primary" for="txt-radio" title="This is the traditional HTMLization method.">
35423542+ <i class="bi bi-badge-sd me-1"></i>HTMLize the plaintext
35433543+ </label>
35443544+ <input type="radio" class="btn-check" name="htmlconf" id="html-radio">
35453545+ <label class="btn btn-outline-primary" for="html-radio" title="This is the modern HTMLization method.">
35463546+ <i class="bi bi-badge-hd me-1"></i>Plaintextify the HTML
35473547+ </label>
35483548+ </div>
35493549+ <label class="form-label fw-bold mt-4 mb-2" for="ptsize">Maximum font size</label>
35503550+ <input type="range" class="form-range" min="7" max="16" id="ptsize" oninput="ptdemo.value = ptsize.value">
35513551+ <label class="form-label fw-bold mt-4 mb-2">Page dependencies</label>
35523552+ <div class="btn-group-vertical btn-group-sm d-flex" role="group">
35533553+ <input type="radio" class="btn-check" name="pagedeps" id="inline-radio">
35543554+ <label class="btn btn-outline-primary" for="inline-radio" title="Generate larger, standalone web pages that do not require network access to render.">
35553555+ <i class="bi bi-box me-1"></i>Inline
35563556+ </label>
35573557+ <input type="radio" class="btn-check" name="pagedeps" id="reference-radio">
35583558+ <label class="btn btn-outline-primary" for="reference-radio" title="Generate regular web pages that require network access to render.">
35593559+ <i class="bi bi-link-45deg me-1"></i>Reference
35603560+ </label>
35613561+ </div>
35623562+ <label class="form-label fw-bold mt-4 mb-2">Citation links</label>
35633563+ <div class="btn-group-vertical btn-group-sm d-flex" role="group">
35643564+ <input type="radio" class="btn-check" name="reflinks" id="refsection-radio">
35653565+ <label class="btn btn-outline-primary" for="refsection-radio" title="Citation links go to the reference section.">
35663566+ <i class="bi bi-arrow-clockwise"></i> Go to reference section
35673567+ </label>
35683568+ <input type="radio" class="btn-check" name="reflinks" id="citation-radio">
35693569+ <label class="btn btn-outline-primary" for="citation-radio" title="Citation links go directly to the cited document.">
35703570+ <i class="bi bi-link-45deg me-1"></i>Go to linked document
35713571+ </label>
35723572+ </div>
35733573+ </div>
35743574+ </div>
35753575+ </div>
35763576+ </div>
35773577+ </div>
35783578+ </div>
35793579+35803580+<script>
35813581+ var _paq = window._paq || [];
35823582+35833583+ _paq.push(['disableCookies']);
35843584+ _paq.push(['trackPageView']);
35853585+ _paq.push(['enableLinkTracking']);
35863586+ (function() {
35873587+ var u="//analytics.ietf.org/";
35883588+ _paq.push(['setTrackerUrl', u+'matomo.php']);
35893589+ _paq.push(['setSiteId', 7]);
35903590+ var d=document, g=d.createElement('script'), s=d.getElementsByTagName('script')[0];
35913591+ g.type='text/javascript'; g.async=true; g.defer=true; g.src=u+'matomo.js'; s.parentNode.insertBefore(g,s);
35923592+ })();
35933593+</script>
35943594+<noscript><p><img src="//analytics.ietf.org/matomo.php?idsite=7" style="border:0;" alt="" /></p></noscript>
35953595+35963596+ </body>
35973597+</html>
+5022
spec/rfc9111.txt
···11+22+<!DOCTYPE html>
33+44+55+66+77+88+99+1010+<html data-bs-theme="auto" lang="en">
1111+ <head>
1212+1313+ <meta charset="utf-8">
1414+ <meta http-equiv="X-UA-Compatible" content="IE=edge">
1515+ <title>
1616+1717+ RFC 9111 - HTTP Caching
1818+1919+ </title>
2020+ <meta name="viewport" content="width=device-width, initial-scale=1">
2121+ <link href="https://static.ietf.org/fonts/inter/import.css" rel="stylesheet">
2222+ <link href="https://static.ietf.org/fonts/noto-sans-mono/import.css" rel="stylesheet">
2323+2424+ <link rel="stylesheet" href="https://static.ietf.org/dt/12.54.0/ietf/css/document_html_referenced.css">
2525+2626+ <link rel="stylesheet" href="https://static.ietf.org/dt/12.54.0/ietf/css/document_html_txt.css">
2727+2828+ <script type="module" crossorigin="" src="https://static.ietf.org/dt/12.54.0/assets/embedded-055c333d.js"></script>
2929+<link href="https://static.ietf.org/dt/12.54.0/assets/create-pinia-singleton-8312c5df.js" type="text/javascript" crossorigin="anonymous" rel="modulepreload" as="script" />
3030+<link href="https://static.ietf.org/dt/12.54.0/assets/Scrollbar-ad8c5330.js" type="text/javascript" crossorigin="anonymous" rel="modulepreload" as="script" />
3131+ <script src="https://static.ietf.org/dt/12.54.0/ietf/js/document_html.js"></script>
3232+ <script src="https://static.ietf.org/dt/12.54.0/ietf/js/theme.js"></script>
3333+3434+ <link rel="alternate" type="application/atom+xml" title="Document changes" href="/feed/document-changes/rfc9111/">
3535+ <meta name="description"
3636+3737+ content="HTTP Caching (RFC 9111, )"
3838+ >
3939+4040+4141+<link rel="apple-touch-icon"
4242+ sizes="180x180"
4343+ href="https://static.ietf.org/dt/12.54.0/ietf/images/ietf-logo-nor-180.png">
4444+<link rel="icon"
4545+ sizes="32x32"
4646+ href="https://static.ietf.org/dt/12.54.0/ietf/images/ietf-logo-nor-32.png">
4747+<link rel="icon"
4848+ sizes="16x16"
4949+ href="https://static.ietf.org/dt/12.54.0/ietf/images/ietf-logo-nor-16.png">
5050+<link rel="manifest" href="/site.webmanifest">
5151+<link rel="mask-icon"
5252+ href="https://static.ietf.org/dt/12.54.0/ietf/images/ietf-logo-nor-mask.svg"
5353+ color="#ffffff">
5454+<meta name="msapplication-TileColor"
5555+ content="#ffffff">
5656+<meta name="theme-color"
5757+ content="#ffffff">
5858+5959+6060+6161+6262+6363+<meta property="og:title" content="RFC 9111: HTTP Caching">
6464+<meta property="og:url" content="https://datatracker.ietf.org/doc/html/rfc9111.txt">
6565+<link rel="canonical" href="https://datatracker.ietf.org/doc/html/rfc9111.txt">
6666+<meta property="og:site_name" content="IETF Datatracker">
6767+<meta property="og:description" content="The Hypertext Transfer Protocol (HTTP) is a stateless application-level protocol for distributed, collaborative, hypertext information systems. This document defines HTTP caches and the associated header fields that control cache behavior or indicate cacheable response messages. This document obsoletes RFC 7234.">
6868+<meta property="og:type" content="article">
6969+7070+<meta property="og:image" content="https://static.ietf.org/dt/12.54.0/ietf/images/ietf-logo-card.png">
7171+<meta property="og:image:alt" content="Logo of the IETF">
7272+<meta property="article:section" content="IETF - Internet Engineering Task Force">
7373+<meta property="og:image:type" content="image/png">
7474+<meta property="og:image:width" content="1200">
7575+<meta property="og:image:height" content="630">
7676+<meta name="twitter:card" content="summary_large_image">
7777+7878+<meta property="article:author" content="Roy T. Fielding">
7979+<meta property="article:author" content="Mark Nottingham">
8080+<meta property="article:author" content="Julian Reschke">
8181+8282+8383+8484+8585+ <style>
8686+8787+ .diff-form .select2-selection__rendered {
8888+ direction: rtl;
8989+ text-align: left;
9090+ }
9191+ </style>
9292+ </head>
9393+ <body>
9494+9595+ <noscript><iframe class="status" title="Site status" src="/status/latest"></iframe></noscript>
9696+<div class="vue-embed" data-component="Status"></div>
9797+ <div class="btn-toolbar sidebar-toolbar position-fixed top-0 end-0 m-2 m-lg-3 d-print-none">
9898+ <div class="dropdown">
9999+ <button class="btn btn-outline-secondary btn-sm me-1 dropdown-toggle d-flex align-items-center"
100100+ id="bd-theme" type="button" aria-expanded="false" data-bs-toggle="dropdown"
101101+ aria-label="Toggle theme">
102102+ <i class="theme-icon-active bi bi-circle-half"></i>
103103+ </button>
104104+105105+ <ul class="dropdown-menu" aria-labelledby="bd-theme">
106106+ <li>
107107+ <button type="button" class="dropdown-item d-flex align-items-center"
108108+ data-bs-theme-value="light" aria-pressed="false">
109109+ <i class="me-2 opacity-50 theme-icon bi bi-sun-fill"></i>
110110+ Light<i class="bi bi-check2 ms-auto d-none"></i>
111111+ </button>
112112+ </li>
113113+ <li>
114114+ <button type="button" class="dropdown-item d-flex align-items-center"
115115+ data-bs-theme-value="dark" aria-pressed="false">
116116+ <i class="me-2 opacity-50 theme-icon bi bi-moon-stars-fill"></i>
117117+ Dark<i class="bi bi-check2 ms-auto d-none"></i>
118118+ </button>
119119+ </li>
120120+ <li>
121121+ <button type="button" class="dropdown-item d-flex align-items-center active"
122122+ data-bs-theme-value="auto" aria-pressed="true">
123123+ <i class="me-2 opacity-50 theme-icon bi bi-circle-half"></i>
124124+ Auto<i class="bi bi-check2 ms-auto d-none"></i>
125125+ </button>
126126+ </li>
127127+ </ul>
128128+ </div>
129129+ <button class="btn btn-outline-secondary btn-sm sidebar-toggle"
130130+ type="button"
131131+ data-bs-toggle="collapse"
132132+ data-bs-target="#sidebar"
133133+ aria-expanded="true"
134134+ aria-controls="sidebar"
135135+ aria-label="Toggle metadata sidebar"
136136+ title="Toggle metadata sidebar">
137137+ <i class="bi bi-arrow-bar-left sidebar-shown"></i>
138138+ <i class="bi bi-arrow-bar-right sidebar-collapsed"></i>
139139+ </button>
140140+ </div>
141141+ <nav class="navbar bg-light-subtle px-1 fixed-top d-print-none d-md-none">
142142+ <a class="nav-link ps-1"
143143+ href="/doc/rfc9111/">
144144+145145+ RFC 9111
146146+147147+ <br class="d-sm-none">
148148+149149+ <span class="ms-sm-3 badge rounded-pill badge-std">
150150+151151+ Internet Standard
152152+153153+ </span>
154154+ </a>
155155+ <button class="navbar-toggler p-1"
156156+ type="button"
157157+ data-bs-toggle="collapse"
158158+ data-bs-target="#docinfo-collapse"
159159+ aria-controls="docinfo-collapse"
160160+ aria-expanded="false"
161161+ aria-label="Show document information">
162162+ <span class="navbar-toggler-icon small"></span>
163163+ </button>
164164+ <div class="navbar-nav navbar-nav-scroll overscroll-none collapse pt-1" id="docinfo-collapse">
165165+ <div class="bg-light-subtle p-0">
166166+ <table class="table table-sm table-borderless small">
167167+ <tbody class="meta align-top">
168168+ <tr>
169169+ <th scope="row"></th>
170170+ <th scope="row">Title</th>
171171+ <td class="edit"></td>
172172+ <td>HTTP Caching</td>
173173+ </tr>
174174+ </tbody>
175175+176176+177177+178178+179179+180180+181181+182182+183183+<tbody class="meta align-top ">
184184+ <tr>
185185+ <th scope="row">Document</th>
186186+ <th scope="row">Document type</th>
187187+ <td class="edit"></td>
188188+ <td>
189189+190190+191191+192192+193193+194194+195195+<span class="text-success">RFC
196196+197197+ - Internet Standard
198198+199199+</span>
200200+201201+202202+203203+ <br>June 2022
204204+205205+ <br>
206206+207207+208208+ <a class="btn btn-sm btn-warning"
209209+ title="Click to report an error in the document."
210210+ href="https://www.rfc-editor.org/errata.php#reportnew"
211211+ target="_blank">
212212+ Report errata
213213+ </a>
214214+215215+216216+217217+218218+ <div>Obsoletes <a href="/doc/html/rfc7234" title="Hypertext Transfer Protocol (HTTP/1.1): Caching">RFC 7234</a></div>
219219+220220+221221+222222+223223+ <div>
224224+ Was
225225+ <a href="/doc/draft-ietf-httpbis-cache/19/">draft-ietf-httpbis-cache</a>
226226+ (<a href="/wg/httpbis/about/">httpbis WG</a>)
227227+ </div>
228228+229229+230230+231231+232232+233233+234234+235235+236236+237237+238238+239239+240240+241241+ </td>
242242+ </tr>
243243+244244+ <tr>
245245+ <td></td>
246246+ <th scope="row">Select version</th>
247247+ <td class="edit"></td>
248248+ <td>
249249+250250+251251+252252+253253+ <ul class="revision-list pagination pagination-sm text-center flex-wrap my-0">
254254+255255+256256+257257+258258+ <li class="page-item">
259259+ <a class="page-link"
260260+ href="/doc/html/draft-ietf-httpbis-cache-00"
261261+ rel="nofollow">
262262+ 00
263263+ </a>
264264+ </li>
265265+266266+ <li class="page-item">
267267+ <a class="page-link"
268268+ href="/doc/html/draft-ietf-httpbis-cache-01"
269269+ rel="nofollow">
270270+ 01
271271+ </a>
272272+ </li>
273273+274274+ <li class="page-item">
275275+ <a class="page-link"
276276+ href="/doc/html/draft-ietf-httpbis-cache-02"
277277+ rel="nofollow">
278278+ 02
279279+ </a>
280280+ </li>
281281+282282+ <li class="page-item">
283283+ <a class="page-link"
284284+ href="/doc/html/draft-ietf-httpbis-cache-03"
285285+ rel="nofollow">
286286+ 03
287287+ </a>
288288+ </li>
289289+290290+ <li class="page-item">
291291+ <a class="page-link"
292292+ href="/doc/html/draft-ietf-httpbis-cache-04"
293293+ rel="nofollow">
294294+ 04
295295+ </a>
296296+ </li>
297297+298298+ <li class="page-item">
299299+ <a class="page-link"
300300+ href="/doc/html/draft-ietf-httpbis-cache-05"
301301+ rel="nofollow">
302302+ 05
303303+ </a>
304304+ </li>
305305+306306+ <li class="page-item">
307307+ <a class="page-link"
308308+ href="/doc/html/draft-ietf-httpbis-cache-06"
309309+ rel="nofollow">
310310+ 06
311311+ </a>
312312+ </li>
313313+314314+ <li class="page-item">
315315+ <a class="page-link"
316316+ href="/doc/html/draft-ietf-httpbis-cache-07"
317317+ rel="nofollow">
318318+ 07
319319+ </a>
320320+ </li>
321321+322322+ <li class="page-item">
323323+ <a class="page-link"
324324+ href="/doc/html/draft-ietf-httpbis-cache-08"
325325+ rel="nofollow">
326326+ 08
327327+ </a>
328328+ </li>
329329+330330+ <li class="page-item">
331331+ <a class="page-link"
332332+ href="/doc/html/draft-ietf-httpbis-cache-09"
333333+ rel="nofollow">
334334+ 09
335335+ </a>
336336+ </li>
337337+338338+ <li class="page-item">
339339+ <a class="page-link"
340340+ href="/doc/html/draft-ietf-httpbis-cache-10"
341341+ rel="nofollow">
342342+ 10
343343+ </a>
344344+ </li>
345345+346346+ <li class="page-item">
347347+ <a class="page-link"
348348+ href="/doc/html/draft-ietf-httpbis-cache-11"
349349+ rel="nofollow">
350350+ 11
351351+ </a>
352352+ </li>
353353+354354+ <li class="page-item">
355355+ <a class="page-link"
356356+ href="/doc/html/draft-ietf-httpbis-cache-12"
357357+ rel="nofollow">
358358+ 12
359359+ </a>
360360+ </li>
361361+362362+ <li class="page-item">
363363+ <a class="page-link"
364364+ href="/doc/html/draft-ietf-httpbis-cache-13"
365365+ rel="nofollow">
366366+ 13
367367+ </a>
368368+ </li>
369369+370370+ <li class="page-item">
371371+ <a class="page-link"
372372+ href="/doc/html/draft-ietf-httpbis-cache-14"
373373+ rel="nofollow">
374374+ 14
375375+ </a>
376376+ </li>
377377+378378+ <li class="page-item">
379379+ <a class="page-link"
380380+ href="/doc/html/draft-ietf-httpbis-cache-15"
381381+ rel="nofollow">
382382+ 15
383383+ </a>
384384+ </li>
385385+386386+ <li class="page-item">
387387+ <a class="page-link"
388388+ href="/doc/html/draft-ietf-httpbis-cache-16"
389389+ rel="nofollow">
390390+ 16
391391+ </a>
392392+ </li>
393393+394394+ <li class="page-item">
395395+ <a class="page-link"
396396+ href="/doc/html/draft-ietf-httpbis-cache-17"
397397+ rel="nofollow">
398398+ 17
399399+ </a>
400400+ </li>
401401+402402+ <li class="page-item">
403403+ <a class="page-link"
404404+ href="/doc/html/draft-ietf-httpbis-cache-18"
405405+ rel="nofollow">
406406+ 18
407407+ </a>
408408+ </li>
409409+410410+ <li class="page-item">
411411+ <a class="page-link"
412412+ href="/doc/html/draft-ietf-httpbis-cache-19"
413413+ rel="nofollow">
414414+ 19
415415+ </a>
416416+ </li>
417417+418418+419419+420420+ <li class="page-item rfc active">
421421+ <a class="page-link"
422422+ href="/doc/html/rfc9111">
423423+ RFC 9111
424424+ </a>
425425+ </li>
426426+427427+ </ul>
428428+429429+ </td>
430430+ </tr>
431431+432432+ <tr>
433433+ <td></td>
434434+ <th scope="row">Compare versions</th>
435435+ <td class="edit"></td>
436436+ <td>
437437+438438+439439+440440+441441+<form class="form-horizontal diff-form"
442442+ action="https://author-tools.ietf.org/iddiff"
443443+ method="get"
444444+ target="_blank">
445445+446446+ <select class="form-select form-select-sm mb-1 select2-field"
447447+ data-max-entries="1"
448448+ data-width="resolve"
449449+ data-allow-clear="false"
450450+ data-minimum-input-length="0"
451451+ aria-label="From revision"
452452+ name="url1">
453453+454454+ <option value="rfc9111">
455455+ RFC 9111
456456+457457+ </option>
458458+459459+ <option value="draft-ietf-httpbis-cache-19" selected>
460460+ draft-ietf-httpbis-cache-19
461461+462462+ </option>
463463+464464+ <option value="draft-ietf-httpbis-cache-18">
465465+ draft-ietf-httpbis-cache-18
466466+467467+ </option>
468468+469469+ <option value="draft-ietf-httpbis-cache-17">
470470+ draft-ietf-httpbis-cache-17
471471+472472+ </option>
473473+474474+ <option value="draft-ietf-httpbis-cache-16">
475475+ draft-ietf-httpbis-cache-16
476476+477477+ </option>
478478+479479+ <option value="draft-ietf-httpbis-cache-15">
480480+ draft-ietf-httpbis-cache-15
481481+482482+ </option>
483483+484484+ <option value="draft-ietf-httpbis-cache-14">
485485+ draft-ietf-httpbis-cache-14
486486+487487+ </option>
488488+489489+ <option value="draft-ietf-httpbis-cache-13">
490490+ draft-ietf-httpbis-cache-13
491491+492492+ </option>
493493+494494+ <option value="draft-ietf-httpbis-cache-12">
495495+ draft-ietf-httpbis-cache-12
496496+497497+ </option>
498498+499499+ <option value="draft-ietf-httpbis-cache-11">
500500+ draft-ietf-httpbis-cache-11
501501+502502+ </option>
503503+504504+ <option value="draft-ietf-httpbis-cache-10">
505505+ draft-ietf-httpbis-cache-10
506506+507507+ </option>
508508+509509+ <option value="draft-ietf-httpbis-cache-09">
510510+ draft-ietf-httpbis-cache-09
511511+512512+ </option>
513513+514514+ <option value="draft-ietf-httpbis-cache-08">
515515+ draft-ietf-httpbis-cache-08
516516+517517+ </option>
518518+519519+ <option value="draft-ietf-httpbis-cache-07">
520520+ draft-ietf-httpbis-cache-07
521521+522522+ </option>
523523+524524+ <option value="draft-ietf-httpbis-cache-06">
525525+ draft-ietf-httpbis-cache-06
526526+527527+ </option>
528528+529529+ <option value="draft-ietf-httpbis-cache-05">
530530+ draft-ietf-httpbis-cache-05
531531+532532+ </option>
533533+534534+ <option value="draft-ietf-httpbis-cache-04">
535535+ draft-ietf-httpbis-cache-04
536536+537537+ </option>
538538+539539+ <option value="draft-ietf-httpbis-cache-03">
540540+ draft-ietf-httpbis-cache-03
541541+542542+ </option>
543543+544544+ <option value="draft-ietf-httpbis-cache-02">
545545+ draft-ietf-httpbis-cache-02
546546+547547+ </option>
548548+549549+ <option value="draft-ietf-httpbis-cache-01">
550550+ draft-ietf-httpbis-cache-01
551551+552552+ </option>
553553+554554+ <option value="draft-ietf-httpbis-cache-00">
555555+ draft-ietf-httpbis-cache-00
556556+557557+ </option>
558558+559559+560560+ </select>
561561+562562+ <select class="form-select form-select-sm mb-1 select2-field"
563563+ data-max-entries="1"
564564+ data-width="resolve"
565565+ data-allow-clear="false"
566566+ data-minimum-input-length="0"
567567+ aria-label="To revision"
568568+ name="url2">
569569+570570+ <option value="rfc9111" selected>
571571+ RFC 9111
572572+573573+ </option>
574574+575575+ <option value="draft-ietf-httpbis-cache-19">
576576+ draft-ietf-httpbis-cache-19
577577+578578+ </option>
579579+580580+ <option value="draft-ietf-httpbis-cache-18">
581581+ draft-ietf-httpbis-cache-18
582582+583583+ </option>
584584+585585+ <option value="draft-ietf-httpbis-cache-17">
586586+ draft-ietf-httpbis-cache-17
587587+588588+ </option>
589589+590590+ <option value="draft-ietf-httpbis-cache-16">
591591+ draft-ietf-httpbis-cache-16
592592+593593+ </option>
594594+595595+ <option value="draft-ietf-httpbis-cache-15">
596596+ draft-ietf-httpbis-cache-15
597597+598598+ </option>
599599+600600+ <option value="draft-ietf-httpbis-cache-14">
601601+ draft-ietf-httpbis-cache-14
602602+603603+ </option>
604604+605605+ <option value="draft-ietf-httpbis-cache-13">
606606+ draft-ietf-httpbis-cache-13
607607+608608+ </option>
609609+610610+ <option value="draft-ietf-httpbis-cache-12">
611611+ draft-ietf-httpbis-cache-12
612612+613613+ </option>
614614+615615+ <option value="draft-ietf-httpbis-cache-11">
616616+ draft-ietf-httpbis-cache-11
617617+618618+ </option>
619619+620620+ <option value="draft-ietf-httpbis-cache-10">
621621+ draft-ietf-httpbis-cache-10
622622+623623+ </option>
624624+625625+ <option value="draft-ietf-httpbis-cache-09">
626626+ draft-ietf-httpbis-cache-09
627627+628628+ </option>
629629+630630+ <option value="draft-ietf-httpbis-cache-08">
631631+ draft-ietf-httpbis-cache-08
632632+633633+ </option>
634634+635635+ <option value="draft-ietf-httpbis-cache-07">
636636+ draft-ietf-httpbis-cache-07
637637+638638+ </option>
639639+640640+ <option value="draft-ietf-httpbis-cache-06">
641641+ draft-ietf-httpbis-cache-06
642642+643643+ </option>
644644+645645+ <option value="draft-ietf-httpbis-cache-05">
646646+ draft-ietf-httpbis-cache-05
647647+648648+ </option>
649649+650650+ <option value="draft-ietf-httpbis-cache-04">
651651+ draft-ietf-httpbis-cache-04
652652+653653+ </option>
654654+655655+ <option value="draft-ietf-httpbis-cache-03">
656656+ draft-ietf-httpbis-cache-03
657657+658658+ </option>
659659+660660+ <option value="draft-ietf-httpbis-cache-02">
661661+ draft-ietf-httpbis-cache-02
662662+663663+ </option>
664664+665665+ <option value="draft-ietf-httpbis-cache-01">
666666+ draft-ietf-httpbis-cache-01
667667+668668+ </option>
669669+670670+ <option value="draft-ietf-httpbis-cache-00">
671671+ draft-ietf-httpbis-cache-00
672672+673673+ </option>
674674+675675+676676+ </select>
677677+678678+ <button type="submit"
679679+ class="btn btn-primary btn-sm"
680680+ value="--html"
681681+ name="difftype">
682682+ Side-by-side
683683+ </button>
684684+685685+ <button type="submit"
686686+ class="btn btn-primary btn-sm"
687687+ value="--hwdiff"
688688+ name="difftype">
689689+ Inline
690690+ </button>
691691+692692+</form>
693693+ </td>
694694+ </tr>
695695+696696+697697+ <tr>
698698+ <td></td>
699699+ <th scope="row">Authors</th>
700700+ <td class="edit">
701701+702702+ </td>
703703+ <td>
704704+705705+706706+ <span ><a
707707+ title="Datatracker profile of Roy T. Fielding"
708708+ href="/person/fielding@gbiv.com" >Roy T. Fielding</a> <a
709709+ href="mailto:fielding%40gbiv.com"
710710+ aria-label="Compose email to fielding@gbiv.com"
711711+ title="Compose email to fielding@gbiv.com">
712712+ <i class="bi bi-envelope"></i></a></span>,
713713+714714+ <span ><a
715715+ title="Datatracker profile of Mark Nottingham"
716716+ href="/person/mnot@mnot.net" >Mark Nottingham</a> <a
717717+ href="mailto:mnot%40mnot.net"
718718+ aria-label="Compose email to mnot@mnot.net"
719719+ title="Compose email to mnot@mnot.net">
720720+ <i class="bi bi-envelope"></i></a></span>,
721721+722722+ <span ><a
723723+ title="Datatracker profile of Julian Reschke"
724724+ href="/person/julian.reschke@gmx.de" >Julian Reschke</a> <a
725725+ href="mailto:julian.reschke%40gmx.de"
726726+ aria-label="Compose email to julian.reschke@gmx.de"
727727+ title="Compose email to julian.reschke@gmx.de">
728728+ <i class="bi bi-envelope"></i></a></span>
729729+730730+731731+ <br>
732732+ <a class="btn btn-primary btn-sm mt-1" href="mailto:rfc9111@ietf.org?subject=rfc9111" title="Send email to the document authors">Email authors</a>
733733+734734+ </td>
735735+ </tr>
736736+737737+738738+ <tr>
739739+ <td></td>
740740+ <th scope="row">
741741+ RFC stream
742742+ </th>
743743+ <td class="edit">
744744+745745+ </td>
746746+ <td >
747747+748748+749749+750750+751751+752752+753753+754754+755755+<img alt="IETF Logo"
756756+ class="d-lm-none w-25 mt-1"
757757+758758+759759+760760+ src="https://static.ietf.org/dt/12.54.0/ietf/images/ietf-logo-nor-white.svg"
761761+762762+763763+ >
764764+765765+<img alt="IETF Logo"
766766+ class="d-dm-none w-25 mt-1"
767767+768768+769769+770770+ src="https://static.ietf.org/dt/12.54.0/ietf/images/ietf-logo-nor.svg"
771771+772772+773773+ >
774774+775775+776776+777777+778778+ </td>
779779+ </tr>
780780+781781+ <tr>
782782+ <td></td>
783783+ <th scope="row">
784784+ Other formats
785785+ </th>
786786+ <td class="edit">
787787+ </td>
788788+ <td>
789789+790790+791791+ <div class="buttonlist">
792792+793793+794794+ <a class="btn btn-primary btn-sm"
795795+796796+ target="_blank"
797797+ href="https://www.rfc-editor.org/rfc/rfc9111.txt">
798798+799799+ <i class="bi bi-file-text"></i> txt
800800+801801+ </a>
802802+803803+804804+805805+ <a class="btn btn-primary btn-sm"
806806+807807+ target="_blank"
808808+ href="https://www.rfc-editor.org/rfc/rfc9111.html">
809809+810810+ <i class="bi bi-file-code"></i> html
811811+812812+ </a>
813813+814814+815815+816816+ <a class="btn btn-primary btn-sm"
817817+818818+ target="_blank"
819819+ href="https://www.rfc-editor.org/rfc/rfc9111.xml">
820820+821821+ <i class="bi bi-file-code"></i> xml
822822+823823+ </a>
824824+825825+826826+827827+ <a class="btn btn-primary btn-sm"
828828+829829+ download="rfc9111.pdf"
830830+831831+832832+ target="_blank"
833833+ href="https://www.rfc-editor.org/rfc/rfc9111.pdf">
834834+835835+ <i class="bi bi-file-pdf"></i> pdf
836836+837837+ </a>
838838+839839+840840+841841+842842+843843+ <a class="btn btn-primary btn-sm"
844844+845845+ target="_blank"
846846+ href="/doc/rfc9111/bibtex/">
847847+848848+ <i class="bi bi-file-ruled"></i> bibtex
849849+850850+ </a>
851851+852852+853853+</div>
854854+855855+856856+ </td>
857857+ </tr>
858858+859859+860860+861861+ <tr>
862862+ <td>
863863+ </td>
864864+ <th scope="row">
865865+ Additional resources
866866+ </th>
867867+ <td class="edit">
868868+869869+ </td>
870870+ <td>
871871+872872+873873+874874+875875+ <a href="http://lists.w3.org/Archives/Public/ietf-http-wg/">
876876+ Mailing list discussion
877877+ </a>
878878+879879+880880+881881+ </td>
882882+ </tr>
883883+884884+885885+</tbody>
886886+ <tr>
887887+ <th scope="row"></th>
888888+ <th scope="row"></th>
889889+ <td class="edit"></td>
890890+ <td>
891891+ <a class="btn btn-sm btn-warning mb-3"
892892+ target="_blank"
893893+ href="https://github.com/ietf-tools/datatracker/issues/new/choose">
894894+ Report a bug
895895+ <i class="bi bi-bug"></i>
896896+ </a>
897897+ </td>
898898+ </tr>
899899+ </table>
900900+ </div>
901901+ </div>
902902+ </nav>
903903+ <div class="row g-0">
904904+ <div class="col-md-9 d-flex justify-content-center lh-sm"
905905+ data-bs-spy="scroll"
906906+ data-bs-target="#toc-nav"
907907+ data-bs-smooth-scroll="true"
908908+ tabindex="0"
909909+ id="content">
910910+911911+ <div class="rfchtml">
912912+ <br class="noprint">
913913+ <div>
914914+<table class="ears">
915915+<thead><tr>
916916+<td class="left">RFC 9111</td>
917917+<td class="center">HTTP Caching</td>
918918+<td class="right">June 2022</td>
919919+</tr></thead>
920920+<tfoot><tr>
921921+<td class="left">Fielding, et al.</td>
922922+<td class="center">Standards Track</td>
923923+<td class="right">[Page]</td>
924924+</tr></tfoot>
925925+</table>
926926+<div id="external-metadata" class="document-information"></div>
927927+<div id="internal-metadata" class="document-information">
928928+<dl id="identifiers">
929929+<dt class="label-stream">Stream:</dt>
930930+<dd class="stream">Internet Engineering Task Force (IETF)</dd>
931931+<dt class="label-rfc">RFC:</dt>
932932+<dd class="rfc"><a href="https://www.rfc-editor.org/rfc/rfc9111" class="eref">9111</a></dd>
933933+<dt class="label-std">STD:</dt>
934934+<dd class="std">98</dd>
935935+<dt class="label-obsoletes">Obsoletes:</dt>
936936+<dd class="obsoletes">
937937+<a href="https://www.rfc-editor.org/rfc/rfc7234" class="eref">7234</a> </dd>
938938+<dt class="label-category">Category:</dt>
939939+<dd class="category">Standards Track</dd>
940940+<dt class="label-published">Published:</dt>
941941+<dd class="published">
942942+<time datetime="2022-06" class="published">June 2022</time>
943943+ </dd>
944944+<dt class="label-issn">ISSN:</dt>
945945+<dd class="issn">2070-1721</dd>
946946+<dt class="label-authors">Authors:</dt>
947947+<dd class="authors">
948948+<div class="author">
949949+ <div class="author-name">R. Fielding, <span class="editor">Ed.</span>
950950+</div>
951951+<div class="org">Adobe</div>
952952+</div>
953953+<div class="author">
954954+ <div class="author-name">M. Nottingham, <span class="editor">Ed.</span>
955955+</div>
956956+<div class="org">Fastly</div>
957957+</div>
958958+<div class="author">
959959+ <div class="author-name">J. Reschke, <span class="editor">Ed.</span>
960960+</div>
961961+<div class="org">greenbytes</div>
962962+</div>
963963+</dd>
964964+</dl>
965965+</div>
966966+<h1 id="rfcnum">RFC 9111</h1>
967967+<h1 id="title">HTTP Caching</h1>
968968+<section id="section-abstract">
969969+ <h2 id="abstract"><a href="#abstract" class="selfRef">Abstract</a></h2>
970970+<p id="section-abstract-1">
971971+ The Hypertext Transfer Protocol (HTTP) is a stateless application-level
972972+ protocol for distributed, collaborative, hypertext information systems.
973973+ This document defines HTTP caches and the associated header fields that
974974+ control cache behavior or indicate cacheable response messages.<a href="#section-abstract-1" class="pilcrow">¶</a></p>
975975+<p id="section-abstract-2">
976976+ This document obsoletes RFC 7234.<a href="#section-abstract-2" class="pilcrow">¶</a></p>
977977+</section>
978978+<div id="status-of-memo">
979979+<section id="section-boilerplate.1">
980980+ <h2 id="name-status-of-this-memo">
981981+<a href="#name-status-of-this-memo" class="section-name selfRef">Status of This Memo</a>
982982+ </h2>
983983+<p id="section-boilerplate.1-1">
984984+ This is an Internet Standards Track document.<a href="#section-boilerplate.1-1" class="pilcrow">¶</a></p>
985985+<p id="section-boilerplate.1-2">
986986+ This document is a product of the Internet Engineering Task Force
987987+ (IETF). It represents the consensus of the IETF community. It has
988988+ received public review and has been approved for publication by
989989+ the Internet Engineering Steering Group (IESG). Further
990990+ information on Internet Standards is available in Section 2 of
991991+ RFC 7841.<a href="#section-boilerplate.1-2" class="pilcrow">¶</a></p>
992992+<p id="section-boilerplate.1-3">
993993+ Information about the current status of this document, any
994994+ errata, and how to provide feedback on it may be obtained at
995995+ <span><a href="https://www.rfc-editor.org/info/rfc9111">https://www.rfc-editor.org/info/rfc9111</a></span>.<a href="#section-boilerplate.1-3" class="pilcrow">¶</a></p>
996996+</section>
997997+</div>
998998+<div id="copyright">
999999+<section id="section-boilerplate.2">
10001000+ <h2 id="name-copyright-notice">
10011001+<a href="#name-copyright-notice" class="section-name selfRef">Copyright Notice</a>
10021002+ </h2>
10031003+<p id="section-boilerplate.2-1">
10041004+ Copyright (c) 2022 IETF Trust and the persons identified as the
10051005+ document authors. All rights reserved.<a href="#section-boilerplate.2-1" class="pilcrow">¶</a></p>
10061006+<p id="section-boilerplate.2-2">
10071007+ This document is subject to BCP 78 and the IETF Trust's Legal
10081008+ Provisions Relating to IETF Documents
10091009+ (<span><a href="https://trustee.ietf.org/license-info">https://trustee.ietf.org/license-info</a></span>) in effect on the date of
10101010+ publication of this document. Please review these documents
10111011+ carefully, as they describe your rights and restrictions with
10121012+ respect to this document. Code Components extracted from this
10131013+ document must include Revised BSD License text as described in
10141014+ Section 4.e of the Trust Legal Provisions and are provided without
10151015+ warranty as described in the Revised BSD License.<a href="#section-boilerplate.2-2" class="pilcrow">¶</a></p>
10161016+<p id="section-boilerplate.2-3">
10171017+ This document may contain material from IETF Documents or IETF
10181018+ Contributions published or made publicly available before November
10191019+ 10, 2008. The person(s) controlling the copyright in some of this
10201020+ material may not have granted the IETF Trust the right to allow
10211021+ modifications of such material outside the IETF Standards Process.
10221022+ Without obtaining an adequate license from the person(s)
10231023+ controlling the copyright in such materials, this document may not
10241024+ be modified outside the IETF Standards Process, and derivative
10251025+ works of it may not be created outside the IETF Standards Process,
10261026+ except to format it for publication as an RFC or to translate it
10271027+ into languages other than English.<a href="#section-boilerplate.2-3" class="pilcrow">¶</a></p>
10281028+</section>
10291029+</div>
10301030+<div id="toc">
10311031+<section id="section-toc.1">
10321032+ <a href="#" onclick="scroll(0,0)" class="toplink">▲</a><h2 id="name-table-of-contents">
10331033+<a href="#name-table-of-contents" class="section-name selfRef">Table of Contents</a>
10341034+ </h2>
10351035+<nav class="toc"><ul class="compact toc ulBare ulEmpty">
10361036+<li class="compact toc ulBare ulEmpty" id="section-toc.1-1.1">
10371037+ <p id="section-toc.1-1.1.1"><a href="#section-1" class="xref">1</a>. <a href="#name-introduction" class="xref">Introduction</a></p>
10381038+<ul class="compact toc ulBare ulEmpty">
10391039+<li class="compact toc ulBare ulEmpty" id="section-toc.1-1.1.2.1">
10401040+ <p id="section-toc.1-1.1.2.1.1" class="keepWithNext"><a href="#section-1.1" class="xref">1.1</a>. <a href="#name-requirements-notation" class="xref">Requirements Notation</a></p>
10411041+</li>
10421042+ <li class="compact toc ulBare ulEmpty" id="section-toc.1-1.1.2.2">
10431043+ <p id="section-toc.1-1.1.2.2.1"><a href="#section-1.2" class="xref">1.2</a>. <a href="#name-syntax-notation" class="xref">Syntax Notation</a></p>
10441044+<ul class="compact toc ulBare ulEmpty">
10451045+<li class="compact toc ulBare ulEmpty" id="section-toc.1-1.1.2.2.2.1">
10461046+ <p id="section-toc.1-1.1.2.2.2.1.1" class="keepWithNext"><a href="#section-1.2.1" class="xref">1.2.1</a>. <a href="#name-imported-rules" class="xref">Imported Rules</a></p>
10471047+</li>
10481048+ <li class="compact toc ulBare ulEmpty" id="section-toc.1-1.1.2.2.2.2">
10491049+ <p id="section-toc.1-1.1.2.2.2.2.1" class="keepWithNext"><a href="#section-1.2.2" class="xref">1.2.2</a>. <a href="#name-delta-seconds" class="xref">Delta Seconds</a></p>
10501050+</li>
10511051+ </ul>
10521052+</li>
10531053+ </ul>
10541054+</li>
10551055+ <li class="compact toc ulBare ulEmpty" id="section-toc.1-1.2">
10561056+ <p id="section-toc.1-1.2.1"><a href="#section-2" class="xref">2</a>. <a href="#name-overview-of-cache-operation" class="xref">Overview of Cache Operation</a></p>
10571057+</li>
10581058+ <li class="compact toc ulBare ulEmpty" id="section-toc.1-1.3">
10591059+ <p id="section-toc.1-1.3.1"><a href="#section-3" class="xref">3</a>. <a href="#name-storing-responses-in-caches" class="xref">Storing Responses in Caches</a></p>
10601060+<ul class="compact toc ulBare ulEmpty">
10611061+<li class="compact toc ulBare ulEmpty" id="section-toc.1-1.3.2.1">
10621062+ <p id="section-toc.1-1.3.2.1.1"><a href="#section-3.1" class="xref">3.1</a>. <a href="#name-storing-header-and-trailer-" class="xref">Storing Header and Trailer Fields</a></p>
10631063+</li>
10641064+ <li class="compact toc ulBare ulEmpty" id="section-toc.1-1.3.2.2">
10651065+ <p id="section-toc.1-1.3.2.2.1"><a href="#section-3.2" class="xref">3.2</a>. <a href="#name-updating-stored-header-fiel" class="xref">Updating Stored Header Fields</a></p>
10661066+</li>
10671067+ <li class="compact toc ulBare ulEmpty" id="section-toc.1-1.3.2.3">
10681068+ <p id="section-toc.1-1.3.2.3.1"><a href="#section-3.3" class="xref">3.3</a>. <a href="#name-storing-incomplete-response" class="xref">Storing Incomplete Responses</a></p>
10691069+</li>
10701070+ <li class="compact toc ulBare ulEmpty" id="section-toc.1-1.3.2.4">
10711071+ <p id="section-toc.1-1.3.2.4.1"><a href="#section-3.4" class="xref">3.4</a>. <a href="#name-combining-partial-content" class="xref">Combining Partial Content</a></p>
10721072+</li>
10731073+ <li class="compact toc ulBare ulEmpty" id="section-toc.1-1.3.2.5">
10741074+ <p id="section-toc.1-1.3.2.5.1"><a href="#section-3.5" class="xref">3.5</a>. <a href="#name-storing-responses-to-authen" class="xref">Storing Responses to Authenticated Requests</a></p>
10751075+</li>
10761076+ </ul>
10771077+</li>
10781078+ <li class="compact toc ulBare ulEmpty" id="section-toc.1-1.4">
10791079+ <p id="section-toc.1-1.4.1"><a href="#section-4" class="xref">4</a>. <a href="#name-constructing-responses-from" class="xref">Constructing Responses from Caches</a></p>
10801080+<ul class="compact toc ulBare ulEmpty">
10811081+<li class="compact toc ulBare ulEmpty" id="section-toc.1-1.4.2.1">
10821082+ <p id="section-toc.1-1.4.2.1.1"><a href="#section-4.1" class="xref">4.1</a>. <a href="#name-calculating-cache-keys-with" class="xref">Calculating Cache Keys with the Vary Header Field</a></p>
10831083+</li>
10841084+ <li class="compact toc ulBare ulEmpty" id="section-toc.1-1.4.2.2">
10851085+ <p id="section-toc.1-1.4.2.2.1"><a href="#section-4.2" class="xref">4.2</a>. <a href="#name-freshness" class="xref">Freshness</a></p>
10861086+<ul class="compact toc ulBare ulEmpty">
10871087+<li class="compact toc ulBare ulEmpty" id="section-toc.1-1.4.2.2.2.1">
10881088+ <p id="section-toc.1-1.4.2.2.2.1.1"><a href="#section-4.2.1" class="xref">4.2.1</a>. <a href="#name-calculating-freshness-lifet" class="xref">Calculating Freshness Lifetime</a></p>
10891089+</li>
10901090+ <li class="compact toc ulBare ulEmpty" id="section-toc.1-1.4.2.2.2.2">
10911091+ <p id="section-toc.1-1.4.2.2.2.2.1"><a href="#section-4.2.2" class="xref">4.2.2</a>. <a href="#name-calculating-heuristic-fresh" class="xref">Calculating Heuristic Freshness</a></p>
10921092+</li>
10931093+ <li class="compact toc ulBare ulEmpty" id="section-toc.1-1.4.2.2.2.3">
10941094+ <p id="section-toc.1-1.4.2.2.2.3.1"><a href="#section-4.2.3" class="xref">4.2.3</a>. <a href="#name-calculating-age" class="xref">Calculating Age</a></p>
10951095+</li>
10961096+ <li class="compact toc ulBare ulEmpty" id="section-toc.1-1.4.2.2.2.4">
10971097+ <p id="section-toc.1-1.4.2.2.2.4.1"><a href="#section-4.2.4" class="xref">4.2.4</a>. <a href="#name-serving-stale-responses" class="xref">Serving Stale Responses</a></p>
10981098+</li>
10991099+ </ul>
11001100+</li>
11011101+ <li class="compact toc ulBare ulEmpty" id="section-toc.1-1.4.2.3">
11021102+ <p id="section-toc.1-1.4.2.3.1"><a href="#section-4.3" class="xref">4.3</a>. <a href="#name-validation" class="xref">Validation</a></p>
11031103+<ul class="compact toc ulBare ulEmpty">
11041104+<li class="compact toc ulBare ulEmpty" id="section-toc.1-1.4.2.3.2.1">
11051105+ <p id="section-toc.1-1.4.2.3.2.1.1"><a href="#section-4.3.1" class="xref">4.3.1</a>. <a href="#name-sending-a-validation-reques" class="xref">Sending a Validation Request</a></p>
11061106+</li>
11071107+ <li class="compact toc ulBare ulEmpty" id="section-toc.1-1.4.2.3.2.2">
11081108+ <p id="section-toc.1-1.4.2.3.2.2.1"><a href="#section-4.3.2" class="xref">4.3.2</a>. <a href="#name-handling-a-received-validat" class="xref">Handling a Received Validation Request</a></p>
11091109+</li>
11101110+ <li class="compact toc ulBare ulEmpty" id="section-toc.1-1.4.2.3.2.3">
11111111+ <p id="section-toc.1-1.4.2.3.2.3.1"><a href="#section-4.3.3" class="xref">4.3.3</a>. <a href="#name-handling-a-validation-respo" class="xref">Handling a Validation Response</a></p>
11121112+</li>
11131113+ <li class="compact toc ulBare ulEmpty" id="section-toc.1-1.4.2.3.2.4">
11141114+ <p id="section-toc.1-1.4.2.3.2.4.1"><a href="#section-4.3.4" class="xref">4.3.4</a>. <a href="#name-freshening-stored-responses" class="xref">Freshening Stored Responses upon Validation</a></p>
11151115+</li>
11161116+ <li class="compact toc ulBare ulEmpty" id="section-toc.1-1.4.2.3.2.5">
11171117+ <p id="section-toc.1-1.4.2.3.2.5.1"><a href="#section-4.3.5" class="xref">4.3.5</a>. <a href="#name-freshening-responses-with-h" class="xref">Freshening Responses with HEAD</a></p>
11181118+</li>
11191119+ </ul>
11201120+</li>
11211121+ <li class="compact toc ulBare ulEmpty" id="section-toc.1-1.4.2.4">
11221122+ <p id="section-toc.1-1.4.2.4.1"><a href="#section-4.4" class="xref">4.4</a>. <a href="#name-invalidating-stored-respons" class="xref">Invalidating Stored Responses</a></p>
11231123+</li>
11241124+ </ul>
11251125+</li>
11261126+ <li class="compact toc ulBare ulEmpty" id="section-toc.1-1.5">
11271127+ <p id="section-toc.1-1.5.1"><a href="#section-5" class="xref">5</a>. <a href="#name-field-definitions" class="xref">Field Definitions</a></p>
11281128+<ul class="compact toc ulBare ulEmpty">
11291129+<li class="compact toc ulBare ulEmpty" id="section-toc.1-1.5.2.1">
11301130+ <p id="section-toc.1-1.5.2.1.1"><a href="#section-5.1" class="xref">5.1</a>. <a href="#name-age" class="xref">Age</a></p>
11311131+</li>
11321132+ <li class="compact toc ulBare ulEmpty" id="section-toc.1-1.5.2.2">
11331133+ <p id="section-toc.1-1.5.2.2.1"><a href="#section-5.2" class="xref">5.2</a>. <a href="#name-cache-control" class="xref">Cache-Control</a></p>
11341134+<ul class="compact toc ulBare ulEmpty">
11351135+<li class="compact toc ulBare ulEmpty" id="section-toc.1-1.5.2.2.2.1">
11361136+ <p id="section-toc.1-1.5.2.2.2.1.1"><a href="#section-5.2.1" class="xref">5.2.1</a>. <a href="#name-request-directives" class="xref">Request Directives</a></p>
11371137+<ul class="compact toc ulBare ulEmpty">
11381138+<li class="compact toc ulBare ulEmpty" id="section-toc.1-1.5.2.2.2.1.2.1">
11391139+ <p id="section-toc.1-1.5.2.2.2.1.2.1.1"><a href="#section-5.2.1.1" class="xref">5.2.1.1</a>. <a href="#name-max-age" class="xref">max-age</a></p>
11401140+</li>
11411141+ <li class="compact toc ulBare ulEmpty" id="section-toc.1-1.5.2.2.2.1.2.2">
11421142+ <p id="section-toc.1-1.5.2.2.2.1.2.2.1"><a href="#section-5.2.1.2" class="xref">5.2.1.2</a>. <a href="#name-max-stale" class="xref">max-stale</a></p>
11431143+</li>
11441144+ <li class="compact toc ulBare ulEmpty" id="section-toc.1-1.5.2.2.2.1.2.3">
11451145+ <p id="section-toc.1-1.5.2.2.2.1.2.3.1"><a href="#section-5.2.1.3" class="xref">5.2.1.3</a>. <a href="#name-min-fresh" class="xref">min-fresh</a></p>
11461146+</li>
11471147+ <li class="compact toc ulBare ulEmpty" id="section-toc.1-1.5.2.2.2.1.2.4">
11481148+ <p id="section-toc.1-1.5.2.2.2.1.2.4.1"><a href="#section-5.2.1.4" class="xref">5.2.1.4</a>. <a href="#name-no-cache" class="xref">no-cache</a></p>
11491149+</li>
11501150+ <li class="compact toc ulBare ulEmpty" id="section-toc.1-1.5.2.2.2.1.2.5">
11511151+ <p id="section-toc.1-1.5.2.2.2.1.2.5.1"><a href="#section-5.2.1.5" class="xref">5.2.1.5</a>. <a href="#name-no-store" class="xref">no-store</a></p>
11521152+</li>
11531153+ <li class="compact toc ulBare ulEmpty" id="section-toc.1-1.5.2.2.2.1.2.6">
11541154+ <p id="section-toc.1-1.5.2.2.2.1.2.6.1"><a href="#section-5.2.1.6" class="xref">5.2.1.6</a>. <a href="#name-no-transform" class="xref">no-transform</a></p>
11551155+</li>
11561156+ <li class="compact toc ulBare ulEmpty" id="section-toc.1-1.5.2.2.2.1.2.7">
11571157+ <p id="section-toc.1-1.5.2.2.2.1.2.7.1"><a href="#section-5.2.1.7" class="xref">5.2.1.7</a>. <a href="#name-only-if-cached" class="xref">only-if-cached</a></p>
11581158+</li>
11591159+ </ul>
11601160+</li>
11611161+ <li class="compact toc ulBare ulEmpty" id="section-toc.1-1.5.2.2.2.2">
11621162+ <p id="section-toc.1-1.5.2.2.2.2.1"><a href="#section-5.2.2" class="xref">5.2.2</a>. <a href="#name-response-directives" class="xref">Response Directives</a></p>
11631163+<ul class="compact toc ulBare ulEmpty">
11641164+<li class="compact toc ulBare ulEmpty" id="section-toc.1-1.5.2.2.2.2.2.1">
11651165+ <p id="section-toc.1-1.5.2.2.2.2.2.1.1"><a href="#section-5.2.2.1" class="xref">5.2.2.1</a>. <a href="#name-max-age-2" class="xref">max-age</a></p>
11661166+</li>
11671167+ <li class="compact toc ulBare ulEmpty" id="section-toc.1-1.5.2.2.2.2.2.2">
11681168+ <p id="section-toc.1-1.5.2.2.2.2.2.2.1"><a href="#section-5.2.2.2" class="xref">5.2.2.2</a>. <a href="#name-must-revalidate" class="xref">must-revalidate</a></p>
11691169+</li>
11701170+ <li class="compact toc ulBare ulEmpty" id="section-toc.1-1.5.2.2.2.2.2.3">
11711171+ <p id="section-toc.1-1.5.2.2.2.2.2.3.1"><a href="#section-5.2.2.3" class="xref">5.2.2.3</a>. <a href="#name-must-understand" class="xref">must-understand</a></p>
11721172+</li>
11731173+ <li class="compact toc ulBare ulEmpty" id="section-toc.1-1.5.2.2.2.2.2.4">
11741174+ <p id="section-toc.1-1.5.2.2.2.2.2.4.1"><a href="#section-5.2.2.4" class="xref">5.2.2.4</a>. <a href="#name-no-cache-2" class="xref">no-cache</a></p>
11751175+</li>
11761176+ <li class="compact toc ulBare ulEmpty" id="section-toc.1-1.5.2.2.2.2.2.5">
11771177+ <p id="section-toc.1-1.5.2.2.2.2.2.5.1"><a href="#section-5.2.2.5" class="xref">5.2.2.5</a>. <a href="#name-no-store-2" class="xref">no-store</a></p>
11781178+</li>
11791179+ <li class="compact toc ulBare ulEmpty" id="section-toc.1-1.5.2.2.2.2.2.6">
11801180+ <p id="section-toc.1-1.5.2.2.2.2.2.6.1"><a href="#section-5.2.2.6" class="xref">5.2.2.6</a>. <a href="#name-no-transform-2" class="xref">no-transform</a></p>
11811181+</li>
11821182+ <li class="compact toc ulBare ulEmpty" id="section-toc.1-1.5.2.2.2.2.2.7">
11831183+ <p id="section-toc.1-1.5.2.2.2.2.2.7.1"><a href="#section-5.2.2.7" class="xref">5.2.2.7</a>. <a href="#name-private" class="xref">private</a></p>
11841184+</li>
11851185+ <li class="compact toc ulBare ulEmpty" id="section-toc.1-1.5.2.2.2.2.2.8">
11861186+ <p id="section-toc.1-1.5.2.2.2.2.2.8.1"><a href="#section-5.2.2.8" class="xref">5.2.2.8</a>. <a href="#name-proxy-revalidate" class="xref">proxy-revalidate</a></p>
11871187+</li>
11881188+ <li class="compact toc ulBare ulEmpty" id="section-toc.1-1.5.2.2.2.2.2.9">
11891189+ <p id="section-toc.1-1.5.2.2.2.2.2.9.1"><a href="#section-5.2.2.9" class="xref">5.2.2.9</a>. <a href="#name-public" class="xref">public</a></p>
11901190+</li>
11911191+ <li class="compact toc ulBare ulEmpty" id="section-toc.1-1.5.2.2.2.2.2.10">
11921192+ <p id="section-toc.1-1.5.2.2.2.2.2.10.1"><a href="#section-5.2.2.10" class="xref">5.2.2.10</a>. <a href="#name-s-maxage" class="xref">s-maxage</a></p>
11931193+</li>
11941194+ </ul>
11951195+</li>
11961196+ <li class="compact toc ulBare ulEmpty" id="section-toc.1-1.5.2.2.2.3">
11971197+ <p id="section-toc.1-1.5.2.2.2.3.1"><a href="#section-5.2.3" class="xref">5.2.3</a>. <a href="#name-extension-directives" class="xref">Extension Directives</a></p>
11981198+</li>
11991199+ <li class="compact toc ulBare ulEmpty" id="section-toc.1-1.5.2.2.2.4">
12001200+ <p id="section-toc.1-1.5.2.2.2.4.1"><a href="#section-5.2.4" class="xref">5.2.4</a>. <a href="#name-cache-directive-registry" class="xref">Cache Directive Registry</a></p>
12011201+</li>
12021202+ </ul>
12031203+</li>
12041204+ <li class="compact toc ulBare ulEmpty" id="section-toc.1-1.5.2.3">
12051205+ <p id="section-toc.1-1.5.2.3.1"><a href="#section-5.3" class="xref">5.3</a>. <a href="#name-expires" class="xref">Expires</a></p>
12061206+</li>
12071207+ <li class="compact toc ulBare ulEmpty" id="section-toc.1-1.5.2.4">
12081208+ <p id="section-toc.1-1.5.2.4.1"><a href="#section-5.4" class="xref">5.4</a>. <a href="#name-pragma" class="xref">Pragma</a></p>
12091209+</li>
12101210+ <li class="compact toc ulBare ulEmpty" id="section-toc.1-1.5.2.5">
12111211+ <p id="section-toc.1-1.5.2.5.1"><a href="#section-5.5" class="xref">5.5</a>. <a href="#name-warning" class="xref">Warning</a></p>
12121212+</li>
12131213+ </ul>
12141214+</li>
12151215+ <li class="compact toc ulBare ulEmpty" id="section-toc.1-1.6">
12161216+ <p id="section-toc.1-1.6.1"><a href="#section-6" class="xref">6</a>. <a href="#name-relationship-to-application" class="xref">Relationship to Applications and Other Caches</a></p>
12171217+</li>
12181218+ <li class="compact toc ulBare ulEmpty" id="section-toc.1-1.7">
12191219+ <p id="section-toc.1-1.7.1"><a href="#section-7" class="xref">7</a>. <a href="#name-security-considerations" class="xref">Security Considerations</a></p>
12201220+<ul class="compact toc ulBare ulEmpty">
12211221+<li class="compact toc ulBare ulEmpty" id="section-toc.1-1.7.2.1">
12221222+ <p id="section-toc.1-1.7.2.1.1"><a href="#section-7.1" class="xref">7.1</a>. <a href="#name-cache-poisoning" class="xref">Cache Poisoning</a></p>
12231223+</li>
12241224+ <li class="compact toc ulBare ulEmpty" id="section-toc.1-1.7.2.2">
12251225+ <p id="section-toc.1-1.7.2.2.1"><a href="#section-7.2" class="xref">7.2</a>. <a href="#name-timing-attacks" class="xref">Timing Attacks</a></p>
12261226+</li>
12271227+ <li class="compact toc ulBare ulEmpty" id="section-toc.1-1.7.2.3">
12281228+ <p id="section-toc.1-1.7.2.3.1"><a href="#section-7.3" class="xref">7.3</a>. <a href="#name-caching-of-sensitive-inform" class="xref">Caching of Sensitive Information</a></p>
12291229+</li>
12301230+ </ul>
12311231+</li>
12321232+ <li class="compact toc ulBare ulEmpty" id="section-toc.1-1.8">
12331233+ <p id="section-toc.1-1.8.1"><a href="#section-8" class="xref">8</a>. <a href="#name-iana-considerations" class="xref">IANA Considerations</a></p>
12341234+<ul class="compact toc ulBare ulEmpty">
12351235+<li class="compact toc ulBare ulEmpty" id="section-toc.1-1.8.2.1">
12361236+ <p id="section-toc.1-1.8.2.1.1"><a href="#section-8.1" class="xref">8.1</a>. <a href="#name-field-name-registration" class="xref">Field Name Registration</a></p>
12371237+</li>
12381238+ <li class="compact toc ulBare ulEmpty" id="section-toc.1-1.8.2.2">
12391239+ <p id="section-toc.1-1.8.2.2.1"><a href="#section-8.2" class="xref">8.2</a>. <a href="#name-cache-directive-registratio" class="xref">Cache Directive Registration</a></p>
12401240+</li>
12411241+ <li class="compact toc ulBare ulEmpty" id="section-toc.1-1.8.2.3">
12421242+ <p id="section-toc.1-1.8.2.3.1"><a href="#section-8.3" class="xref">8.3</a>. <a href="#name-warn-code-registry" class="xref">Warn Code Registry</a></p>
12431243+</li>
12441244+ </ul>
12451245+</li>
12461246+ <li class="compact toc ulBare ulEmpty" id="section-toc.1-1.9">
12471247+ <p id="section-toc.1-1.9.1"><a href="#section-9" class="xref">9</a>. <a href="#name-references" class="xref">References</a></p>
12481248+<ul class="compact toc ulBare ulEmpty">
12491249+<li class="compact toc ulBare ulEmpty" id="section-toc.1-1.9.2.1">
12501250+ <p id="section-toc.1-1.9.2.1.1"><a href="#section-9.1" class="xref">9.1</a>. <a href="#name-normative-references" class="xref">Normative References</a></p>
12511251+</li>
12521252+ <li class="compact toc ulBare ulEmpty" id="section-toc.1-1.9.2.2">
12531253+ <p id="section-toc.1-1.9.2.2.1"><a href="#section-9.2" class="xref">9.2</a>. <a href="#name-informative-references" class="xref">Informative References</a></p>
12541254+</li>
12551255+ </ul>
12561256+</li>
12571257+ <li class="compact toc ulBare ulEmpty" id="section-toc.1-1.10">
12581258+ <p id="section-toc.1-1.10.1"><a href="#appendix-A" class="xref">Appendix A</a>. <a href="#name-collected-abnf" class="xref">Collected ABNF</a></p>
12591259+</li>
12601260+ <li class="compact toc ulBare ulEmpty" id="section-toc.1-1.11">
12611261+ <p id="section-toc.1-1.11.1"><a href="#appendix-B" class="xref">Appendix B</a>. <a href="#name-changes-from-rfc-7234" class="xref">Changes from RFC 7234</a></p>
12621262+</li>
12631263+ <li class="compact toc ulBare ulEmpty" id="section-toc.1-1.12">
12641264+ <p id="section-toc.1-1.12.1"><a href="#appendix-C" class="xref"></a><a href="#name-acknowledgements" class="xref">Acknowledgements</a></p>
12651265+</li>
12661266+ <li class="compact toc ulBare ulEmpty" id="section-toc.1-1.13">
12671267+ <p id="section-toc.1-1.13.1"><a href="#appendix-D" class="xref"></a><a href="#name-index" class="xref">Index</a></p>
12681268+</li>
12691269+ <li class="compact toc ulBare ulEmpty" id="section-toc.1-1.14">
12701270+ <p id="section-toc.1-1.14.1"><a href="#appendix-E" class="xref"></a><a href="#name-authors-addresses" class="xref">Authors' Addresses</a></p>
12711271+</li>
12721272+ </ul>
12731273+</nav>
12741274+</section>
12751275+</div>
12761276+<div id="caching">
12771277+<section id="section-1">
12781278+ <h2 id="name-introduction">
12791279+<a href="#section-1" class="section-number selfRef">1. </a><a href="#name-introduction" class="section-name selfRef">Introduction</a>
12801280+ </h2>
12811281+<p id="section-1-1">
12821282+ The Hypertext Transfer Protocol (HTTP) is a stateless application-level
12831283+ request/response protocol that uses extensible semantics and
12841284+ self-descriptive messages for flexible interaction with network-based
12851285+ hypertext information systems. It is typically used for distributed information systems, where
12861286+ the use of response caches can improve performance. This document
12871287+ defines aspects of HTTP related to caching and reusing response
12881288+ messages.<a href="#section-1-1" class="pilcrow">¶</a></p>
12891289+<span id="iref-cache-1" class="iref"></span>
12901290+ <p id="section-1-2">
12911291+ An HTTP "cache" is a local store of response messages and the
12921292+ subsystem that controls storage, retrieval, and deletion of messages in it.
12931293+ A cache stores cacheable responses to reduce the response time and
12941294+ network bandwidth consumption on future equivalent requests. Any client or
12951295+ server <span class="bcp14">MAY</span> use a cache, though not when acting as a tunnel (<span><a href="https://www.rfc-editor.org/rfc/rfc9110#section-3.7" class="relref">Section 3.7</a> of [<a href="#HTTP" class="xref">HTTP</a>]</span>).<a href="#section-1-2" class="pilcrow">¶</a></p>
12961296+<span id="iref-shared-cache-2" class="iref"></span>
12971297+ <span id="iref-private-cache-3" class="iref"></span>
12981298+ <div id="shared.and.private.caches">
12991299+<p id="section-1-3">
13001300+ A "shared cache" is a cache that stores responses for reuse
13011301+ by more than one user; shared caches are usually (but not always) deployed
13021302+ as a part of an intermediary. A "private cache", in contrast,
13031303+ is dedicated to a single user; often, they are deployed as a component of
13041304+ a user agent.<a href="#section-1-3" class="pilcrow">¶</a></p>
13051305+</div>
13061306+<p id="section-1-4">
13071307+ The goal of HTTP caching is significantly improving performance
13081308+ by reusing a prior response message to satisfy a current request.
13091309+ A cache considers a stored response "fresh", as defined in
13101310+ <a href="#expiration.model" class="xref">Section 4.2</a>, if it can be reused without
13111311+ "validation" (checking with the origin server to see if the cached response
13121312+ remains valid for this request). A fresh response can therefore
13131313+ reduce both latency and network overhead each time the cache reuses it.
13141314+ When a cached response is not fresh, it might still be reusable if validation
13151315+ can freshen it (<a href="#validation.model" class="xref">Section 4.3</a>) or if the
13161316+ origin is unavailable (<a href="#serving.stale.responses" class="xref">Section 4.2.4</a>).<a href="#section-1-4" class="pilcrow">¶</a></p>
13171317+<p id="section-1-5">
13181318+ This document obsoletes <a href="#RFC7234" class="xref">RFC 7234</a>,
13191319+ with the changes being summarized in <a href="#changes.from.rfc.7234" class="xref">Appendix B</a>.<a href="#section-1-5" class="pilcrow">¶</a></p>
13201320+<div id="requirements.notation">
13211321+<section id="section-1.1">
13221322+ <h3 id="name-requirements-notation">
13231323+<a href="#section-1.1" class="section-number selfRef">1.1. </a><a href="#name-requirements-notation" class="section-name selfRef">Requirements Notation</a>
13241324+ </h3>
13251325+<p id="section-1.1-1">
13261326+ The key words "<span class="bcp14">MUST</span>", "<span class="bcp14">MUST NOT</span>",
13271327+ "<span class="bcp14">REQUIRED</span>", "<span class="bcp14">SHALL</span>", "<span class="bcp14">SHALL NOT</span>", "<span class="bcp14">SHOULD</span>", "<span class="bcp14">SHOULD NOT</span>",
13281328+ "<span class="bcp14">RECOMMENDED</span>", "<span class="bcp14">NOT RECOMMENDED</span>",
13291329+ "<span class="bcp14">MAY</span>", and "<span class="bcp14">OPTIONAL</span>" in this document are
13301330+ to be interpreted as described in BCP 14 <span>[<a href="#RFC2119" class="xref">RFC2119</a>]</span>
13311331+ <span>[<a href="#RFC8174" class="xref">RFC8174</a>]</span> when, and only when, they appear in all capitals,
13321332+ as shown here.<a href="#section-1.1-1" class="pilcrow">¶</a></p>
13331333+<p id="section-1.1-2">
13341334+ <span><a href="https://www.rfc-editor.org/rfc/rfc9110#section-2" class="relref">Section 2</a> of [<a href="#HTTP" class="xref">HTTP</a>]</span> defines conformance criteria and contains considerations regarding error handling.<a href="#section-1.1-2" class="pilcrow">¶</a></p>
13351335+</section>
13361336+</div>
13371337+<div id="notation">
13381338+<section id="section-1.2">
13391339+ <h3 id="name-syntax-notation">
13401340+<a href="#section-1.2" class="section-number selfRef">1.2. </a><a href="#name-syntax-notation" class="section-name selfRef">Syntax Notation</a>
13411341+ </h3>
13421342+<span id="iref-grammar-digit-4" class="iref"></span>
13431343+ <p id="section-1.2-1">
13441344+ This specification uses the Augmented Backus-Naur Form (ABNF) notation of
13451345+ <span>[<a href="#RFC5234" class="xref">RFC5234</a>]</span>, extended with the notation for case-sensitivity
13461346+ in strings defined in <span>[<a href="#RFC7405" class="xref">RFC7405</a>]</span>.<a href="#section-1.2-1" class="pilcrow">¶</a></p>
13471347+<p id="section-1.2-2">
13481348+ It also uses a list extension, defined in <span><a href="https://www.rfc-editor.org/rfc/rfc9110#section-5.6.1" class="relref">Section 5.6.1</a> of [<a href="#HTTP" class="xref">HTTP</a>]</span>,
13491349+ that allows for compact definition of comma-separated lists using a "#"
13501350+ operator (similar to how the "*" operator indicates repetition). <a href="#collected.abnf" class="xref">Appendix A</a> shows the collected grammar with all list
13511351+ operators expanded to standard ABNF notation.<a href="#section-1.2-2" class="pilcrow">¶</a></p>
13521352+<div id="abnf.imported">
13531353+<section id="section-1.2.1">
13541354+ <h4 id="name-imported-rules">
13551355+<a href="#section-1.2.1" class="section-number selfRef">1.2.1. </a><a href="#name-imported-rules" class="section-name selfRef">Imported Rules</a>
13561356+ </h4>
13571357+<div id="core.rules">
13581358+<p id="section-1.2.1-1">
13591359+13601360+ The following core rule is included by
13611361+ reference, as defined in <span>[<a href="#RFC5234" class="xref">RFC5234</a>], <a href="https://www.rfc-editor.org/rfc/rfc5234#appendix-B.1" class="relref">Appendix B.1</a></span>:
13621362+ DIGIT (decimal 0-9).<a href="#section-1.2.1-1" class="pilcrow">¶</a></p>
13631363+</div>
13641364+<div id="imported.rules">
13651365+<p id="section-1.2.1-2">
13661366+ <span>[<a href="#HTTP" class="xref">HTTP</a>]</span> defines the following rules:<a href="#section-1.2.1-2" class="pilcrow">¶</a></p>
13671367+</div>
13681368+<div id="section-1.2.1-3">
13691369+<pre class="lang-abnf9110 sourcecode"> HTTP-date = <HTTP-date, see [HTTP], Section 5.6.7>
13701370+ OWS = <OWS, see [HTTP], Section 5.6.3>
13711371+ field-name = <field-name, see [HTTP], Section 5.1>
13721372+ quoted-string = <quoted-string, see [HTTP], Section 5.6.4>
13731373+ token = <token, see [HTTP], Section 5.6.2>
13741374+</pre><a href="#section-1.2.1-3" class="pilcrow">¶</a>
13751375+</div>
13761376+</section>
13771377+</div>
13781378+<div id="delta-seconds">
13791379+<section id="section-1.2.2">
13801380+ <h4 id="name-delta-seconds">
13811381+<a href="#section-1.2.2" class="section-number selfRef">1.2.2. </a><a href="#name-delta-seconds" class="section-name selfRef">Delta Seconds</a>
13821382+ </h4>
13831383+<p id="section-1.2.2-1">
13841384+ The delta-seconds rule specifies a non-negative integer, representing time
13851385+ in seconds.<a href="#section-1.2.2-1" class="pilcrow">¶</a></p>
13861386+<span id="iref-grammar-delta-seconds-5" class="iref"></span>
13871387+ <div id="section-1.2.2-2">
13881388+<pre class="lang-abnf9110 sourcecode"> delta-seconds = 1*DIGIT
13891389+</pre><a href="#section-1.2.2-2" class="pilcrow">¶</a>
13901390+</div>
13911391+<p id="section-1.2.2-3">
13921392+ A recipient parsing a delta-seconds value and converting it to binary form
13931393+ ought to use an arithmetic type of at least 31 bits of non-negative integer
13941394+ range.
13951395+ If a cache receives a delta-seconds value greater than the greatest integer
13961396+ it can represent, or if any of its subsequent calculations overflows,
13971397+ the cache <span class="bcp14">MUST</span> consider the value to be 2147483648
13981398+ (2<sup>31</sup>) or the greatest positive integer it can conveniently
13991399+ represent.<a href="#section-1.2.2-3" class="pilcrow">¶</a></p>
14001400+<aside id="section-1.2.2-4">
14011401+ <p id="section-1.2.2-4.1">
14021402+ <strong>Note:</strong> The value 2147483648 is here for historical reasons,
14031403+ represents infinity (over 68 years), and does not need to be stored in
14041404+ binary form; an implementation could produce it as a string if
14051405+ any overflow occurs, even if the calculations are performed with an
14061406+ arithmetic type incapable of directly representing that number.
14071407+ What matters here is that an overflow be detected and not treated as a
14081408+ negative value in later calculations.<a href="#section-1.2.2-4.1" class="pilcrow">¶</a></p>
14091409+</aside>
14101410+</section>
14111411+</div>
14121412+</section>
14131413+</div>
14141414+</section>
14151415+</div>
14161416+<div id="caching.overview">
14171417+<section id="section-2">
14181418+ <h2 id="name-overview-of-cache-operation">
14191419+<a href="#section-2" class="section-number selfRef">2. </a><a href="#name-overview-of-cache-operation" class="section-name selfRef">Overview of Cache Operation</a>
14201420+ </h2>
14211421+<span id="iref-cache-key-6" class="iref"></span>
14221422+ <p id="section-2-1">
14231423+ Proper cache operation preserves the semantics of HTTP transfers
14241424+ while reducing the transmission of information already held in the
14251425+ cache. See <span><a href="https://www.rfc-editor.org/rfc/rfc9110#section-3" class="relref">Section 3</a> of [<a href="#HTTP" class="xref">HTTP</a>]</span>
14261426+ for the general terminology and core concepts of HTTP.<a href="#section-2-1" class="pilcrow">¶</a></p>
14271427+<p id="section-2-2">
14281428+ Although caching is an entirely <span class="bcp14">OPTIONAL</span> feature of HTTP, it can be
14291429+ assumed that reusing a cached response is desirable and that such reuse
14301430+ is the default behavior when no requirement or local configuration
14311431+ prevents it. Therefore, HTTP cache requirements are focused
14321432+ on preventing a cache from either storing a non-reusable response or
14331433+ reusing a stored response inappropriately, rather than mandating that
14341434+ caches always store and reuse particular responses.<a href="#section-2-2" class="pilcrow">¶</a></p>
14351435+<span id="iref-cache-key-7" class="iref"></span>
14361436+ <p id="section-2-3">
14371437+ The "cache key" is the information a cache uses to choose a response and
14381438+ is composed from, at a minimum, the request method and target
14391439+ URI used to retrieve the stored response; the method determines under which
14401440+ circumstances that response can be used to satisfy a subsequent request. However, many
14411441+ HTTP caches in common use today only cache GET responses and therefore only
14421442+ use the URI as the cache key.<a href="#section-2-3" class="pilcrow">¶</a></p>
14431443+<p id="section-2-4">
14441444+ A cache might store multiple responses for a request target that is
14451445+ subject to content negotiation. Caches differentiate these responses
14461446+ by incorporating some of the original request's header fields
14471447+ into the cache key as well, using information in the Vary
14481448+ response header field, as per <a href="#caching.negotiated.responses" class="xref">Section 4.1</a>.<a href="#section-2-4" class="pilcrow">¶</a></p>
14491449+<p id="section-2-5">
14501450+ Caches might incorporate additional material into the cache key.
14511451+ For example, user agent caches might include the referring site's identity,
14521452+ thereby "double keying" the cache to avoid some privacy risks (see <a href="#security.timing" class="xref">Section 7.2</a>).<a href="#section-2-5" class="pilcrow">¶</a></p>
14531453+<p id="section-2-6">
14541454+ Most commonly, caches store the successful result of a retrieval
14551455+ request: i.e., a 200 (OK) response to a GET request, which
14561456+ contains a representation of the target resource
14571457+ (<span><a href="https://www.rfc-editor.org/rfc/rfc9110#section-9.3.1" class="relref">Section 9.3.1</a> of [<a href="#HTTP" class="xref">HTTP</a>]</span>). However, it is also possible to store
14581458+ redirects, negative results (e.g., 404 (Not Found)),
14591459+ incomplete results (e.g., 206 (Partial Content)), and
14601460+ responses to methods other than GET if the method's definition allows such
14611461+ caching and defines something suitable for use as a cache key.<a href="#section-2-6" class="pilcrow">¶</a></p>
14621462+<p id="section-2-7">
14631463+ A cache is "disconnected" when it cannot contact the origin
14641464+ server or otherwise find a forward path for a request. A
14651465+ disconnected cache can serve stale responses in some circumstances (<a href="#serving.stale.responses" class="xref">Section 4.2.4</a>).<a href="#section-2-7" class="pilcrow">¶</a></p>
14661466+</section>
14671467+</div>
14681468+<div id="response.cacheability">
14691469+<section id="section-3">
14701470+ <h2 id="name-storing-responses-in-caches">
14711471+<a href="#section-3" class="section-number selfRef">3. </a><a href="#name-storing-responses-in-caches" class="section-name selfRef">Storing Responses in Caches</a>
14721472+ </h2>
14731473+<p id="section-3-1">
14741474+ A cache <span class="bcp14">MUST NOT</span> store a response to a request unless:<a href="#section-3-1" class="pilcrow">¶</a></p>
14751475+<ul class="normal">
14761476+<li class="normal" id="section-3-2.1">
14771477+ <p id="section-3-2.1.1">the request method is understood by the cache;<a href="#section-3-2.1.1" class="pilcrow">¶</a></p>
14781478+</li>
14791479+ <li class="normal" id="section-3-2.2">
14801480+ <p id="section-3-2.2.1">the response status code is final (see
14811481+ <span><a href="https://www.rfc-editor.org/rfc/rfc9110#section-15" class="relref">Section 15</a> of [<a href="#HTTP" class="xref">HTTP</a>]</span>);<a href="#section-3-2.2.1" class="pilcrow">¶</a></p>
14821482+</li>
14831483+ <li class="normal" id="section-3-2.3">
14841484+ <p id="section-3-2.3.1">if the response status code is 206 or 304, or the must-understand cache directive (see <a href="#cache-response-directive.must-understand" class="xref">Section 5.2.2.3</a>) is present: the cache understands the response status code;<a href="#section-3-2.3.1" class="pilcrow">¶</a></p>
14851485+</li>
14861486+ <li class="normal" id="section-3-2.4">
14871487+ <p id="section-3-2.4.1">the no-store cache directive is not present in the response
14881488+ (see <a href="#cache-response-directive.no-store" class="xref">Section 5.2.2.5</a>);<a href="#section-3-2.4.1" class="pilcrow">¶</a></p>
14891489+</li>
14901490+ <li class="normal" id="section-3-2.5">
14911491+ <p id="section-3-2.5.1">if the cache is shared: the private response directive is either not
14921492+ present or allows a shared cache to store a modified response;
14931493+ see <a href="#cache-response-directive.private" class="xref">Section 5.2.2.7</a>);<a href="#section-3-2.5.1" class="pilcrow">¶</a></p>
14941494+</li>
14951495+ <li class="normal" id="section-3-2.6">
14961496+ <p id="section-3-2.6.1">if the cache is shared: the Authorization header field
14971497+ is not present in the request
14981498+ (see <span><a href="https://www.rfc-editor.org/rfc/rfc9110#section-11.6.2" class="relref">Section 11.6.2</a> of [<a href="#HTTP" class="xref">HTTP</a>]</span>) or a
14991499+ response directive is present that explicitly allows shared caching
15001500+ (see <a href="#caching.authenticated.responses" class="xref">Section 3.5</a>);
15011501+ and<a href="#section-3-2.6.1" class="pilcrow">¶</a></p>
15021502+</li>
15031503+ <li class="normal" id="section-3-2.7">
15041504+ <p id="section-3-2.7.1">the response contains at least one of the following:<a href="#section-3-2.7.1" class="pilcrow">¶</a></p>
15051505+<ul class="normal">
15061506+<li class="normal" id="section-3-2.7.2.1">a public response directive
15071507+ (see <a href="#cache-response-directive.public" class="xref">Section 5.2.2.9</a>);<a href="#section-3-2.7.2.1" class="pilcrow">¶</a>
15081508+</li>
15091509+ <li class="normal" id="section-3-2.7.2.2">a private response directive, if the cache is not shared
15101510+ (see <a href="#cache-response-directive.private" class="xref">Section 5.2.2.7</a>);<a href="#section-3-2.7.2.2" class="pilcrow">¶</a>
15111511+</li>
15121512+ <li class="normal" id="section-3-2.7.2.3">an <a href="#field.expires" class="xref">Expires</a> header field
15131513+ (see <a href="#field.expires" class="xref">Section 5.3</a>);<a href="#section-3-2.7.2.3" class="pilcrow">¶</a>
15141514+</li>
15151515+ <li class="normal" id="section-3-2.7.2.4">a max-age response directive
15161516+ (see <a href="#cache-response-directive.max-age" class="xref">Section 5.2.2.1</a>);<a href="#section-3-2.7.2.4" class="pilcrow">¶</a>
15171517+</li>
15181518+ <li class="normal" id="section-3-2.7.2.5">if the cache is shared: an s-maxage response directive
15191519+ (see <a href="#cache-response-directive.s-maxage" class="xref">Section 5.2.2.10</a>);<a href="#section-3-2.7.2.5" class="pilcrow">¶</a>
15201520+</li>
15211521+ <li class="normal" id="section-3-2.7.2.6">a cache extension that allows it to be cached
15221522+ (see <a href="#cache.control.extensions" class="xref">Section 5.2.3</a>); or<a href="#section-3-2.7.2.6" class="pilcrow">¶</a>
15231523+</li>
15241524+ <li class="normal" id="section-3-2.7.2.7">a status code that is defined as heuristically cacheable
15251525+ (see <a href="#heuristic.freshness" class="xref">Section 4.2.2</a>).<a href="#section-3-2.7.2.7" class="pilcrow">¶</a>
15261526+</li>
15271527+ </ul>
15281528+</li>
15291529+ </ul>
15301530+<p id="section-3-3">
15311531+ Note that a cache extension can override any of the requirements
15321532+ listed; see <a href="#cache.control.extensions" class="xref">Section 5.2.3</a>.<a href="#section-3-3" class="pilcrow">¶</a></p>
15331533+<p id="section-3-4">
15341534+ In this context, a cache has "understood" a request method or a response
15351535+ status code if it recognizes it and implements all specified
15361536+ caching-related behavior.<a href="#section-3-4" class="pilcrow">¶</a></p>
15371537+<p id="section-3-5">
15381538+ Note that, in normal operation, some caches will not store a response that
15391539+ has neither a cache validator nor an explicit expiration time, as such
15401540+ responses are not usually useful to store. However, caches are not
15411541+ prohibited from storing such responses.<a href="#section-3-5" class="pilcrow">¶</a></p>
15421542+<div id="storing.fields">
15431543+<section id="section-3.1">
15441544+ <h3 id="name-storing-header-and-trailer-">
15451545+<a href="#section-3.1" class="section-number selfRef">3.1. </a><a href="#name-storing-header-and-trailer-" class="section-name selfRef">Storing Header and Trailer Fields</a>
15461546+ </h3>
15471547+<p id="section-3.1-1">
15481548+ Caches <span class="bcp14">MUST</span> include all received response header fields -- including
15491549+ unrecognized ones -- when storing a response; this assures that new HTTP
15501550+ header fields can be successfully deployed. However, the following exceptions
15511551+ are made:<a href="#section-3.1-1" class="pilcrow">¶</a></p>
15521552+<ul class="normal">
15531553+<li class="normal" id="section-3.1-2.1">The Connection header field and fields whose names are listed in it are
15541554+ required by <span><a href="https://www.rfc-editor.org/rfc/rfc9110#section-7.6.1" class="relref">Section 7.6.1</a> of [<a href="#HTTP" class="xref">HTTP</a>]</span> to be removed before
15551555+ forwarding the message. This <span class="bcp14">MAY</span> be implemented by doing so
15561556+ before storage.<a href="#section-3.1-2.1" class="pilcrow">¶</a>
15571557+</li>
15581558+ <li class="normal" id="section-3.1-2.2">Likewise, some fields' semantics require them to be removed
15591559+ before forwarding the message, and this <span class="bcp14">MAY</span> be implemented by doing so
15601560+ before storage; see <span><a href="https://www.rfc-editor.org/rfc/rfc9110#section-7.6.1" class="relref">Section 7.6.1</a> of [<a href="#HTTP" class="xref">HTTP</a>]</span> for some
15611561+ examples.<a href="#section-3.1-2.2" class="pilcrow">¶</a>
15621562+</li>
15631563+ <li class="normal" id="section-3.1-2.3">The no-cache (<a href="#cache-response-directive.no-cache" class="xref">Section 5.2.2.4</a>) and
15641564+ private (<a href="#cache-response-directive.private" class="xref">Section 5.2.2.7</a>) cache
15651565+ directives can have arguments that prevent storage of header fields by all
15661566+ caches and shared caches, respectively.<a href="#section-3.1-2.3" class="pilcrow">¶</a>
15671567+</li>
15681568+ <li class="normal" id="section-3.1-2.4">Header fields that are specific to the proxy that a cache uses when forwarding a request
15691569+ <span class="bcp14">MUST NOT</span> be stored, unless the cache incorporates the identity of the
15701570+ proxy into the cache key. Effectively, this is limited to Proxy-Authenticate
15711571+ (<span><a href="https://www.rfc-editor.org/rfc/rfc9110#section-11.7.1" class="relref">Section 11.7.1</a> of [<a href="#HTTP" class="xref">HTTP</a>]</span>), Proxy-Authentication-Info
15721572+ (<span><a href="https://www.rfc-editor.org/rfc/rfc9110#section-11.7.3" class="relref">Section 11.7.3</a> of [<a href="#HTTP" class="xref">HTTP</a>]</span>), and Proxy-Authorization
15731573+ (<span><a href="https://www.rfc-editor.org/rfc/rfc9110#section-11.7.2" class="relref">Section 11.7.2</a> of [<a href="#HTTP" class="xref">HTTP</a>]</span>).<a href="#section-3.1-2.4" class="pilcrow">¶</a>
15741574+</li>
15751575+ </ul>
15761576+<p id="section-3.1-3">
15771577+ Caches <span class="bcp14">MAY</span> either store trailer fields separate from header fields or
15781578+ discard them. Caches <span class="bcp14">MUST NOT</span> combine trailer fields with header fields.<a href="#section-3.1-3" class="pilcrow">¶</a></p>
15791579+</section>
15801580+</div>
15811581+<div id="update">
15821582+<section id="section-3.2">
15831583+ <h3 id="name-updating-stored-header-fiel">
15841584+<a href="#section-3.2" class="section-number selfRef">3.2. </a><a href="#name-updating-stored-header-fiel" class="section-name selfRef">Updating Stored Header Fields</a>
15851585+ </h3>
15861586+<p id="section-3.2-1">
15871587+ Caches are required to update a stored response's header fields from another
15881588+ (typically newer) response in several situations; for example, see Sections <a href="#combining.responses" class="xref">3.4</a>, <a href="#freshening.responses" class="xref">4.3.4</a>, and
15891589+ <a href="#head.effects" class="xref">4.3.5</a>.<a href="#section-3.2-1" class="pilcrow">¶</a></p>
15901590+<p id="section-3.2-2">
15911591+ When doing so, the cache <span class="bcp14">MUST</span> add each header field in the provided response
15921592+ to the stored response, replacing field values that are already present,
15931593+ with the following exceptions:<a href="#section-3.2-2" class="pilcrow">¶</a></p>
15941594+<ul class="normal">
15951595+<li class="normal" id="section-3.2-3.1">Header fields excepted from storage in <a href="#storing.fields" class="xref">Section 3.1</a>,<a href="#section-3.2-3.1" class="pilcrow">¶</a>
15961596+</li>
15971597+ <li class="normal" id="section-3.2-3.2">Header fields that the cache's stored response depends upon, as described below,<a href="#section-3.2-3.2" class="pilcrow">¶</a>
15981598+</li>
15991599+ <li class="normal" id="section-3.2-3.3">Header fields that are automatically processed and removed by the recipient, as described below, and<a href="#section-3.2-3.3" class="pilcrow">¶</a>
16001600+</li>
16011601+ <li class="normal" id="section-3.2-3.4">The Content-Length header field.<a href="#section-3.2-3.4" class="pilcrow">¶</a>
16021602+</li>
16031603+ </ul>
16041604+<p id="section-3.2-4">
16051605+ In some cases, caches (especially in user agents) store the results of
16061606+ processing the received response, rather than the response itself,
16071607+ and updating header fields that affect that processing can result in
16081608+ inconsistent behavior and security issues. Caches in this situation <span class="bcp14">MAY</span>
16091609+ omit these header fields from updating stored responses on an
16101610+ exceptional basis but <span class="bcp14">SHOULD</span> limit such omission to those fields
16111611+ necessary to assure integrity of the stored response.<a href="#section-3.2-4" class="pilcrow">¶</a></p>
16121612+<p id="section-3.2-5">
16131613+ For example, a browser might decode the content coding of a response
16141614+ while it is being received, creating a disconnect between the data it has
16151615+ stored and the response's original metadata.
16161616+ Updating that stored metadata with a different Content-Encoding
16171617+ header field would be problematic. Likewise, a browser might store a
16181618+ post-parse HTML tree rather than the content received in
16191619+ the response; updating the Content-Type header field would not be workable
16201620+ in this case because any assumptions about the format made in parsing would
16211621+ now be invalid.<a href="#section-3.2-5" class="pilcrow">¶</a></p>
16221622+<p id="section-3.2-6">
16231623+ Furthermore, some fields are automatically processed and removed by the
16241624+ HTTP implementation, such as the Content-Range header field.
16251625+ Implementations <span class="bcp14">MAY</span> automatically omit such header fields from updates,
16261626+ even when the processing does not actually occur.<a href="#section-3.2-6" class="pilcrow">¶</a></p>
16271627+<p id="section-3.2-7">
16281628+ Note that the Content-* prefix is not a signal that a header field is omitted
16291629+ from update; it is a convention for MIME header fields, not HTTP.<a href="#section-3.2-7" class="pilcrow">¶</a></p>
16301630+</section>
16311631+</div>
16321632+<div id="incomplete.responses">
16331633+<section id="section-3.3">
16341634+ <h3 id="name-storing-incomplete-response">
16351635+<a href="#section-3.3" class="section-number selfRef">3.3. </a><a href="#name-storing-incomplete-response" class="section-name selfRef">Storing Incomplete Responses</a>
16361636+ </h3>
16371637+<p id="section-3.3-1">
16381638+ If the request method is GET, the response status code is 200
16391639+ (OK), and the entire response header section has been received, a
16401640+ cache <span class="bcp14">MAY</span> store a response that is not complete (<span><a href="https://www.rfc-editor.org/rfc/rfc9110#section-6.1" class="relref">Section 6.1</a> of [<a href="#HTTP" class="xref">HTTP</a>]</span>) provided that the stored response
16411641+ is recorded as being incomplete. Likewise, a 206 (Partial
16421642+ Content) response <span class="bcp14">MAY</span> be stored as if it were an incomplete
16431643+ 200 (OK) response. However, a cache <span class="bcp14">MUST NOT</span> store
16441644+ incomplete or partial-content responses if it does not support the
16451645+ Range and Content-Range header fields or if
16461646+ it does not understand the range units used in those fields.<a href="#section-3.3-1" class="pilcrow">¶</a></p>
16471647+<p id="section-3.3-2">
16481648+ A cache <span class="bcp14">MAY</span> complete a stored incomplete response by making a subsequent
16491649+ range request (<span><a href="https://www.rfc-editor.org/rfc/rfc9110#section-14.2" class="relref">Section 14.2</a> of [<a href="#HTTP" class="xref">HTTP</a>]</span>) and combining the successful response with the
16501650+ stored response, as defined in <a href="#combining.responses" class="xref">Section 3.4</a>. A cache
16511651+ <span class="bcp14">MUST NOT</span> use an incomplete response to answer requests unless the
16521652+ response has been made complete, or the request is partial and specifies a
16531653+ range wholly within the incomplete response. A cache <span class="bcp14">MUST NOT</span>
16541654+ send a partial response to a client without explicitly marking it
16551655+ using the 206 (Partial Content) status code.<a href="#section-3.3-2" class="pilcrow">¶</a></p>
16561656+</section>
16571657+</div>
16581658+<div id="combining.responses">
16591659+<section id="section-3.4">
16601660+ <h3 id="name-combining-partial-content">
16611661+<a href="#section-3.4" class="section-number selfRef">3.4. </a><a href="#name-combining-partial-content" class="section-name selfRef">Combining Partial Content</a>
16621662+ </h3>
16631663+<p id="section-3.4-1">
16641664+ A response might transfer only a partial representation if the
16651665+ connection closed prematurely or if the request used one or more Range
16661666+ specifiers (<span><a href="https://www.rfc-editor.org/rfc/rfc9110#section-14.2" class="relref">Section 14.2</a> of [<a href="#HTTP" class="xref">HTTP</a>]</span>). After several such transfers, a cache might have
16671667+ received several ranges of the same representation. A cache <span class="bcp14">MAY</span> combine
16681668+ these ranges into a single stored response, and reuse that response to
16691669+ satisfy later requests, if they all share the same strong validator and
16701670+ the cache complies with the client requirements in <span><a href="https://www.rfc-editor.org/rfc/rfc9110#section-15.3.7.3" class="relref">Section 15.3.7.3</a> of [<a href="#HTTP" class="xref">HTTP</a>]</span>.<a href="#section-3.4-1" class="pilcrow">¶</a></p>
16711671+<p id="section-3.4-2">
16721672+ When combining the new response with one or more stored responses, a cache
16731673+ <span class="bcp14">MUST</span> update the stored response header fields using the header fields
16741674+ provided in the new response, as per <a href="#update" class="xref">Section 3.2</a>.<a href="#section-3.4-2" class="pilcrow">¶</a></p>
16751675+</section>
16761676+</div>
16771677+<div id="caching.authenticated.responses">
16781678+<section id="section-3.5">
16791679+ <h3 id="name-storing-responses-to-authen">
16801680+<a href="#section-3.5" class="section-number selfRef">3.5. </a><a href="#name-storing-responses-to-authen" class="section-name selfRef">Storing Responses to Authenticated Requests</a>
16811681+ </h3>
16821682+<p id="section-3.5-1">
16831683+ A shared cache <span class="bcp14">MUST NOT</span> use a cached response to a request with an
16841684+ Authorization header field (<span><a href="https://www.rfc-editor.org/rfc/rfc9110#section-11.6.2" class="relref">Section 11.6.2</a> of [<a href="#HTTP" class="xref">HTTP</a>]</span>) to
16851685+ satisfy any subsequent request unless the response contains a
16861686+ <a href="#field.cache-control" class="xref">Cache-Control</a> field with a response directive
16871687+ (<a href="#cache-response-directive" class="xref">Section 5.2.2</a>) that allows it to be stored by
16881688+ a shared cache, and the cache conforms to the requirements of that
16891689+ directive for that response.<a href="#section-3.5-1" class="pilcrow">¶</a></p>
16901690+<p id="section-3.5-2">
16911691+ In this specification, the following response directives have such an effect:
16921692+ must-revalidate (<a href="#cache-response-directive.must-revalidate" class="xref">Section 5.2.2.2</a>),
16931693+ public (<a href="#cache-response-directive.public" class="xref">Section 5.2.2.9</a>), and
16941694+ s-maxage (<a href="#cache-response-directive.s-maxage" class="xref">Section 5.2.2.10</a>).<a href="#section-3.5-2" class="pilcrow">¶</a></p>
16951695+</section>
16961696+</div>
16971697+</section>
16981698+</div>
16991699+<div id="constructing.responses.from.caches">
17001700+<section id="section-4">
17011701+ <h2 id="name-constructing-responses-from">
17021702+<a href="#section-4" class="section-number selfRef">4. </a><a href="#name-constructing-responses-from" class="section-name selfRef">Constructing Responses from Caches</a>
17031703+ </h2>
17041704+<p id="section-4-1">
17051705+ When presented with a request, a cache <span class="bcp14">MUST NOT</span> reuse a stored response
17061706+ unless:<a href="#section-4-1" class="pilcrow">¶</a></p>
17071707+<ul class="normal">
17081708+<li class="normal" id="section-4-2.1">
17091709+ <p id="section-4-2.1.1">the presented target URI (<span><a href="https://www.rfc-editor.org/rfc/rfc9110#section-7.1" class="relref">Section 7.1</a> of [<a href="#HTTP" class="xref">HTTP</a>]</span>) and
17101710+ that of the stored response match, and<a href="#section-4-2.1.1" class="pilcrow">¶</a></p>
17111711+</li>
17121712+ <li class="normal" id="section-4-2.2">
17131713+ <p id="section-4-2.2.1">the request method associated with the stored response allows it to
17141714+ be used for the presented request, and<a href="#section-4-2.2.1" class="pilcrow">¶</a></p>
17151715+</li>
17161716+ <li class="normal" id="section-4-2.3">
17171717+ <p id="section-4-2.3.1">request header fields nominated by the stored response (if any)
17181718+ match those presented (see <a href="#caching.negotiated.responses" class="xref">Section 4.1</a>), and<a href="#section-4-2.3.1" class="pilcrow">¶</a></p>
17191719+</li>
17201720+ <li class="normal" id="section-4-2.4">
17211721+ <p id="section-4-2.4.1">the stored response does not contain the no-cache directive
17221722+ (<a href="#cache-response-directive.no-cache" class="xref">Section 5.2.2.4</a>), unless it is
17231723+ successfully validated (<a href="#validation.model" class="xref">Section 4.3</a>), and<a href="#section-4-2.4.1" class="pilcrow">¶</a></p>
17241724+</li>
17251725+ <li class="normal" id="section-4-2.5">
17261726+ <p id="section-4-2.5.1">the stored response is one of the following:<a href="#section-4-2.5.1" class="pilcrow">¶</a></p>
17271727+<ul class="normal">
17281728+<li class="normal" id="section-4-2.5.2.1">fresh (see <a href="#expiration.model" class="xref">Section 4.2</a>), or<a href="#section-4-2.5.2.1" class="pilcrow">¶</a>
17291729+</li>
17301730+ <li class="normal" id="section-4-2.5.2.2">allowed to be served stale (see <a href="#serving.stale.responses" class="xref">Section 4.2.4</a>), or<a href="#section-4-2.5.2.2" class="pilcrow">¶</a>
17311731+</li>
17321732+ <li class="normal" id="section-4-2.5.2.3">successfully validated (see <a href="#validation.model" class="xref">Section 4.3</a>).<a href="#section-4-2.5.2.3" class="pilcrow">¶</a>
17331733+</li>
17341734+ </ul>
17351735+</li>
17361736+ </ul>
17371737+<p id="section-4-3">
17381738+ Note that a cache extension can override any of the requirements
17391739+ listed; see <a href="#cache.control.extensions" class="xref">Section 5.2.3</a>.<a href="#section-4-3" class="pilcrow">¶</a></p>
17401740+<p id="section-4-4">
17411741+ When a stored response is used to satisfy a request without validation, a
17421742+ cache <span class="bcp14">MUST</span> generate an <a href="#field.age" class="xref">Age</a> header field (<a href="#field.age" class="xref">Section 5.1</a>), replacing any present in the response with a value
17431743+ equal to the stored response's current_age; see <a href="#age.calculations" class="xref">Section 4.2.3</a>.<a href="#section-4-4" class="pilcrow">¶</a></p>
17441744+<p id="section-4-5">
17451745+ A cache <span class="bcp14">MUST</span> write through requests with methods that are unsafe
17461746+ (<span><a href="https://www.rfc-editor.org/rfc/rfc9110#section-9.2.1" class="relref">Section 9.2.1</a> of [<a href="#HTTP" class="xref">HTTP</a>]</span>) to the origin server; i.e., a cache is not allowed to
17471747+ generate a reply to such a request before having forwarded the request and
17481748+ having received a corresponding response.<a href="#section-4-5" class="pilcrow">¶</a></p>
17491749+<p id="section-4-6">
17501750+ Also, note that unsafe requests might invalidate already-stored responses;
17511751+ see <a href="#invalidation" class="xref">Section 4.4</a>.<a href="#section-4-6" class="pilcrow">¶</a></p>
17521752+<span id="iref-collapsed-requests-8" class="iref"></span>
17531753+ <p id="section-4-7">
17541754+ A cache can use a response that is stored or storable to satisfy
17551755+ multiple requests, provided that it is allowed to reuse that response
17561756+ for the requests in question. This enables a cache to "collapse
17571757+ requests" -- or combine multiple incoming requests into a single forward
17581758+ request upon a cache miss -- thereby reducing load on the origin server
17591759+ and network. Note, however, that if the cache cannot use the returned
17601760+ response for some or all of the collapsed requests, it will need to
17611761+ forward the requests in order to satisfy them, potentially introducing
17621762+ additional latency.<a href="#section-4-7" class="pilcrow">¶</a></p>
17631763+<p id="section-4-8">
17641764+ When more than one suitable response is stored, a cache <span class="bcp14">MUST</span> use the
17651765+ most recent one (as determined by the Date header
17661766+ field). It can also forward the request with "Cache-Control: max-age=0" or
17671767+ "Cache-Control: no-cache" to disambiguate which response to use.<a href="#section-4-8" class="pilcrow">¶</a></p>
17681768+<p id="section-4-9">
17691769+ A cache without a clock (<span><a href="https://www.rfc-editor.org/rfc/rfc9110#section-5.6.7" class="relref">Section 5.6.7</a> of [<a href="#HTTP" class="xref">HTTP</a>]</span>) <span class="bcp14">MUST</span> revalidate
17701770+ stored responses upon every use.<a href="#section-4-9" class="pilcrow">¶</a></p>
17711771+<div id="caching.negotiated.responses">
17721772+<section id="section-4.1">
17731773+ <h3 id="name-calculating-cache-keys-with">
17741774+<a href="#section-4.1" class="section-number selfRef">4.1. </a><a href="#name-calculating-cache-keys-with" class="section-name selfRef">Calculating Cache Keys with the Vary Header Field</a>
17751775+ </h3>
17761776+<p id="section-4.1-1">
17771777+ When a cache receives a request that can be satisfied by a stored response
17781778+ and that stored response contains a Vary header field
17791779+ (<span><a href="https://www.rfc-editor.org/rfc/rfc9110#section-12.5.5" class="relref">Section 12.5.5</a> of [<a href="#HTTP" class="xref">HTTP</a>]</span>),
17801780+ the cache <span class="bcp14">MUST NOT</span> use that stored response without revalidation unless
17811781+ all the presented request header fields nominated by that Vary field value
17821782+ match those fields in the original request (i.e., the
17831783+ request that caused the cached response to be stored).<a href="#section-4.1-1" class="pilcrow">¶</a></p>
17841784+<p id="section-4.1-2">
17851785+ The header fields from two requests are defined to match if
17861786+ and only if those in the first request can be transformed to those in the
17871787+ second request by applying any of the following:<a href="#section-4.1-2" class="pilcrow">¶</a></p>
17881788+<ul class="normal">
17891789+<li class="normal" id="section-4.1-3.1">
17901790+ adding or removing whitespace, where allowed in the header field's
17911791+ syntax<a href="#section-4.1-3.1" class="pilcrow">¶</a>
17921792+</li>
17931793+ <li class="normal" id="section-4.1-3.2">
17941794+ combining multiple header field lines with the same field name
17951795+ (see <span><a href="https://www.rfc-editor.org/rfc/rfc9110#section-5.2" class="relref">Section 5.2</a> of [<a href="#HTTP" class="xref">HTTP</a>]</span>)<a href="#section-4.1-3.2" class="pilcrow">¶</a>
17961796+</li>
17971797+ <li class="normal" id="section-4.1-3.3">
17981798+ normalizing both header field values in a way that is known to have
17991799+ identical semantics, according to the header field's specification
18001800+ (e.g., reordering field values when order is not significant;
18011801+ case-normalization, where values are defined to be case-insensitive)<a href="#section-4.1-3.3" class="pilcrow">¶</a>
18021802+</li>
18031803+ </ul>
18041804+<p id="section-4.1-4">
18051805+ If (after any normalization that might take place) a header field is absent
18061806+ from a request, it can only match another request if it is also absent
18071807+ there.<a href="#section-4.1-4" class="pilcrow">¶</a></p>
18081808+<p id="section-4.1-5">
18091809+ A stored response with a Vary header field value containing
18101810+ a member "*" always fails to match.<a href="#section-4.1-5" class="pilcrow">¶</a></p>
18111811+<p id="section-4.1-6">
18121812+ If multiple stored responses match,
18131813+ the cache will need to choose one to use.
18141814+ When a nominated request header field has a known mechanism for ranking preference
18151815+ (e.g., qvalues on Accept and similar request header
18161816+ fields), that mechanism <span class="bcp14">MAY</span> be used to choose a preferred response.
18171817+ If such a mechanism is not available, or leads to equally preferred
18181818+ responses, the most recent
18191819+ response (as determined by the Date header field) is
18201820+ chosen, as
18211821+ per <a href="#constructing.responses.from.caches" class="xref">Section 4</a>.<a href="#section-4.1-6" class="pilcrow">¶</a></p>
18221822+<p id="section-4.1-7">
18231823+ Some resources mistakenly omit the Vary header field from their default
18241824+ response (i.e., the one sent when the request does not express any preferences),
18251825+ with the effect of choosing it for subsequent requests to that resource
18261826+ even when more preferable responses are available. When a cache has
18271827+ multiple stored responses for a target URI and one or more omits the Vary
18281828+ header field, the cache <span class="bcp14">SHOULD</span> choose the most recent
18291829+ (see <a href="#age.calculations" class="xref">Section 4.2.3</a>) stored response with a valid Vary
18301830+ field value.<a href="#section-4.1-7" class="pilcrow">¶</a></p>
18311831+<p id="section-4.1-8">
18321832+ If no stored response matches, the cache cannot satisfy the presented
18331833+ request. Typically, the request is forwarded to the origin server,
18341834+ potentially with preconditions added to describe what responses the cache
18351835+ has already stored (<a href="#validation.model" class="xref">Section 4.3</a>).<a href="#section-4.1-8" class="pilcrow">¶</a></p>
18361836+</section>
18371837+</div>
18381838+<div id="expiration.model">
18391839+<section id="section-4.2">
18401840+ <h3 id="name-freshness">
18411841+<a href="#section-4.2" class="section-number selfRef">4.2. </a><a href="#name-freshness" class="section-name selfRef">Freshness</a>
18421842+ </h3>
18431843+<span id="iref-fresh-9" class="iref"></span>
18441844+ <span id="iref-stale-10" class="iref"></span>
18451845+ <p id="section-4.2-1">
18461846+ A "fresh" response is one whose age has not yet exceeded its
18471847+ freshness lifetime. Conversely, a "stale" response is one where it has.<a href="#section-4.2-1" class="pilcrow">¶</a></p>
18481848+<span id="iref-freshness-lifetime-11" class="iref"></span>
18491849+ <span id="iref-explicit-expiration-time-12" class="iref"></span>
18501850+ <span id="iref-heuristic-expiration-time-1" class="iref"></span>
18511851+ <p id="section-4.2-2">
18521852+ A response's "freshness lifetime" is the length of time
18531853+ between its generation by the origin server and its expiration time. An
18541854+ "explicit expiration time" is the time at which the origin
18551855+ server intends that a stored response can no longer be used by a cache
18561856+ without further validation, whereas a "heuristic expiration
18571857+ time" is assigned by a cache when no explicit expiration time is
18581858+ available.<a href="#section-4.2-2" class="pilcrow">¶</a></p>
18591859+<span id="iref-age-14" class="iref"></span>
18601860+ <p id="section-4.2-3">
18611861+ A response's "age" is the time that has passed since it was
18621862+ generated by, or successfully validated with, the origin server.<a href="#section-4.2-3" class="pilcrow">¶</a></p>
18631863+<p id="section-4.2-4">
18641864+ When a response is fresh, it can be used to satisfy
18651865+ subsequent requests without contacting the origin server, thereby improving
18661866+ efficiency.<a href="#section-4.2-4" class="pilcrow">¶</a></p>
18671867+<p id="section-4.2-5">
18681868+ The primary mechanism for determining freshness is for an origin server to
18691869+ provide an explicit expiration time in the future, using either the
18701870+ <a href="#field.expires" class="xref">Expires</a> header field (<a href="#field.expires" class="xref">Section 5.3</a>) or
18711871+ the max-age response directive (<a href="#cache-response-directive.max-age" class="xref">Section 5.2.2.1</a>). Generally, origin servers
18721872+ will assign future explicit expiration times to responses in the belief
18731873+ that the representation is not likely to change in a semantically
18741874+ significant way before the expiration time is reached.<a href="#section-4.2-5" class="pilcrow">¶</a></p>
18751875+<p id="section-4.2-6">
18761876+ If an origin server wishes to force a cache to validate every request, it
18771877+ can assign an explicit expiration time in the past to indicate that the
18781878+ response is already stale. Compliant caches will normally validate a stale
18791879+ cached response before reusing it for subsequent requests (see <a href="#serving.stale.responses" class="xref">Section 4.2.4</a>).<a href="#section-4.2-6" class="pilcrow">¶</a></p>
18801880+<p id="section-4.2-7">
18811881+ Since origin servers do not always provide explicit expiration times,
18821882+ caches are also allowed to use a heuristic to determine an expiration time
18831883+ under certain circumstances (see <a href="#heuristic.freshness" class="xref">Section 4.2.2</a>).<a href="#section-4.2-7" class="pilcrow">¶</a></p>
18841884+<p id="section-4.2-8">
18851885+ The calculation to determine if a response is fresh is:<a href="#section-4.2-8" class="pilcrow">¶</a></p>
18861886+<div id="section-4.2-9">
18871887+<pre class="lang-pseudocode sourcecode">
18881888+ response_is_fresh = (freshness_lifetime > current_age)
18891889+</pre><a href="#section-4.2-9" class="pilcrow">¶</a>
18901890+</div>
18911891+<p id="section-4.2-10">
18921892+ freshness_lifetime is defined in <a href="#calculating.freshness.lifetime" class="xref">Section 4.2.1</a>; current_age is defined in
18931893+ <a href="#age.calculations" class="xref">Section 4.2.3</a>.<a href="#section-4.2-10" class="pilcrow">¶</a></p>
18941894+<p id="section-4.2-11">
18951895+ Clients can send the max-age or min-fresh request directives (<a href="#cache-request-directive" class="xref">Section 5.2.1</a>) to suggest limits on the freshness
18961896+ calculations for the corresponding response. However, caches are not
18971897+ required to honor them.<a href="#section-4.2-11" class="pilcrow">¶</a></p>
18981898+<p id="section-4.2-12">
18991899+ When calculating freshness, to avoid common problems in date parsing:<a href="#section-4.2-12" class="pilcrow">¶</a></p>
19001900+<ul class="normal">
19011901+<li class="normal" id="section-4.2-13.1">Although all date formats are specified to be case-sensitive,
19021902+ a cache recipient <span class="bcp14">SHOULD</span> match the field value
19031903+ case-insensitively.<a href="#section-4.2-13.1" class="pilcrow">¶</a>
19041904+</li>
19051905+ <li class="normal" id="section-4.2-13.2">If a cache recipient's internal implementation of time has less
19061906+ resolution than the value of an HTTP-date, the recipient <span class="bcp14">MUST</span>
19071907+ internally represent a parsed <a href="#field.expires" class="xref">Expires</a> date as the
19081908+ nearest time equal to or earlier than the received value.<a href="#section-4.2-13.2" class="pilcrow">¶</a>
19091909+</li>
19101910+ <li class="normal" id="section-4.2-13.3">A cache recipient <span class="bcp14">MUST NOT</span> allow local time zones to influence the
19111911+ calculation or comparison of an age or expiration time.<a href="#section-4.2-13.3" class="pilcrow">¶</a>
19121912+</li>
19131913+ <li class="normal" id="section-4.2-13.4">A cache recipient <span class="bcp14">SHOULD</span> consider a date with a zone abbreviation
19141914+ other than "GMT" to be invalid for calculating expiration.<a href="#section-4.2-13.4" class="pilcrow">¶</a>
19151915+</li>
19161916+ </ul>
19171917+<p id="section-4.2-14">
19181918+ Note that freshness applies only to cache operation; it cannot be used to
19191919+ force a user agent to refresh its display or reload a resource. See <a href="#history.lists" class="xref">Section 6</a> for an explanation of the difference between
19201920+ caches and history mechanisms.<a href="#section-4.2-14" class="pilcrow">¶</a></p>
19211921+<div id="calculating.freshness.lifetime">
19221922+<section id="section-4.2.1">
19231923+ <h4 id="name-calculating-freshness-lifet">
19241924+<a href="#section-4.2.1" class="section-number selfRef">4.2.1. </a><a href="#name-calculating-freshness-lifet" class="section-name selfRef">Calculating Freshness Lifetime</a>
19251925+ </h4>
19261926+<p id="section-4.2.1-1">
19271927+ A cache can calculate the freshness lifetime (denoted as
19281928+ freshness_lifetime) of a response by evaluating the following rules and using the first match:<a href="#section-4.2.1-1" class="pilcrow">¶</a></p>
19291929+<ul class="normal">
19301930+<li class="normal" id="section-4.2.1-2.1">If the cache is shared and the s-maxage response directive
19311931+ (<a href="#cache-response-directive.s-maxage" class="xref">Section 5.2.2.10</a>) is present, use its value,
19321932+ or<a href="#section-4.2.1-2.1" class="pilcrow">¶</a>
19331933+</li>
19341934+ <li class="normal" id="section-4.2.1-2.2">If the max-age response directive (<a href="#cache-response-directive.max-age" class="xref">Section 5.2.2.1</a>) is present, use its value, or<a href="#section-4.2.1-2.2" class="pilcrow">¶</a>
19351935+</li>
19361936+ <li class="normal" id="section-4.2.1-2.3">If the <a href="#field.expires" class="xref">Expires</a> response header field
19371937+ (<a href="#field.expires" class="xref">Section 5.3</a>) is present, use its value minus the
19381938+ value of the Date response header field
19391939+ (using the time the message was received if it is not present, as per <span><a href="https://www.rfc-editor.org/rfc/rfc9110#section-6.6.1" class="relref">Section 6.6.1</a> of [<a href="#HTTP" class="xref">HTTP</a>]</span>), or<a href="#section-4.2.1-2.3" class="pilcrow">¶</a>
19401940+</li>
19411941+ <li class="normal" id="section-4.2.1-2.4">Otherwise, no explicit expiration time is present in the response. A
19421942+ heuristic freshness lifetime might be applicable; see <a href="#heuristic.freshness" class="xref">Section 4.2.2</a>.<a href="#section-4.2.1-2.4" class="pilcrow">¶</a>
19431943+</li>
19441944+ </ul>
19451945+<p id="section-4.2.1-3">
19461946+ Note that this calculation is intended to reduce clock skew by using the
19471947+ clock information provided by the origin server whenever possible.<a href="#section-4.2.1-3" class="pilcrow">¶</a></p>
19481948+<p id="section-4.2.1-4">
19491949+ When there is more than one value present for a given directive (e.g., two
19501950+ <a href="#field.expires" class="xref">Expires</a> header field lines or multiple Cache-Control: max-age
19511951+ directives), either the first occurrence should be used or the response should
19521952+ be considered stale. If directives conflict (e.g.,
19531953+ both max-age and no-cache are present), the most restrictive directive should
19541954+ be honored. Caches are encouraged to consider responses that have
19551955+ invalid freshness information (e.g., a max-age directive with non-integer content) to
19561956+ be stale.<a href="#section-4.2.1-4" class="pilcrow">¶</a></p>
19571957+</section>
19581958+</div>
19591959+<div id="heuristic.freshness">
19601960+<section id="section-4.2.2">
19611961+ <h4 id="name-calculating-heuristic-fresh">
19621962+<a href="#section-4.2.2" class="section-number selfRef">4.2.2. </a><a href="#name-calculating-heuristic-fresh" class="section-name selfRef">Calculating Heuristic Freshness</a>
19631963+ </h4>
19641964+<span id="iref-heuristically-cacheable-15" class="iref"></span>
19651965+ <p id="section-4.2.2-1">
19661966+ Since origin servers do not always provide explicit expiration times, a
19671967+ cache <span class="bcp14">MAY</span> assign a heuristic expiration time when an explicit time is not
19681968+ specified, employing algorithms that use other field values (such as
19691969+ the Last-Modified time) to estimate a plausible expiration
19701970+ time. This specification does not provide specific algorithms, but it does
19711971+ impose worst-case constraints on their results.<a href="#section-4.2.2-1" class="pilcrow">¶</a></p>
19721972+<p id="section-4.2.2-2">
19731973+ A cache <span class="bcp14">MUST NOT</span> use heuristics to determine freshness when an explicit
19741974+ expiration time is present in the stored response. Because of the
19751975+ requirements in <a href="#response.cacheability" class="xref">Section 3</a>,
19761976+ heuristics can only be used on responses without explicit
19771977+ freshness whose status codes are defined as "heuristically cacheable" (e.g., see
19781978+ <span><a href="https://www.rfc-editor.org/rfc/rfc9110#section-15.1" class="relref">Section 15.1</a> of [<a href="#HTTP" class="xref">HTTP</a>]</span>) and on responses without
19791979+ explicit freshness that have been marked as explicitly cacheable (e.g.,
19801980+ with a public response directive).<a href="#section-4.2.2-2" class="pilcrow">¶</a></p>
19811981+<p id="section-4.2.2-3">
19821982+ Note that in previous specifications, heuristically cacheable response status
19831983+ codes were called "cacheable by default".<a href="#section-4.2.2-3" class="pilcrow">¶</a></p>
19841984+<p id="section-4.2.2-4">
19851985+ If the response has a Last-Modified header field
19861986+ (<span><a href="https://www.rfc-editor.org/rfc/rfc9110#section-8.8.2" class="relref">Section 8.8.2</a> of [<a href="#HTTP" class="xref">HTTP</a>]</span>), caches are encouraged to use a heuristic
19871987+ expiration value that is no more than some fraction of the interval since
19881988+ that time. A typical setting of this fraction might be 10%.<a href="#section-4.2.2-4" class="pilcrow">¶</a></p>
19891989+<aside id="section-4.2.2-5">
19901990+ <p id="section-4.2.2-5.1">
19911991+ <strong>Note:</strong>
19921992+ A previous version of the HTTP specification
19931993+ (<span><a href="https://www.rfc-editor.org/rfc/rfc2616#section-13.9" class="relref">Section 13.9</a> of [<a href="#RFC2616" class="xref">RFC2616</a>]</span>) prohibited caches
19941994+ from calculating heuristic freshness for URIs with query components
19951995+ (i.e., those containing "?"). In practice, this has not been widely
19961996+ implemented. Therefore, origin servers are encouraged to send explicit
19971997+ directives (e.g., Cache-Control: no-cache) if they wish to prevent
19981998+ caching.<a href="#section-4.2.2-5.1" class="pilcrow">¶</a></p>
19991999+</aside>
20002000+</section>
20012001+</div>
20022002+<div id="age.calculations">
20032003+<section id="section-4.2.3">
20042004+ <h4 id="name-calculating-age">
20052005+<a href="#section-4.2.3" class="section-number selfRef">4.2.3. </a><a href="#name-calculating-age" class="section-name selfRef">Calculating Age</a>
20062006+ </h4>
20072007+<p id="section-4.2.3-1">
20082008+ The <a href="#field.age" class="xref">Age</a> header field is used to convey an estimated
20092009+ age of the response message when obtained from a cache. The Age field value
20102010+ is the cache's estimate of the number of seconds since the origin server generated
20112011+ or validated the response. The Age value is therefore
20122012+ the sum of the time that the response has been resident in each of the
20132013+ caches along the path from the origin server, plus the time it
20142014+ has been in transit along network paths.<a href="#section-4.2.3-1" class="pilcrow">¶</a></p>
20152015+<p id="section-4.2.3-2">
20162016+ Age calculation uses the following data:<a href="#section-4.2.3-2" class="pilcrow">¶</a></p>
20172017+<span class="break"></span><dl class="dlNewline" id="section-4.2.3-3">
20182018+ <dt id="section-4.2.3-3.1">
20192019+ "age_value"
20202020+ </dt>
20212021+ <dd style="margin-left: 1.5em" id="section-4.2.3-3.2">
20222022+ The term "age_value" denotes the value of the <a href="#field.age" class="xref">Age</a>
20232023+ header field (<a href="#field.age" class="xref">Section 5.1</a>), in a form appropriate for
20242024+ arithmetic operation; or 0, if not available.<a href="#section-4.2.3-3.2" class="pilcrow">¶</a>
20252025+</dd>
20262026+ <dd class="break"></dd>
20272027+<dt id="section-4.2.3-3.3">
20282028+ "date_value"
20292029+ </dt>
20302030+ <dd style="margin-left: 1.5em" id="section-4.2.3-3.4">
20312031+ The term "date_value" denotes the value of
20322032+ the Date header field, in a form appropriate for arithmetic
20332033+ operations. See <span><a href="https://www.rfc-editor.org/rfc/rfc9110#section-6.6.1" class="relref">Section 6.6.1</a> of [<a href="#HTTP" class="xref">HTTP</a>]</span> for the definition of the Date header
20342034+ field and for requirements regarding responses without it.<a href="#section-4.2.3-3.4" class="pilcrow">¶</a>
20352035+</dd>
20362036+ <dd class="break"></dd>
20372037+<dt id="section-4.2.3-3.5">
20382038+ "now"
20392039+ </dt>
20402040+ <dd style="margin-left: 1.5em" id="section-4.2.3-3.6">
20412041+ The term "now" means the current value of this implementation's clock
20422042+ (<span><a href="https://www.rfc-editor.org/rfc/rfc9110#section-5.6.7" class="relref">Section 5.6.7</a> of [<a href="#HTTP" class="xref">HTTP</a>]</span>).<a href="#section-4.2.3-3.6" class="pilcrow">¶</a>
20432043+</dd>
20442044+ <dd class="break"></dd>
20452045+<dt id="section-4.2.3-3.7">
20462046+ "request_time"
20472047+ </dt>
20482048+ <dd style="margin-left: 1.5em" id="section-4.2.3-3.8">
20492049+ The value of the clock at the time of the request that
20502050+ resulted in the stored response.<a href="#section-4.2.3-3.8" class="pilcrow">¶</a>
20512051+</dd>
20522052+ <dd class="break"></dd>
20532053+<dt id="section-4.2.3-3.9">
20542054+ "response_time"
20552055+ </dt>
20562056+ <dd style="margin-left: 1.5em" id="section-4.2.3-3.10">
20572057+ The value of the clock at the time the response
20582058+ was received.<a href="#section-4.2.3-3.10" class="pilcrow">¶</a>
20592059+</dd>
20602060+ <dd class="break"></dd>
20612061+</dl>
20622062+<p id="section-4.2.3-4">
20632063+ A response's age can be calculated in two entirely independent ways:<a href="#section-4.2.3-4" class="pilcrow">¶</a></p>
20642064+<ol start="1" type="1" class="normal type-1" id="section-4.2.3-5">
20652065+ <li id="section-4.2.3-5.1">the "apparent_age": response_time minus date_value, if the
20662066+ implementation's
20672067+ clock is reasonably well synchronized to the origin server's clock. If
20682068+ the result is negative, the result is replaced by zero.<a href="#section-4.2.3-5.1" class="pilcrow">¶</a>
20692069+</li>
20702070+ <li id="section-4.2.3-5.2">the "corrected_age_value", if all of the caches along the response
20712071+ path implement HTTP/1.1 or greater. A cache <span class="bcp14">MUST</span> interpret this value
20722072+ relative to the time the request was initiated, not the time that the
20732073+ response was received.<a href="#section-4.2.3-5.2" class="pilcrow">¶</a>
20742074+</li>
20752075+ </ol>
20762076+<div id="section-4.2.3-6">
20772077+<pre class="lang-pseudocode sourcecode">
20782078+ apparent_age = max(0, response_time - date_value);
20792079+20802080+ response_delay = response_time - request_time;
20812081+ corrected_age_value = age_value + response_delay;
20822082+</pre><a href="#section-4.2.3-6" class="pilcrow">¶</a>
20832083+</div>
20842084+<p id="section-4.2.3-7">
20852085+ The corrected_age_value <span class="bcp14">MAY</span> be used as the corrected_initial_age. In
20862086+ circumstances where very old cache implementations that might not correctly
20872087+ insert <a href="#field.age" class="xref">Age</a> are present, corrected_initial_age can be calculated
20882088+ more conservatively as<a href="#section-4.2.3-7" class="pilcrow">¶</a></p>
20892089+<div id="section-4.2.3-8">
20902090+<pre class="lang-pseudocode sourcecode">
20912091+ corrected_initial_age = max(apparent_age, corrected_age_value);
20922092+</pre><a href="#section-4.2.3-8" class="pilcrow">¶</a>
20932093+</div>
20942094+<p id="section-4.2.3-9">
20952095+ The current_age of a stored response can then be calculated by adding the
20962096+ time (in seconds) since the stored response was last validated by
20972097+ the origin server to the corrected_initial_age.<a href="#section-4.2.3-9" class="pilcrow">¶</a></p>
20982098+<div id="section-4.2.3-10">
20992099+<pre class="lang-pseudocode sourcecode">
21002100+ resident_time = now - response_time;
21012101+ current_age = corrected_initial_age + resident_time;
21022102+</pre><a href="#section-4.2.3-10" class="pilcrow">¶</a>
21032103+</div>
21042104+</section>
21052105+</div>
21062106+<div id="serving.stale.responses">
21072107+<section id="section-4.2.4">
21082108+ <h4 id="name-serving-stale-responses">
21092109+<a href="#section-4.2.4" class="section-number selfRef">4.2.4. </a><a href="#name-serving-stale-responses" class="section-name selfRef">Serving Stale Responses</a>
21102110+ </h4>
21112111+<p id="section-4.2.4-1">
21122112+ A "stale" response is one that either has explicit expiry information or is
21132113+ allowed to have heuristic expiry calculated, but is not fresh according to
21142114+ the calculations in <a href="#expiration.model" class="xref">Section 4.2</a>.<a href="#section-4.2.4-1" class="pilcrow">¶</a></p>
21152115+<p id="section-4.2.4-2">
21162116+ A cache <span class="bcp14">MUST NOT</span> generate a stale response if it is prohibited by an
21172117+ explicit in-protocol directive (e.g., by a no-cache response
21182118+ directive, a must-revalidate response directive, or an applicable
21192119+ s-maxage or proxy-revalidate response directive; see <a href="#cache-response-directive" class="xref">Section 5.2.2</a>).<a href="#section-4.2.4-2" class="pilcrow">¶</a></p>
21202120+<p id="section-4.2.4-3">
21212121+ A cache <span class="bcp14">MUST NOT</span> generate a stale response unless it is disconnected
21222122+ or doing so is explicitly permitted by the client or origin server
21232123+ (e.g., by the max-stale request directive in <a href="#cache-request-directive" class="xref">Section 5.2.1</a>, extension directives such as those
21242124+ defined in <span>[<a href="#RFC5861" class="xref">RFC5861</a>]</span>, or configuration in accordance
21252125+ with an out-of-band contract).<a href="#section-4.2.4-3" class="pilcrow">¶</a></p>
21262126+</section>
21272127+</div>
21282128+</section>
21292129+</div>
21302130+<div id="validation.model">
21312131+<section id="section-4.3">
21322132+ <h3 id="name-validation">
21332133+<a href="#section-4.3" class="section-number selfRef">4.3. </a><a href="#name-validation" class="section-name selfRef">Validation</a>
21342134+ </h3>
21352135+<p id="section-4.3-1">
21362136+ When a cache has one or more stored responses for a requested URI, but
21372137+ cannot serve any of them (e.g., because they are not fresh, or one cannot
21382138+ be chosen; see <a href="#caching.negotiated.responses" class="xref">Section 4.1</a>), it can use
21392139+ the conditional request mechanism (<span><a href="https://www.rfc-editor.org/rfc/rfc9110#section-13" class="relref">Section 13</a> of [<a href="#HTTP" class="xref">HTTP</a>]</span>) in the forwarded request to
21402140+ give the next inbound server an opportunity to choose a valid stored
21412141+ response to use, updating the stored metadata in the process, or to replace
21422142+ the stored response(s) with a new response. This process is known as
21432143+ "validating" or "revalidating" the stored
21442144+ response.<a href="#section-4.3-1" class="pilcrow">¶</a></p>
21452145+<div id="validation.sent">
21462146+<section id="section-4.3.1">
21472147+ <h4 id="name-sending-a-validation-reques">
21482148+<a href="#section-4.3.1" class="section-number selfRef">4.3.1. </a><a href="#name-sending-a-validation-reques" class="section-name selfRef">Sending a Validation Request</a>
21492149+ </h4>
21502150+<span id="iref-validator-16" class="iref"></span>
21512151+ <p id="section-4.3.1-1">
21522152+ When generating a conditional request for validation, a cache either starts with
21532153+ a request it is attempting to satisfy or -- if it is initiating
21542154+ the request independently -- synthesizes a request using a stored
21552155+ response by copying the method, target URI, and request header fields
21562156+ identified by the Vary header field (<a href="#caching.negotiated.responses" class="xref">Section 4.1</a>).<a href="#section-4.3.1-1" class="pilcrow">¶</a></p>
21572157+<p id="section-4.3.1-2">
21582158+ It then updates that request with one or more precondition header fields.
21592159+ These contain validator metadata sourced from a stored response(s) that has
21602160+ the same URI. Typically, this will include only the stored response(s) that
21612161+ has the same cache key, although a cache is allowed to validate
21622162+ a response that it cannot choose with the request header fields it is sending
21632163+ (see <a href="#caching.negotiated.responses" class="xref">Section 4.1</a>).<a href="#section-4.3.1-2" class="pilcrow">¶</a></p>
21642164+<p id="section-4.3.1-3">
21652165+ The precondition header fields are then compared by recipients to
21662166+ determine whether any stored response is equivalent to a current
21672167+ representation of the resource.<a href="#section-4.3.1-3" class="pilcrow">¶</a></p>
21682168+<p id="section-4.3.1-4">
21692169+ One such validator is the timestamp given in a Last-Modified
21702170+ header field (<span><a href="https://www.rfc-editor.org/rfc/rfc9110#section-8.8.2" class="relref">Section 8.8.2</a> of [<a href="#HTTP" class="xref">HTTP</a>]</span>), which can be used in an
21712171+ If-Modified-Since header field for response validation, or
21722172+ in an If-Unmodified-Since or If-Range header
21732173+ field for representation selection (i.e., the client is referring
21742174+ specifically to a previously obtained representation with that timestamp).<a href="#section-4.3.1-4" class="pilcrow">¶</a></p>
21752175+<p id="section-4.3.1-5">
21762176+ Another validator is the entity tag given in an ETag
21772177+ field (<span><a href="https://www.rfc-editor.org/rfc/rfc9110#section-8.8.3" class="relref">Section 8.8.3</a> of [<a href="#HTTP" class="xref">HTTP</a>]</span>). One or more entity tags, indicating one or more
21782178+ stored responses, can be used in an If-None-Match header
21792179+ field for response validation, or in an If-Match or
21802180+ If-Range header field for representation selection (i.e.,
21812181+ the client is referring specifically to one or more previously obtained
21822182+ representations with the listed entity tags).<a href="#section-4.3.1-5" class="pilcrow">¶</a></p>
21832183+<p id="section-4.3.1-6">
21842184+ When generating a conditional request for validation, a cache:<a href="#section-4.3.1-6" class="pilcrow">¶</a></p>
21852185+<ul class="normal">
21862186+<li class="normal" id="section-4.3.1-7.1">
21872187+ <span class="bcp14">MUST</span> send the relevant entity tags
21882188+ (using If-Match, If-None-Match, or
21892189+ If-Range) if the entity tags were provided in the
21902190+ stored response(s) being validated.<a href="#section-4.3.1-7.1" class="pilcrow">¶</a>
21912191+</li>
21922192+ <li class="normal" id="section-4.3.1-7.2">
21932193+ <span class="bcp14">SHOULD</span> send the Last-Modified value (using
21942194+ If-Modified-Since) if the request is not for a subrange,
21952195+ a single stored response is being validated, and that response
21962196+ contains a Last-Modified value.<a href="#section-4.3.1-7.2" class="pilcrow">¶</a>
21972197+</li>
21982198+ <li class="normal" id="section-4.3.1-7.3">
21992199+ <span class="bcp14">MAY</span> send the Last-Modified value (using
22002200+ If-Unmodified-Since or If-Range) if
22012201+ the request is for a subrange, a single stored response is being
22022202+ validated, and that response contains only a Last-Modified value
22032203+ (not an entity tag).<a href="#section-4.3.1-7.3" class="pilcrow">¶</a>
22042204+</li>
22052205+ </ul>
22062206+<p id="section-4.3.1-8">
22072207+ In most cases, both validators are generated in cache validation requests,
22082208+ even when entity tags are clearly superior, to allow old intermediaries
22092209+ that do not understand entity tag preconditions to respond appropriately.<a href="#section-4.3.1-8" class="pilcrow">¶</a></p>
22102210+</section>
22112211+</div>
22122212+<div id="validation.received">
22132213+<section id="section-4.3.2">
22142214+ <h4 id="name-handling-a-received-validat">
22152215+<a href="#section-4.3.2" class="section-number selfRef">4.3.2. </a><a href="#name-handling-a-received-validat" class="section-name selfRef">Handling a Received Validation Request</a>
22162216+ </h4>
22172217+<p id="section-4.3.2-1">
22182218+ Each client in the request chain may have its own cache, so it is common
22192219+ for a cache at an intermediary to receive conditional requests from other
22202220+ (outbound) caches. Likewise, some user agents make use of conditional
22212221+ requests to limit data transfers to recently modified representations or to
22222222+ complete the transfer of a partially retrieved representation.<a href="#section-4.3.2-1" class="pilcrow">¶</a></p>
22232223+<p id="section-4.3.2-2">
22242224+ If a cache receives a request that can be satisfied by reusing a stored
22252225+ 200 (OK) or 206 (Partial Content)
22262226+ response, as per <a href="#constructing.responses.from.caches" class="xref">Section 4</a>,
22272227+ the cache <span class="bcp14">SHOULD</span> evaluate any applicable conditional header
22282228+ field preconditions received in that request with respect to the
22292229+ corresponding validators contained within the stored response.<a href="#section-4.3.2-2" class="pilcrow">¶</a></p>
22302230+<p id="section-4.3.2-3">
22312231+ A cache <span class="bcp14">MUST NOT</span> evaluate conditional header fields that only
22322232+ apply to an origin server, occur in a request with semantics that
22332233+ cannot be satisfied with a cached response, or occur in a request with a target resource
22342234+ for which it has no stored responses; such preconditions are likely
22352235+ intended for some other (inbound) server.<a href="#section-4.3.2-3" class="pilcrow">¶</a></p>
22362236+<p id="section-4.3.2-4">
22372237+ The proper evaluation of conditional requests by a cache depends on the
22382238+ received precondition header fields and their precedence. In summary, the If-Match and
22392239+ If-Unmodified-Since conditional header fields are not
22402240+ applicable to a cache, and If-None-Match takes precedence over
22412241+ If-Modified-Since. See <span><a href="https://www.rfc-editor.org/rfc/rfc9110#section-13.2.2" class="relref">Section 13.2.2</a> of [<a href="#HTTP" class="xref">HTTP</a>]</span> for
22422242+ a complete specification of precondition precedence.<a href="#section-4.3.2-4" class="pilcrow">¶</a></p>
22432243+<p id="section-4.3.2-5">
22442244+ A request containing an If-None-Match header field (<span><a href="https://www.rfc-editor.org/rfc/rfc9110#section-13.1.2" class="relref">Section 13.1.2</a> of [<a href="#HTTP" class="xref">HTTP</a>]</span>) indicates that the client wants to
22452245+ validate one or more of its own stored responses in comparison to the
22462246+ stored response chosen by the cache (as per <a href="#constructing.responses.from.caches" class="xref">Section 4</a>).<a href="#section-4.3.2-5" class="pilcrow">¶</a></p>
22472247+<p id="section-4.3.2-6">
22482248+ If an If-None-Match header field is not present, a request
22492249+ containing an If-Modified-Since header field
22502250+ (<span><a href="https://www.rfc-editor.org/rfc/rfc9110#section-13.1.3" class="relref">Section 13.1.3</a> of [<a href="#HTTP" class="xref">HTTP</a>]</span>) indicates that the client wants to validate
22512251+ one or more of its own stored responses by modification date.<a href="#section-4.3.2-6" class="pilcrow">¶</a></p>
22522252+<p id="section-4.3.2-7">
22532253+ If a request contains an If-Modified-Since header field and
22542254+ the Last-Modified header field is not present in a
22552255+ stored response, a cache <span class="bcp14">SHOULD</span> use the stored response's
22562256+ Date field value (or, if no Date field is present, the time
22572257+ that the stored response was received) to evaluate the conditional.<a href="#section-4.3.2-7" class="pilcrow">¶</a></p>
22582258+<p id="section-4.3.2-8">
22592259+ A cache that implements partial responses to range requests, as defined in
22602260+ <span><a href="https://www.rfc-editor.org/rfc/rfc9110#section-14.2" class="relref">Section 14.2</a> of [<a href="#HTTP" class="xref">HTTP</a>]</span>, also needs to evaluate a received
22612261+ If-Range header field (<span><a href="https://www.rfc-editor.org/rfc/rfc9110#section-13.1.5" class="relref">Section 13.1.5</a> of [<a href="#HTTP" class="xref">HTTP</a>]</span>)
22622262+ with respect to the cache's chosen response.<a href="#section-4.3.2-8" class="pilcrow">¶</a></p>
22632263+<p id="section-4.3.2-9">
22642264+ When a cache decides to forward a request to revalidate its own stored
22652265+ responses for a
22662266+ request that contains an If-None-Match list of entity tags,
22672267+ the cache <span class="bcp14">MAY</span> combine the received list with a list of entity tags
22682268+ from its own stored set of responses (fresh or stale) and send the union of
22692269+ the two lists as a replacement If-None-Match header
22702270+ field value in the forwarded request.
22712271+ If a stored response contains only partial content, the
22722272+ cache <span class="bcp14">MUST NOT</span> include its entity tag in the union unless the request is
22732273+ for a range that would be fully satisfied by that partial stored response.
22742274+ If the response to the forwarded request is
22752275+ 304 (Not Modified) and has an ETag field value with
22762276+ an entity tag that is not in the client's list, the cache <span class="bcp14">MUST</span>
22772277+ generate a 200 (OK) response for the client by reusing its
22782278+ corresponding stored response, as updated by the 304 response metadata
22792279+ (<a href="#freshening.responses" class="xref">Section 4.3.4</a>).<a href="#section-4.3.2-9" class="pilcrow">¶</a></p>
22802280+</section>
22812281+</div>
22822282+<div id="validation.response">
22832283+<section id="section-4.3.3">
22842284+ <h4 id="name-handling-a-validation-respo">
22852285+<a href="#section-4.3.3" class="section-number selfRef">4.3.3. </a><a href="#name-handling-a-validation-respo" class="section-name selfRef">Handling a Validation Response</a>
22862286+ </h4>
22872287+<p id="section-4.3.3-1">
22882288+ Cache handling of a response to a conditional request depends upon its
22892289+ status code:<a href="#section-4.3.3-1" class="pilcrow">¶</a></p>
22902290+<ul class="normal">
22912291+<li class="normal" id="section-4.3.3-2.1">
22922292+ A 304 (Not Modified) response status code indicates
22932293+ that the stored response can be updated and reused; see <a href="#freshening.responses" class="xref">Section 4.3.4</a>.<a href="#section-4.3.3-2.1" class="pilcrow">¶</a>
22942294+</li>
22952295+ <li class="normal" id="section-4.3.3-2.2">
22962296+ A full response (i.e., one containing content) indicates that none
22972297+ of the stored responses nominated in the conditional request are
22982298+ suitable. Instead, the cache <span class="bcp14">MUST</span> use the full response to
22992299+ satisfy the request. The cache <span class="bcp14">MAY</span> store such a full response,
23002300+ subject to its constraints (see <a href="#response.cacheability" class="xref">Section 3</a>).<a href="#section-4.3.3-2.2" class="pilcrow">¶</a>
23012301+</li>
23022302+ <li class="normal" id="section-4.3.3-2.3">
23032303+ However, if a cache receives a 5xx (Server Error)
23042304+ response while attempting to validate a response, it can either
23052305+ forward this response to the requesting client or act as if the
23062306+ server failed to respond. In the latter case, the cache can send a
23072307+ previously stored response, subject to its constraints on doing so (see <a href="#serving.stale.responses" class="xref">Section 4.2.4</a>), or retry the validation request.<a href="#section-4.3.3-2.3" class="pilcrow">¶</a>
23082308+</li>
23092309+ </ul>
23102310+</section>
23112311+</div>
23122312+<div id="freshening.responses">
23132313+<section id="section-4.3.4">
23142314+ <h4 id="name-freshening-stored-responses">
23152315+<a href="#section-4.3.4" class="section-number selfRef">4.3.4. </a><a href="#name-freshening-stored-responses" class="section-name selfRef">Freshening Stored Responses upon Validation</a>
23162316+ </h4>
23172317+<p id="section-4.3.4-1">
23182318+ When a cache receives a 304 (Not Modified) response, it needs
23192319+ to identify stored responses that are suitable for updating with the new information
23202320+ provided, and then do so.<a href="#section-4.3.4-1" class="pilcrow">¶</a></p>
23212321+<p id="section-4.3.4-2">
23222322+ The initial set of stored responses to update are those that could have been chosen for
23232323+ that request -- i.e., those that meet the requirements in <a href="#constructing.responses.from.caches" class="xref">Section 4</a>, except the last requirement
23242324+ to be fresh, able to be served stale, or just validated.<a href="#section-4.3.4-2" class="pilcrow">¶</a></p>
23252325+<p id="section-4.3.4-3">
23262326+ Then, that initial set of stored responses is further filtered by the first match of:<a href="#section-4.3.4-3" class="pilcrow">¶</a></p>
23272327+<ul class="normal">
23282328+<li class="normal" id="section-4.3.4-4.1">
23292329+ If the new response contains one or more "strong validators" (see
23302330+ <span><a href="https://www.rfc-editor.org/rfc/rfc9110#section-8.8.1" class="relref">Section 8.8.1</a> of [<a href="#HTTP" class="xref">HTTP</a>]</span>), then each of those strong validators
23312331+ identifies a selected representation for update. All the stored
23322332+ responses in the initial set with one of those same strong validators are identified for update. If
23332333+ none of the initial set contains at least one of the same strong validators, then the
23342334+ cache <span class="bcp14">MUST NOT</span> use the new response to update any stored responses.<a href="#section-4.3.4-4.1" class="pilcrow">¶</a>
23352335+</li>
23362336+ <li class="normal" id="section-4.3.4-4.2">
23372337+ If the new response contains no strong validators but does contain
23382338+ one or more "weak validators", and those
23392339+ validators correspond to one of the initial set's stored responses, then the most
23402340+ recent of those matching stored responses is identified for update.<a href="#section-4.3.4-4.2" class="pilcrow">¶</a>
23412341+</li>
23422342+ <li class="normal" id="section-4.3.4-4.3">
23432343+ If the new response does not include any form of validator (such as
23442344+ where a client generates an If-Modified-Since request from
23452345+ a source other than the Last-Modified response header
23462346+ field), and there is only one stored response in the initial set, and that stored response
23472347+ also lacks a validator, then that stored response is identified for update.<a href="#section-4.3.4-4.3" class="pilcrow">¶</a>
23482348+</li>
23492349+ </ul>
23502350+<p id="section-4.3.4-5">
23512351+ For each stored response identified, the cache <span class="bcp14">MUST</span> update
23522352+ its header fields with the header fields provided in the 304 (Not
23532353+ Modified) response, as per <a href="#update" class="xref">Section 3.2</a>.<a href="#section-4.3.4-5" class="pilcrow">¶</a></p>
23542354+</section>
23552355+</div>
23562356+<div id="head.effects">
23572357+<section id="section-4.3.5">
23582358+ <h4 id="name-freshening-responses-with-h">
23592359+<a href="#section-4.3.5" class="section-number selfRef">4.3.5. </a><a href="#name-freshening-responses-with-h" class="section-name selfRef">Freshening Responses with HEAD</a>
23602360+ </h4>
23612361+<p id="section-4.3.5-1">
23622362+ A response to the HEAD method is identical to what an equivalent request
23632363+ made with a GET would have been, without sending the content. This property
23642364+ of HEAD responses can be used to invalidate or update a cached GET
23652365+ response if the more efficient conditional GET request mechanism is not
23662366+ available (due to no validators being present in the stored response) or
23672367+ if transmission of the content is not desired even if it has
23682368+ changed.<a href="#section-4.3.5-1" class="pilcrow">¶</a></p>
23692369+<p id="section-4.3.5-2">
23702370+ When a cache makes an inbound HEAD request for a target URI and
23712371+ receives a 200 (OK) response, the cache <span class="bcp14">SHOULD</span> update or
23722372+ invalidate each of its stored GET responses that could have been chosen
23732373+ for that request (see <a href="#caching.negotiated.responses" class="xref">Section 4.1</a>).<a href="#section-4.3.5-2" class="pilcrow">¶</a></p>
23742374+<p id="section-4.3.5-3">
23752375+ For each of the stored responses that could have been chosen, if the
23762376+ stored response and HEAD response have matching values for any received
23772377+ validator fields (ETag and Last-Modified)
23782378+ and, if the HEAD response has a Content-Length header field,
23792379+ the value of Content-Length matches that of the stored
23802380+ response, the cache <span class="bcp14">SHOULD</span> update the stored response as described below;
23812381+ otherwise, the cache <span class="bcp14">SHOULD</span> consider the stored response to be stale.<a href="#section-4.3.5-3" class="pilcrow">¶</a></p>
23822382+<p id="section-4.3.5-4">
23832383+ If a cache updates a stored response with the metadata provided in a HEAD
23842384+ response, the cache <span class="bcp14">MUST</span> use the header fields provided in the HEAD
23852385+ response to update the stored response (see <a href="#update" class="xref">Section 3.2</a>).<a href="#section-4.3.5-4" class="pilcrow">¶</a></p>
23862386+</section>
23872387+</div>
23882388+</section>
23892389+</div>
23902390+<div id="invalidation">
23912391+<section id="section-4.4">
23922392+ <h3 id="name-invalidating-stored-respons">
23932393+<a href="#section-4.4" class="section-number selfRef">4.4. </a><a href="#name-invalidating-stored-respons" class="section-name selfRef">Invalidating Stored Responses</a>
23942394+ </h3>
23952395+<p id="section-4.4-1">
23962396+ Because unsafe request methods (<span><a href="https://www.rfc-editor.org/rfc/rfc9110#section-9.2.1" class="relref">Section 9.2.1</a> of [<a href="#HTTP" class="xref">HTTP</a>]</span>) such as PUT, POST, or DELETE
23972397+ have the potential for changing state on the origin server, intervening
23982398+ caches are required to invalidate stored responses to keep their contents up to date.<a href="#section-4.4-1" class="pilcrow">¶</a></p>
23992399+<p id="section-4.4-2">
24002400+ A cache <span class="bcp14">MUST</span> invalidate the target URI
24012401+ (<span><a href="https://www.rfc-editor.org/rfc/rfc9110#section-7.1" class="relref">Section 7.1</a> of [<a href="#HTTP" class="xref">HTTP</a>]</span>) when it receives a non-error status
24022402+ code in response to
24032403+ an unsafe request method (including methods whose safety is unknown).<a href="#section-4.4-2" class="pilcrow">¶</a></p>
24042404+<p id="section-4.4-3">
24052405+ A cache <span class="bcp14">MAY</span> invalidate other URIs when it receives a non-error status
24062406+ code in response to an unsafe request method (including methods whose
24072407+ safety is unknown).
24082408+ In particular, the URI(s) in the
24092409+ Location and Content-Location response header
24102410+ fields (if present) are candidates for invalidation; other URIs might be
24112411+ discovered through mechanisms not specified in this document.
24122412+ However, a cache <span class="bcp14">MUST NOT</span> trigger an invalidation under these conditions
24132413+ if the origin (<span><a href="https://www.rfc-editor.org/rfc/rfc9110#section-4.3.1" class="relref">Section 4.3.1</a> of [<a href="#HTTP" class="xref">HTTP</a>]</span>) of the URI to be invalidated differs from that of the target URI
24142414+ (<span><a href="https://www.rfc-editor.org/rfc/rfc9110#section-7.1" class="relref">Section 7.1</a> of [<a href="#HTTP" class="xref">HTTP</a>]</span>). This helps prevent denial-of-service attacks.<a href="#section-4.4-3" class="pilcrow">¶</a></p>
24152415+<p id="section-4.4-4">
24162416+ "Invalidate" means that the cache will either remove all
24172417+ stored responses whose target URI matches the given URI or mark them
24182418+ as "invalid" and in need of a mandatory validation before they can be sent
24192419+ in response to a subsequent request.<a href="#section-4.4-4" class="pilcrow">¶</a></p>
24202420+<p id="section-4.4-5">
24212421+ A "non-error response" is one with a 2xx (Successful)
24222422+ or 3xx (Redirection) status code.<a href="#section-4.4-5" class="pilcrow">¶</a></p>
24232423+<p id="section-4.4-6">
24242424+ Note that this does not guarantee that all appropriate responses are
24252425+ invalidated globally; a state-changing request would only invalidate
24262426+ responses in the caches it travels through.<a href="#section-4.4-6" class="pilcrow">¶</a></p>
24272427+</section>
24282428+</div>
24292429+</section>
24302430+</div>
24312431+<div id="header.field.definitions">
24322432+<section id="section-5">
24332433+ <h2 id="name-field-definitions">
24342434+<a href="#section-5" class="section-number selfRef">5. </a><a href="#name-field-definitions" class="section-name selfRef">Field Definitions</a>
24352435+ </h2>
24362436+<p id="section-5-1">
24372437+ This section defines the syntax and semantics of HTTP fields
24382438+ related to caching.<a href="#section-5-1" class="pilcrow">¶</a></p>
24392439+<div id="field.age">
24402440+<section id="section-5.1">
24412441+ <h3 id="name-age">
24422442+<a href="#section-5.1" class="section-number selfRef">5.1. </a><a href="#name-age" class="section-name selfRef">Age</a>
24432443+ </h3>
24442444+<span id="iref-fields-age-17" class="iref"></span>
24452445+ <span id="iref-header-fields-age-18" class="iref"></span>
24462446+ <span id="iref-fields-age-19" class="iref"></span>
24472447+ <span id="iref-header-fields-age-20" class="iref"></span>
24482448+ <span id="iref-age-header-field-21" class="iref"></span>
24492449+ <p id="section-5.1-1">
24502450+ The "Age" response header field conveys the sender's estimate of the
24512451+ time since the response was generated or successfully validated at the
24522452+ origin server. Age values are calculated as specified in <a href="#age.calculations" class="xref">Section 4.2.3</a>.<a href="#section-5.1-1" class="pilcrow">¶</a></p>
24532453+<span id="iref-grammar-age-22" class="iref"></span>
24542454+ <div id="section-5.1-2">
24552455+<pre class="lang-abnf9110 sourcecode"> Age = delta-seconds
24562456+</pre><a href="#section-5.1-2" class="pilcrow">¶</a>
24572457+</div>
24582458+<p id="section-5.1-3">
24592459+ The Age field value is a non-negative integer, representing time in seconds
24602460+ (see <a href="#delta-seconds" class="xref">Section 1.2.2</a>).<a href="#section-5.1-3" class="pilcrow">¶</a></p>
24612461+<p id="section-5.1-4">
24622462+ Although it is defined as a singleton header field, a cache encountering a
24632463+ message with a list-based Age field value <span class="bcp14">SHOULD</span> use the
24642464+ first member of the field value, discarding subsequent ones.<a href="#section-5.1-4" class="pilcrow">¶</a></p>
24652465+<p id="section-5.1-5">
24662466+ If the field value (after discarding additional members, as per above) is invalid
24672467+ (e.g., it contains something other than a non-negative integer),
24682468+ a cache <span class="bcp14">SHOULD</span> ignore the field.<a href="#section-5.1-5" class="pilcrow">¶</a></p>
24692469+<p id="section-5.1-6">
24702470+ The presence of an Age header field implies that the response was not
24712471+ generated or validated by the origin server for this request. However,
24722472+ lack of an Age header field does not imply the origin was contacted.<a href="#section-5.1-6" class="pilcrow">¶</a></p>
24732473+</section>
24742474+</div>
24752475+<div id="field.cache-control">
24762476+<section id="section-5.2">
24772477+ <h3 id="name-cache-control">
24782478+<a href="#section-5.2" class="section-number selfRef">5.2. </a><a href="#name-cache-control" class="section-name selfRef">Cache-Control</a>
24792479+ </h3>
24802480+<span id="iref-fields-cache-control-23" class="iref"></span>
24812481+ <span id="iref-header-fields-cache-control" class="iref"></span>
24822482+ <span id="iref-cache-control-header-field-" class="iref"></span>
24832483+ <p id="section-5.2-1">
24842484+ The "Cache-Control" header field is used to list directives for caches
24852485+ along the request/response chain. Cache directives are unidirectional,
24862486+ in that the presence of a directive in a request does not imply that the
24872487+ same directive is present or copied in the response.<a href="#section-5.2-1" class="pilcrow">¶</a></p>
24882488+<p id="section-5.2-2">
24892489+ See <a href="#cache.control.extensions" class="xref">Section 5.2.3</a> for information about how
24902490+ Cache-Control directives defined elsewhere are handled.<a href="#section-5.2-2" class="pilcrow">¶</a></p>
24912491+<p id="section-5.2-3">
24922492+ A proxy, whether or not it implements a cache, <span class="bcp14">MUST</span> pass cache directives
24932493+ through in forwarded messages, regardless of their
24942494+ significance to that application, since the directives might apply
24952495+ to all recipients along the request/response chain. It is not possible to
24962496+ target a directive to a specific cache.<a href="#section-5.2-3" class="pilcrow">¶</a></p>
24972497+<p id="section-5.2-4">
24982498+ Cache directives are identified by a token, to be compared case-insensitively,
24992499+ and have an optional argument that can use both token and quoted-string
25002500+ syntax. For the directives defined below that define arguments, recipients
25012501+ ought to accept both forms, even if a specific form is required for generation.<a href="#section-5.2-4" class="pilcrow">¶</a></p>
25022502+<span id="iref-grammar-cache-control-26" class="iref"></span>
25032503+ <span id="iref-grammar-cache-directive-27" class="iref"></span>
25042504+ <div id="section-5.2-5">
25052505+<pre class="lang-abnf9110 sourcecode"> Cache-Control = #cache-directive
25062506+25072507+ cache-directive = token [ "=" ( token / quoted-string ) ]
25082508+</pre><a href="#section-5.2-5" class="pilcrow">¶</a>
25092509+</div>
25102510+<p id="section-5.2-6">
25112511+ For the cache directives defined below, no argument is defined (nor allowed)
25122512+ unless stated otherwise.<a href="#section-5.2-6" class="pilcrow">¶</a></p>
25132513+<div id="cache-request-directive">
25142514+<section id="section-5.2.1">
25152515+ <h4 id="name-request-directives">
25162516+<a href="#section-5.2.1" class="section-number selfRef">5.2.1. </a><a href="#name-request-directives" class="section-name selfRef">Request Directives</a>
25172517+ </h4>
25182518+<p id="section-5.2.1-1">
25192519+ This section defines cache request directives. They are advisory; caches
25202520+ <span class="bcp14">MAY</span> implement them, but are not required to.<a href="#section-5.2.1-1" class="pilcrow">¶</a></p>
25212521+<div id="cache-request-directive.max-age">
25222522+<section id="section-5.2.1.1">
25232523+ <h5 id="name-max-age">
25242524+<a href="#section-5.2.1.1" class="section-number selfRef">5.2.1.1. </a><a href="#name-max-age" class="section-name selfRef">max-age</a>
25252525+ </h5>
25262526+<span id="iref-max-age-cache-directive-28" class="iref"></span>
25272527+ <p id="section-5.2.1.1-1">
25282528+ Argument syntax:<a href="#section-5.2.1.1-1" class="pilcrow">¶</a></p>
25292529+<ul class="normal ulEmpty">
25302530+<li class="normal ulEmpty" id="section-5.2.1.1-2.1">
25312531+ <a href="#delta-seconds" class="xref">delta-seconds</a> (see <a href="#delta-seconds" class="xref">Section 1.2.2</a>)<a href="#section-5.2.1.1-2.1" class="pilcrow">¶</a>
25322532+</li>
25332533+ </ul>
25342534+<p id="section-5.2.1.1-3">
25352535+ The max-age request directive indicates that the client prefers a
25362536+ response whose age is less than or equal to the specified number of
25372537+ seconds. Unless the max-stale request directive is also present, the
25382538+ client does not wish to receive a stale response.<a href="#section-5.2.1.1-3" class="pilcrow">¶</a></p>
25392539+<p id="section-5.2.1.1-4">
25402540+ This directive uses the token form of the argument syntax:
25412541+ e.g., 'max-age=5' not 'max-age="5"'. A sender <span class="bcp14">MUST NOT</span> generate the
25422542+ quoted-string form.<a href="#section-5.2.1.1-4" class="pilcrow">¶</a></p>
25432543+</section>
25442544+</div>
25452545+<div id="cache-request-directive.max-stale">
25462546+<section id="section-5.2.1.2">
25472547+ <h5 id="name-max-stale">
25482548+<a href="#section-5.2.1.2" class="section-number selfRef">5.2.1.2. </a><a href="#name-max-stale" class="section-name selfRef">max-stale</a>
25492549+ </h5>
25502550+<span id="iref-max-stale-cache-directive-2" class="iref"></span>
25512551+ <p id="section-5.2.1.2-1">
25522552+ Argument syntax:<a href="#section-5.2.1.2-1" class="pilcrow">¶</a></p>
25532553+<ul class="normal ulEmpty">
25542554+<li class="normal ulEmpty" id="section-5.2.1.2-2.1">
25552555+ <a href="#delta-seconds" class="xref">delta-seconds</a> (see <a href="#delta-seconds" class="xref">Section 1.2.2</a>)<a href="#section-5.2.1.2-2.1" class="pilcrow">¶</a>
25562556+</li>
25572557+ </ul>
25582558+<p id="section-5.2.1.2-3">
25592559+ The max-stale request directive indicates that the client will
25602560+ accept a response that has exceeded its freshness lifetime. If a value is
25612561+ present, then the client is willing to accept a response that has exceeded
25622562+ its freshness lifetime by no more than the specified number of seconds. If
25632563+ no value is assigned to max-stale, then the client will accept a
25642564+ stale response of any age.<a href="#section-5.2.1.2-3" class="pilcrow">¶</a></p>
25652565+<p id="section-5.2.1.2-4">
25662566+ This directive uses the token form of the argument syntax:
25672567+ e.g., 'max-stale=10' not 'max-stale="10"'. A sender <span class="bcp14">MUST NOT</span> generate
25682568+ the quoted-string form.<a href="#section-5.2.1.2-4" class="pilcrow">¶</a></p>
25692569+</section>
25702570+</div>
25712571+<div id="cache-request-directive.min-fresh">
25722572+<section id="section-5.2.1.3">
25732573+ <h5 id="name-min-fresh">
25742574+<a href="#section-5.2.1.3" class="section-number selfRef">5.2.1.3. </a><a href="#name-min-fresh" class="section-name selfRef">min-fresh</a>
25752575+ </h5>
25762576+<span id="iref-min-fresh-cache-directive-3" class="iref"></span>
25772577+ <p id="section-5.2.1.3-1">
25782578+ Argument syntax:<a href="#section-5.2.1.3-1" class="pilcrow">¶</a></p>
25792579+<ul class="normal ulEmpty">
25802580+<li class="normal ulEmpty" id="section-5.2.1.3-2.1">
25812581+ <a href="#delta-seconds" class="xref">delta-seconds</a> (see <a href="#delta-seconds" class="xref">Section 1.2.2</a>)<a href="#section-5.2.1.3-2.1" class="pilcrow">¶</a>
25822582+</li>
25832583+ </ul>
25842584+<p id="section-5.2.1.3-3">
25852585+ The min-fresh request directive indicates that the client prefers a
25862586+ response whose freshness lifetime is no less than its current age plus the
25872587+ specified time in seconds. That is, the client wants a response that will
25882588+ still be fresh for at least the specified number of seconds.<a href="#section-5.2.1.3-3" class="pilcrow">¶</a></p>
25892589+<p id="section-5.2.1.3-4">
25902590+ This directive uses the token form of the argument syntax:
25912591+ e.g., 'min-fresh=20' not 'min-fresh="20"'. A sender <span class="bcp14">MUST NOT</span> generate
25922592+ the quoted-string form.<a href="#section-5.2.1.3-4" class="pilcrow">¶</a></p>
25932593+</section>
25942594+</div>
25952595+<div id="cache-request-directive.no-cache">
25962596+<section id="section-5.2.1.4">
25972597+ <h5 id="name-no-cache">
25982598+<a href="#section-5.2.1.4" class="section-number selfRef">5.2.1.4. </a><a href="#name-no-cache" class="section-name selfRef">no-cache</a>
25992599+ </h5>
26002600+<span id="iref-no-cache-cache-directive-31" class="iref"></span>
26012601+ <p id="section-5.2.1.4-1">
26022602+ The no-cache request directive indicates that the client prefers
26032603+ a stored response not be used to satisfy the request without successful
26042604+ validation on the origin server.<a href="#section-5.2.1.4-1" class="pilcrow">¶</a></p>
26052605+</section>
26062606+</div>
26072607+<div id="cache-request-directive.no-store">
26082608+<section id="section-5.2.1.5">
26092609+ <h5 id="name-no-store">
26102610+<a href="#section-5.2.1.5" class="section-number selfRef">5.2.1.5. </a><a href="#name-no-store" class="section-name selfRef">no-store</a>
26112611+ </h5>
26122612+<span id="iref-no-store-cache-directive-32" class="iref"></span>
26132613+ <p id="section-5.2.1.5-1">
26142614+ The no-store request directive indicates that a cache <span class="bcp14">MUST NOT</span>
26152615+ store any part of either this request or any response to it. This
26162616+ directive applies to both private and shared caches. "MUST NOT
26172617+ store" in this context means that the cache <span class="bcp14">MUST NOT</span> intentionally
26182618+ store the information in non-volatile storage and <span class="bcp14">MUST</span> make a
26192619+ best-effort attempt to remove the information from volatile storage as
26202620+ promptly as possible after forwarding it.<a href="#section-5.2.1.5-1" class="pilcrow">¶</a></p>
26212621+<p id="section-5.2.1.5-2">
26222622+ This directive is not a reliable or sufficient mechanism for ensuring
26232623+ privacy. In particular, malicious or compromised caches might not
26242624+ recognize or obey this directive, and communications networks might be
26252625+ vulnerable to eavesdropping.<a href="#section-5.2.1.5-2" class="pilcrow">¶</a></p>
26262626+<p id="section-5.2.1.5-3">
26272627+ Note that if a request containing this directive is satisfied from a
26282628+ cache, the no-store request directive does not apply to the already
26292629+ stored response.<a href="#section-5.2.1.5-3" class="pilcrow">¶</a></p>
26302630+</section>
26312631+</div>
26322632+<div id="cache-request-directive.no-transform">
26332633+<section id="section-5.2.1.6">
26342634+ <h5 id="name-no-transform">
26352635+<a href="#section-5.2.1.6" class="section-number selfRef">5.2.1.6. </a><a href="#name-no-transform" class="section-name selfRef">no-transform</a>
26362636+ </h5>
26372637+<span id="iref-no-transform-cache-directiv" class="iref"></span>
26382638+ <p id="section-5.2.1.6-1">
26392639+ The no-transform request directive indicates that the client is asking
26402640+ for intermediaries to avoid
26412641+ transforming the content, as defined in <span><a href="https://www.rfc-editor.org/rfc/rfc9110#section-7.7" class="relref">Section 7.7</a> of [<a href="#HTTP" class="xref">HTTP</a>]</span>.<a href="#section-5.2.1.6-1" class="pilcrow">¶</a></p>
26422642+</section>
26432643+</div>
26442644+<div id="cache-request-directive.only-if-cached">
26452645+<section id="section-5.2.1.7">
26462646+ <h5 id="name-only-if-cached">
26472647+<a href="#section-5.2.1.7" class="section-number selfRef">5.2.1.7. </a><a href="#name-only-if-cached" class="section-name selfRef">only-if-cached</a>
26482648+ </h5>
26492649+<span id="iref-only-if-cached-cache-direct" class="iref"></span>
26502650+ <p id="section-5.2.1.7-1">
26512651+ The only-if-cached request directive indicates that the client only
26522652+ wishes to obtain a stored response. Caches that honor this request
26532653+ directive <span class="bcp14">SHOULD</span>, upon receiving it, respond with either a stored
26542654+ response consistent with the other constraints of the request or
26552655+ a 504 (Gateway Timeout) status code.<a href="#section-5.2.1.7-1" class="pilcrow">¶</a></p>
26562656+</section>
26572657+</div>
26582658+</section>
26592659+</div>
26602660+<div id="cache-response-directive">
26612661+<section id="section-5.2.2">
26622662+ <h4 id="name-response-directives">
26632663+<a href="#section-5.2.2" class="section-number selfRef">5.2.2. </a><a href="#name-response-directives" class="section-name selfRef">Response Directives</a>
26642664+ </h4>
26652665+<p id="section-5.2.2-1">
26662666+ This section defines cache response directives. A cache <span class="bcp14">MUST</span> obey the
26672667+ Cache-Control directives defined in this section.<a href="#section-5.2.2-1" class="pilcrow">¶</a></p>
26682668+<div id="cache-response-directive.max-age">
26692669+<section id="section-5.2.2.1">
26702670+ <h5 id="name-max-age-2">
26712671+<a href="#section-5.2.2.1" class="section-number selfRef">5.2.2.1. </a><a href="#name-max-age-2" class="section-name selfRef">max-age</a>
26722672+ </h5>
26732673+<span id="iref-max-age-cache-directive-35" class="iref"></span>
26742674+ <p id="section-5.2.2.1-1">
26752675+ Argument syntax:<a href="#section-5.2.2.1-1" class="pilcrow">¶</a></p>
26762676+<ul class="normal ulEmpty">
26772677+<li class="normal ulEmpty" id="section-5.2.2.1-2.1">
26782678+ <a href="#delta-seconds" class="xref">delta-seconds</a> (see <a href="#delta-seconds" class="xref">Section 1.2.2</a>)<a href="#section-5.2.2.1-2.1" class="pilcrow">¶</a>
26792679+</li>
26802680+ </ul>
26812681+<p id="section-5.2.2.1-3">
26822682+ The max-age response directive indicates that the response is to be
26832683+ considered stale after its age is greater than the specified number of
26842684+ seconds.<a href="#section-5.2.2.1-3" class="pilcrow">¶</a></p>
26852685+<p id="section-5.2.2.1-4">
26862686+ This directive uses the token form of the argument syntax:
26872687+ e.g., 'max-age=5' not 'max-age="5"'. A sender <span class="bcp14">MUST NOT</span> generate the
26882688+ quoted-string form.<a href="#section-5.2.2.1-4" class="pilcrow">¶</a></p>
26892689+</section>
26902690+</div>
26912691+<div id="cache-response-directive.must-revalidate">
26922692+<section id="section-5.2.2.2">
26932693+ <h5 id="name-must-revalidate">
26942694+<a href="#section-5.2.2.2" class="section-number selfRef">5.2.2.2. </a><a href="#name-must-revalidate" class="section-name selfRef">must-revalidate</a>
26952695+ </h5>
26962696+<span id="iref-must-revalidate-cache-direc" class="iref"></span>
26972697+ <p id="section-5.2.2.2-1">
26982698+ The must-revalidate response directive indicates that once the response
26992699+ has become stale, a cache <span class="bcp14">MUST NOT</span> reuse that response to satisfy
27002700+ another request until it has been successfully validated by the origin, as
27012701+ defined by <a href="#validation.model" class="xref">Section 4.3</a>.<a href="#section-5.2.2.2-1" class="pilcrow">¶</a></p>
27022702+<p id="section-5.2.2.2-2">
27032703+ The must-revalidate directive is necessary to support reliable operation
27042704+ for certain protocol features. In all circumstances, a cache <span class="bcp14">MUST NOT</span> ignore
27052705+ the must-revalidate directive; in particular, if a cache is disconnected,
27062706+ the cache <span class="bcp14">MUST</span> generate an error response rather than reuse the stale response.
27072707+ The generated status code <span class="bcp14">SHOULD</span> be 504 (Gateway Timeout)
27082708+ unless another error status code is more applicable.<a href="#section-5.2.2.2-2" class="pilcrow">¶</a></p>
27092709+<p id="section-5.2.2.2-3">
27102710+ The must-revalidate directive ought to be used by servers if and only
27112711+ if failure to validate a request could cause
27122712+ incorrect operation, such as a silently unexecuted financial
27132713+ transaction.<a href="#section-5.2.2.2-3" class="pilcrow">¶</a></p>
27142714+<p id="section-5.2.2.2-4">
27152715+ The must-revalidate directive also permits a shared cache to
27162716+ reuse a response to a request containing an Authorization
27172717+ header field (<span><a href="https://www.rfc-editor.org/rfc/rfc9110#section-11.6.2" class="relref">Section 11.6.2</a> of [<a href="#HTTP" class="xref">HTTP</a>]</span>),
27182718+ subject to the above requirement on revalidation
27192719+ (<a href="#caching.authenticated.responses" class="xref">Section 3.5</a>).<a href="#section-5.2.2.2-4" class="pilcrow">¶</a></p>
27202720+</section>
27212721+</div>
27222722+<div id="cache-response-directive.must-understand">
27232723+<section id="section-5.2.2.3">
27242724+ <h5 id="name-must-understand">
27252725+<a href="#section-5.2.2.3" class="section-number selfRef">5.2.2.3. </a><a href="#name-must-understand" class="section-name selfRef">must-understand</a>
27262726+ </h5>
27272727+<span id="iref-must-understand-cache-direc" class="iref"></span>
27282728+ <p id="section-5.2.2.3-1">
27292729+ The must-understand response directive limits caching of the response to
27302730+ a cache that understands and conforms to the requirements for that
27312731+ response's status code.<a href="#section-5.2.2.3-1" class="pilcrow">¶</a></p>
27322732+<p id="section-5.2.2.3-2">
27332733+ A response that contains the must-understand directive <span class="bcp14">SHOULD</span>
27342734+ also contain the no-store directive. When a cache that implements the
27352735+ must-understand directive receives a response that includes it,
27362736+ the cache <span class="bcp14">SHOULD</span> ignore the no-store directive if it
27372737+ understands and implements the status code's caching requirements.<a href="#section-5.2.2.3-2" class="pilcrow">¶</a></p>
27382738+</section>
27392739+</div>
27402740+<div id="cache-response-directive.no-cache">
27412741+<section id="section-5.2.2.4">
27422742+ <h5 id="name-no-cache-2">
27432743+<a href="#section-5.2.2.4" class="section-number selfRef">5.2.2.4. </a><a href="#name-no-cache-2" class="section-name selfRef">no-cache</a>
27442744+ </h5>
27452745+<span id="iref-no-cache-cache-directive-38" class="iref"></span>
27462746+ <p id="section-5.2.2.4-1">
27472747+ Argument syntax:<a href="#section-5.2.2.4-1" class="pilcrow">¶</a></p>
27482748+<ul class="normal ulEmpty">
27492749+<li class="normal ulEmpty" id="section-5.2.2.4-2.1">#<a href="#imported.rules" class="xref">field-name</a><a href="#section-5.2.2.4-2.1" class="pilcrow">¶</a>
27502750+</li>
27512751+ </ul>
27522752+<p id="section-5.2.2.4-3">
27532753+ The no-cache response directive, in its unqualified form (without an
27542754+ argument), indicates that the response <span class="bcp14">MUST NOT</span> be used to satisfy any
27552755+ other request without forwarding it for validation and receiving a
27562756+ successful response; see <a href="#validation.model" class="xref">Section 4.3</a>.<a href="#section-5.2.2.4-3" class="pilcrow">¶</a></p>
27572757+<p id="section-5.2.2.4-4">
27582758+ This allows an origin server to prevent a cache from using
27592759+ the response to satisfy a request without contacting it, even by caches that have
27602760+ been configured to send stale responses.<a href="#section-5.2.2.4-4" class="pilcrow">¶</a></p>
27612761+<p id="section-5.2.2.4-5">
27622762+ The qualified form of the no-cache response directive, with an argument that
27632763+ lists one or more field names, indicates that a cache <span class="bcp14">MAY</span> use the
27642764+ response to satisfy a subsequent request, subject to any other restrictions
27652765+ on caching, if the listed header fields are excluded from the subsequent
27662766+ response or the subsequent response has been successfully revalidated with
27672767+ the origin server (updating or removing those fields).
27682768+ This allows an origin server to prevent the reuse of certain header
27692769+ fields in a response, while still allowing caching of the rest of the
27702770+ response.<a href="#section-5.2.2.4-5" class="pilcrow">¶</a></p>
27712771+<p id="section-5.2.2.4-6">
27722772+ The field names given are not limited to the set of header
27732773+ fields defined by this specification. Field names are case-insensitive.<a href="#section-5.2.2.4-6" class="pilcrow">¶</a></p>
27742774+<p id="section-5.2.2.4-7">
27752775+ This directive uses the quoted-string form of the argument syntax.
27762776+ A sender <span class="bcp14">SHOULD NOT</span> generate the token form (even if quoting appears not
27772777+ to be needed for single-entry lists).<a href="#section-5.2.2.4-7" class="pilcrow">¶</a></p>
27782778+<aside id="section-5.2.2.4-8">
27792779+ <p id="section-5.2.2.4-8.1">
27802780+ <strong>Note:</strong> The
27812781+ qualified form of the directive is often handled by caches as if an
27822782+ unqualified no-cache directive was received; that is, the special handling
27832783+ for the qualified form is not widely implemented.<a href="#section-5.2.2.4-8.1" class="pilcrow">¶</a></p>
27842784+</aside>
27852785+</section>
27862786+</div>
27872787+<div id="cache-response-directive.no-store">
27882788+<section id="section-5.2.2.5">
27892789+ <h5 id="name-no-store-2">
27902790+<a href="#section-5.2.2.5" class="section-number selfRef">5.2.2.5. </a><a href="#name-no-store-2" class="section-name selfRef">no-store</a>
27912791+ </h5>
27922792+<span id="iref-no-store-cache-directive-39" class="iref"></span>
27932793+ <p id="section-5.2.2.5-1">
27942794+ The no-store response directive indicates that a cache <span class="bcp14">MUST NOT</span> store
27952795+ any part of either the immediate request or the response and <span class="bcp14">MUST NOT</span> use
27962796+ the response to satisfy any other request.<a href="#section-5.2.2.5-1" class="pilcrow">¶</a></p>
27972797+<p id="section-5.2.2.5-2">
27982798+ This directive applies to both private and shared caches. "MUST NOT
27992799+ store" in this context means that the cache <span class="bcp14">MUST NOT</span> intentionally store
28002800+ the information in non-volatile storage and <span class="bcp14">MUST</span> make a best-effort
28012801+ attempt to remove the information from volatile storage as promptly as
28022802+ possible after forwarding it.<a href="#section-5.2.2.5-2" class="pilcrow">¶</a></p>
28032803+<p id="section-5.2.2.5-3">
28042804+ This directive is not a reliable or sufficient mechanism for ensuring
28052805+ privacy. In particular, malicious or compromised caches might not
28062806+ recognize or obey this directive, and communications networks might be
28072807+ vulnerable to eavesdropping.<a href="#section-5.2.2.5-3" class="pilcrow">¶</a></p>
28082808+<p id="section-5.2.2.5-4">
28092809+ Note that the must-understand cache directive overrides no-store in certain
28102810+ circumstances; see <a href="#cache-response-directive.must-understand" class="xref">Section 5.2.2.3</a>.<a href="#section-5.2.2.5-4" class="pilcrow">¶</a></p>
28112811+</section>
28122812+</div>
28132813+<div id="cache-response-directive.no-transform">
28142814+<section id="section-5.2.2.6">
28152815+ <h5 id="name-no-transform-2">
28162816+<a href="#section-5.2.2.6" class="section-number selfRef">5.2.2.6. </a><a href="#name-no-transform-2" class="section-name selfRef">no-transform</a>
28172817+ </h5>
28182818+<span id="iref-no-transform-cache-directive" class="iref"></span>
28192819+ <p id="section-5.2.2.6-1">
28202820+ The no-transform response directive indicates that an intermediary
28212821+ (regardless of whether it implements a cache) <span class="bcp14">MUST NOT</span> transform the
28222822+ content, as defined in <span><a href="https://www.rfc-editor.org/rfc/rfc9110#section-7.7" class="relref">Section 7.7</a> of [<a href="#HTTP" class="xref">HTTP</a>]</span>.<a href="#section-5.2.2.6-1" class="pilcrow">¶</a></p>
28232823+</section>
28242824+</div>
28252825+<div id="cache-response-directive.private">
28262826+<section id="section-5.2.2.7">
28272827+ <h5 id="name-private">
28282828+<a href="#section-5.2.2.7" class="section-number selfRef">5.2.2.7. </a><a href="#name-private" class="section-name selfRef">private</a>
28292829+ </h5>
28302830+<span id="iref-private-cache-directive-41" class="iref"></span>
28312831+ <p id="section-5.2.2.7-1">
28322832+ Argument syntax:<a href="#section-5.2.2.7-1" class="pilcrow">¶</a></p>
28332833+<ul class="normal ulEmpty">
28342834+<li class="normal ulEmpty" id="section-5.2.2.7-2.1">#<a href="#imported.rules" class="xref">field-name</a><a href="#section-5.2.2.7-2.1" class="pilcrow">¶</a>
28352835+</li>
28362836+ </ul>
28372837+<p id="section-5.2.2.7-3">
28382838+ The unqualified private response directive indicates that
28392839+ a shared cache <span class="bcp14">MUST NOT</span> store the response (i.e., the response is
28402840+ intended for a single user).
28412841+ It also indicates that a private cache <span class="bcp14">MAY</span> store the response, subject
28422842+ to the constraints defined in <a href="#response.cacheability" class="xref">Section 3</a>, even if
28432843+ the response would not otherwise be heuristically cacheable by a private
28442844+ cache.<a href="#section-5.2.2.7-3" class="pilcrow">¶</a></p>
28452845+<p id="section-5.2.2.7-4">
28462846+ If a qualified private response directive is present, with an argument that
28472847+ lists one or more field names, then only the listed header fields are limited to a
28482848+ single user: a shared cache <span class="bcp14">MUST NOT</span> store the listed header fields if they
28492849+ are present in the original response but <span class="bcp14">MAY</span> store the remainder of the
28502850+ response message without those header fields, subject
28512851+ the constraints defined in <a href="#response.cacheability" class="xref">Section 3</a>.<a href="#section-5.2.2.7-4" class="pilcrow">¶</a></p>
28522852+<p id="section-5.2.2.7-5">
28532853+ The field names given are not limited to the set of header
28542854+ fields defined by this specification. Field names are case-insensitive.<a href="#section-5.2.2.7-5" class="pilcrow">¶</a></p>
28552855+<p id="section-5.2.2.7-6">
28562856+ This directive uses the quoted-string form of the argument syntax.
28572857+ A sender <span class="bcp14">SHOULD NOT</span> generate the token form (even if quoting appears not
28582858+ to be needed for single-entry lists).<a href="#section-5.2.2.7-6" class="pilcrow">¶</a></p>
28592859+<aside id="section-5.2.2.7-7">
28602860+ <p id="section-5.2.2.7-7.1">
28612861+ <strong>Note:</strong> This usage of the word "private" only controls
28622862+ where the response can be stored; it cannot ensure the privacy of the
28632863+ message content. Also, the qualified form of the directive is
28642864+ often handled by caches as if an unqualified private directive
28652865+ was received; that is, the special handling for the qualified form is not
28662866+ widely implemented.<a href="#section-5.2.2.7-7.1" class="pilcrow">¶</a></p>
28672867+</aside>
28682868+</section>
28692869+</div>
28702870+<div id="cache-response-directive.proxy-revalidate">
28712871+<section id="section-5.2.2.8">
28722872+ <h5 id="name-proxy-revalidate">
28732873+<a href="#section-5.2.2.8" class="section-number selfRef">5.2.2.8. </a><a href="#name-proxy-revalidate" class="section-name selfRef">proxy-revalidate</a>
28742874+ </h5>
28752875+<span id="iref-proxy-revalidate-cache-dire" class="iref"></span>
28762876+ <p id="section-5.2.2.8-1">
28772877+ The proxy-revalidate response directive indicates that once the response
28782878+ has become stale, a shared cache <span class="bcp14">MUST NOT</span> reuse that response to satisfy
28792879+ another request until it has been successfully validated by the origin,
28802880+ as defined by <a href="#validation.model" class="xref">Section 4.3</a>. This is analogous to
28812881+ must-revalidate (<a href="#cache-response-directive.must-revalidate" class="xref">Section 5.2.2.2</a>),
28822882+ except that proxy-revalidate does not apply to private caches.<a href="#section-5.2.2.8-1" class="pilcrow">¶</a></p>
28832883+<p id="section-5.2.2.8-2">
28842884+ Note that proxy-revalidate on its own does not imply that a response is
28852885+ cacheable. For example, it might be combined with the public directive
28862886+ (<a href="#cache-response-directive.public" class="xref">Section 5.2.2.9</a>), allowing the response
28872887+ to be cached while requiring only a shared cache to revalidate when stale.<a href="#section-5.2.2.8-2" class="pilcrow">¶</a></p>
28882888+</section>
28892889+</div>
28902890+<div id="cache-response-directive.public">
28912891+<section id="section-5.2.2.9">
28922892+ <h5 id="name-public">
28932893+<a href="#section-5.2.2.9" class="section-number selfRef">5.2.2.9. </a><a href="#name-public" class="section-name selfRef">public</a>
28942894+ </h5>
28952895+<span id="iref-public-cache-directive-43" class="iref"></span>
28962896+ <p id="section-5.2.2.9-1">
28972897+ The public response directive indicates that a cache <span class="bcp14">MAY</span> store the
28982898+ response even if it would otherwise be prohibited, subject to the
28992899+ constraints defined in <a href="#response.cacheability" class="xref">Section 3</a>. In other words,
29002900+ public explicitly marks the response as cacheable. For example,
29012901+ public permits a shared cache to reuse a response to a request containing
29022902+ an Authorization header field (<a href="#caching.authenticated.responses" class="xref">Section 3.5</a>).<a href="#section-5.2.2.9-1" class="pilcrow">¶</a></p>
29032903+<p id="section-5.2.2.9-2">
29042904+ Note that it is unnecessary to add the public directive to a response that
29052905+ is already cacheable according to <a href="#response.cacheability" class="xref">Section 3</a>.<a href="#section-5.2.2.9-2" class="pilcrow">¶</a></p>
29062906+<p id="section-5.2.2.9-3">
29072907+ If a response with the public directive has no explicit freshness information,
29082908+ it is heuristically cacheable (<a href="#heuristic.freshness" class="xref">Section 4.2.2</a>).<a href="#section-5.2.2.9-3" class="pilcrow">¶</a></p>
29092909+</section>
29102910+</div>
29112911+<div id="cache-response-directive.s-maxage">
29122912+<section id="section-5.2.2.10">
29132913+ <h5 id="name-s-maxage">
29142914+<a href="#section-5.2.2.10" class="section-number selfRef">5.2.2.10. </a><a href="#name-s-maxage" class="section-name selfRef">s-maxage</a>
29152915+ </h5>
29162916+<span id="iref-s-maxage-cache-directive-44" class="iref"></span>
29172917+ <p id="section-5.2.2.10-1">
29182918+ Argument syntax:<a href="#section-5.2.2.10-1" class="pilcrow">¶</a></p>
29192919+<ul class="normal ulEmpty">
29202920+<li class="normal ulEmpty" id="section-5.2.2.10-2.1">
29212921+ <a href="#delta-seconds" class="xref">delta-seconds</a> (see <a href="#delta-seconds" class="xref">Section 1.2.2</a>)<a href="#section-5.2.2.10-2.1" class="pilcrow">¶</a>
29222922+</li>
29232923+ </ul>
29242924+<p id="section-5.2.2.10-3">
29252925+ The s-maxage response directive indicates that, for a shared cache, the
29262926+ maximum age specified by this directive overrides the maximum age
29272927+ specified by either the max-age directive or the <a href="#field.expires" class="xref">Expires</a>
29282928+ header field.<a href="#section-5.2.2.10-3" class="pilcrow">¶</a></p>
29292929+<p id="section-5.2.2.10-4">
29302930+ The s-maxage directive incorporates the
29312931+ semantics of the proxy‑revalidate response directive (<a href="#cache-response-directive.proxy-revalidate" class="xref">Section 5.2.2.8</a>)
29322932+ for a shared cache.
29332933+ A shared cache <span class="bcp14">MUST NOT</span> reuse a stale response with s-maxage to satisfy
29342934+ another request until it has been successfully validated by the origin, as
29352935+ defined by <a href="#validation.model" class="xref">Section 4.3</a>.
29362936+ This directive also permits a shared cache to reuse a response to a
29372937+ request containing an Authorization header field, subject to the above
29382938+ requirements on maximum age and revalidation
29392939+ (<a href="#caching.authenticated.responses" class="xref">Section 3.5</a>).<a href="#section-5.2.2.10-4" class="pilcrow">¶</a></p>
29402940+<p id="section-5.2.2.10-5">
29412941+ This directive uses the token form of the argument syntax:
29422942+ e.g., 's-maxage=10' not 's-maxage="10"'. A sender <span class="bcp14">MUST NOT</span> generate
29432943+ the quoted-string form.<a href="#section-5.2.2.10-5" class="pilcrow">¶</a></p>
29442944+</section>
29452945+</div>
29462946+</section>
29472947+</div>
29482948+<div id="cache.control.extensions">
29492949+<section id="section-5.2.3">
29502950+ <h4 id="name-extension-directives">
29512951+<a href="#section-5.2.3" class="section-number selfRef">5.2.3. </a><a href="#name-extension-directives" class="section-name selfRef">Extension Directives</a>
29522952+ </h4>
29532953+<p id="section-5.2.3-1">
29542954+ The Cache-Control header field can be extended through the use of one or
29552955+ more extension cache directives.
29562956+ A cache <span class="bcp14">MUST</span> ignore unrecognized cache directives.<a href="#section-5.2.3-1" class="pilcrow">¶</a></p>
29572957+<p id="section-5.2.3-2">
29582958+ Informational extensions (those that do not require a change in cache
29592959+ behavior) can be added without changing the semantics of other directives.<a href="#section-5.2.3-2" class="pilcrow">¶</a></p>
29602960+<p id="section-5.2.3-3">
29612961+ Behavioral extensions are designed to work by acting as modifiers to the
29622962+ existing base of cache directives.
29632963+ Both the new directive and the old directive are supplied, such that
29642964+ applications that do not understand the new directive will default to the
29652965+ behavior specified by the old directive, and those that understand the
29662966+ new directive will recognize it as modifying the requirements associated
29672967+ with the old directive. In this way, extensions to the existing
29682968+ cache directives can be made without breaking deployed caches.<a href="#section-5.2.3-3" class="pilcrow">¶</a></p>
29692969+<p id="section-5.2.3-4">
29702970+ For example, consider a hypothetical new response directive called
29712971+ "community" that acts as a modifier to the private directive: in addition
29722972+ to private caches, only a cache that is shared by members of the named
29732973+ community is allowed to cache the response. An origin server wishing to
29742974+ allow the UCI community to use an otherwise private response in their
29752975+ shared cache(s) could do so by including<a href="#section-5.2.3-4" class="pilcrow">¶</a></p>
29762976+<div id="section-5.2.3-5">
29772977+<pre class="lang-http-message sourcecode">Cache-Control: private, community="UCI"
29782978+</pre><a href="#section-5.2.3-5" class="pilcrow">¶</a>
29792979+</div>
29802980+<p id="section-5.2.3-6">
29812981+ A cache that recognizes such a community cache directive could broaden its
29822982+ behavior in accordance with that extension. A cache that does not
29832983+ recognize the community cache directive would ignore it and adhere to the
29842984+ private directive.<a href="#section-5.2.3-6" class="pilcrow">¶</a></p>
29852985+<p id="section-5.2.3-7">
29862986+ New extension directives ought to consider defining:<a href="#section-5.2.3-7" class="pilcrow">¶</a></p>
29872987+<ul class="normal">
29882988+<li class="normal" id="section-5.2.3-8.1">What it means for a directive to be specified multiple times,<a href="#section-5.2.3-8.1" class="pilcrow">¶</a>
29892989+</li>
29902990+ <li class="normal" id="section-5.2.3-8.2">When the directive does not take an argument, what it means when an
29912991+ argument is present,<a href="#section-5.2.3-8.2" class="pilcrow">¶</a>
29922992+</li>
29932993+ <li class="normal" id="section-5.2.3-8.3">When the directive requires an argument, what it means when it is
29942994+ missing, and<a href="#section-5.2.3-8.3" class="pilcrow">¶</a>
29952995+</li>
29962996+ <li class="normal" id="section-5.2.3-8.4">Whether the directive is specific to requests, specific to responses, or able
29972997+ to be used in either.<a href="#section-5.2.3-8.4" class="pilcrow">¶</a>
29982998+</li>
29992999+ </ul>
30003000+</section>
30013001+</div>
30023002+<div id="cache.directive.registry">
30033003+<section id="section-5.2.4">
30043004+ <h4 id="name-cache-directive-registry">
30053005+<a href="#section-5.2.4" class="section-number selfRef">5.2.4. </a><a href="#name-cache-directive-registry" class="section-name selfRef">Cache Directive Registry</a>
30063006+ </h4>
30073007+<p id="section-5.2.4-1">
30083008+ The "Hypertext Transfer Protocol (HTTP) Cache Directive Registry" defines the namespace for the
30093009+ cache directives. It has been created and is now maintained at
30103010+ <span><<a href="https://www.iana.org/assignments/http-cache-directives">https://www.iana.org/assignments/http-cache-directives</a>></span>.<a href="#section-5.2.4-1" class="pilcrow">¶</a></p>
30113011+<p id="section-5.2.4-2">
30123012+ A registration <span class="bcp14">MUST</span> include the following fields:<a href="#section-5.2.4-2" class="pilcrow">¶</a></p>
30133013+<ul class="normal">
30143014+<li class="normal" id="section-5.2.4-3.1">Cache Directive Name<a href="#section-5.2.4-3.1" class="pilcrow">¶</a>
30153015+</li>
30163016+ <li class="normal" id="section-5.2.4-3.2">Pointer to specification text<a href="#section-5.2.4-3.2" class="pilcrow">¶</a>
30173017+</li>
30183018+ </ul>
30193019+<p id="section-5.2.4-4">
30203020+ Values to be added to this namespace require IETF Review (see <span>[<a href="#RFC8126" class="xref">RFC8126</a>], <a href="https://www.rfc-editor.org/rfc/rfc8126#section-4.8" class="relref">Section 4.8</a></span>).<a href="#section-5.2.4-4" class="pilcrow">¶</a></p>
30213021+</section>
30223022+</div>
30233023+</section>
30243024+</div>
30253025+<div id="field.expires">
30263026+<section id="section-5.3">
30273027+ <h3 id="name-expires">
30283028+<a href="#section-5.3" class="section-number selfRef">5.3. </a><a href="#name-expires" class="section-name selfRef">Expires</a>
30293029+ </h3>
30303030+<span id="iref-fields-expires-45" class="iref"></span>
30313031+ <span id="iref-header-fields-expires-46" class="iref"></span>
30323032+ <span id="iref-fields-expires-47" class="iref"></span>
30333033+ <span id="iref-header-fields-expires-48" class="iref"></span>
30343034+ <span id="iref-expires-header-field-49" class="iref"></span>
30353035+ <p id="section-5.3-1">
30363036+ The "Expires" response header field gives the date/time after which the
30373037+ response is considered stale. See <a href="#expiration.model" class="xref">Section 4.2</a> for
30383038+ further discussion of the freshness model.<a href="#section-5.3-1" class="pilcrow">¶</a></p>
30393039+<p id="section-5.3-2">
30403040+ The presence of an Expires header field does not imply that the original resource
30413041+ will change or cease to exist at, before, or after that time.<a href="#section-5.3-2" class="pilcrow">¶</a></p>
30423042+<p id="section-5.3-3">
30433043+ The Expires field value is an HTTP-date timestamp, as defined in <span><a href="https://www.rfc-editor.org/rfc/rfc9110#section-5.6.7" class="relref">Section 5.6.7</a> of [<a href="#HTTP" class="xref">HTTP</a>]</span>.
30443044+ See also <a href="#expiration.model" class="xref">Section 4.2</a> for parsing requirements specific to caches.<a href="#section-5.3-3" class="pilcrow">¶</a></p>
30453045+<span id="iref-grammar-expires-50" class="iref"></span>
30463046+ <div id="section-5.3-4">
30473047+<pre class="lang-abnf9110 sourcecode"> Expires = HTTP-date
30483048+</pre><a href="#section-5.3-4" class="pilcrow">¶</a>
30493049+</div>
30503050+<p id="section-5.3-5">
30513051+ For example<a href="#section-5.3-5" class="pilcrow">¶</a></p>
30523052+<div id="section-5.3-6">
30533053+<pre class="lang-http-message sourcecode">Expires: Thu, 01 Dec 1994 16:00:00 GMT
30543054+</pre><a href="#section-5.3-6" class="pilcrow">¶</a>
30553055+</div>
30563056+<p id="section-5.3-7">
30573057+ A cache recipient <span class="bcp14">MUST</span> interpret invalid date formats, especially the
30583058+ value "0", as representing a time in the past (i.e., "already expired").<a href="#section-5.3-7" class="pilcrow">¶</a></p>
30593059+<p id="section-5.3-8">
30603060+ If a response includes a <a href="#field.cache-control" class="xref">Cache-Control</a> header field with
30613061+ the max-age directive (<a href="#cache-response-directive.max-age" class="xref">Section 5.2.2.1</a>),
30623062+ a recipient <span class="bcp14">MUST</span> ignore the Expires header field.
30633063+ Likewise, if a response includes the s-maxage directive
30643064+ (<a href="#cache-response-directive.s-maxage" class="xref">Section 5.2.2.10</a>), a shared cache
30653065+ recipient <span class="bcp14">MUST</span> ignore the Expires header field. In both these cases, the value
30663066+ in Expires is only intended for recipients that have not yet implemented
30673067+ the Cache-Control header field.<a href="#section-5.3-8" class="pilcrow">¶</a></p>
30683068+<p id="section-5.3-9">
30693069+ An origin server without a clock (<span><a href="https://www.rfc-editor.org/rfc/rfc9110#section-5.6.7" class="relref">Section 5.6.7</a> of [<a href="#HTTP" class="xref">HTTP</a>]</span>)
30703070+ <span class="bcp14">MUST NOT</span> generate an Expires header field
30713071+ unless its value represents a fixed time in the past (always expired)
30723072+ or its value has been associated with the resource by a system with
30733073+ a clock.<a href="#section-5.3-9" class="pilcrow">¶</a></p>
30743074+<p id="section-5.3-10">
30753075+ Historically, HTTP required the Expires field value to be no more than a
30763076+ year in the future. While longer freshness lifetimes are no longer
30773077+ prohibited, extremely large values have been demonstrated to cause
30783078+ problems (e.g., clock overflows due to use of 32-bit integers for
30793079+ time values), and many caches will evict a response far sooner than
30803080+ that.<a href="#section-5.3-10" class="pilcrow">¶</a></p>
30813081+</section>
30823082+</div>
30833083+<div id="field.pragma">
30843084+<section id="section-5.4">
30853085+ <h3 id="name-pragma">
30863086+<a href="#section-5.4" class="section-number selfRef">5.4. </a><a href="#name-pragma" class="section-name selfRef">Pragma</a>
30873087+ </h3>
30883088+<span id="iref-fields-pragma-51" class="iref"></span>
30893089+ <span id="iref-header-fields-pragma-52" class="iref"></span>
30903090+ <span id="iref-fields-pragma-53" class="iref"></span>
30913091+ <span id="iref-header-fields-pragma-54" class="iref"></span>
30923092+ <span id="iref-pragma-header-field-55" class="iref"></span>
30933093+ <p id="section-5.4-1">
30943094+ The "Pragma" request header field was defined for HTTP/1.0 caches, so that clients
30953095+ could specify a "no-cache" request (as <a href="#field.cache-control" class="xref">Cache-Control</a> was
30963096+ not defined until HTTP/1.1).<a href="#section-5.4-1" class="pilcrow">¶</a></p>
30973097+<p id="section-5.4-2">
30983098+ However, support for Cache-Control is now widespread. As a result, this
30993099+ specification deprecates Pragma.<a href="#section-5.4-2" class="pilcrow">¶</a></p>
31003100+<aside id="section-5.4-3">
31013101+ <p id="section-5.4-3.1">
31023102+ <strong>Note:</strong> Because the meaning of "Pragma: no-cache" in responses was never
31033103+ specified, it does not provide a reliable replacement for
31043104+ "Cache-Control: no-cache" in them.<a href="#section-5.4-3.1" class="pilcrow">¶</a></p>
31053105+</aside>
31063106+</section>
31073107+</div>
31083108+<div id="field.warning">
31093109+<section id="section-5.5">
31103110+ <h3 id="name-warning">
31113111+<a href="#section-5.5" class="section-number selfRef">5.5. </a><a href="#name-warning" class="section-name selfRef">Warning</a>
31123112+ </h3>
31133113+<span id="iref-fields-warning-56" class="iref"></span>
31143114+ <span id="iref-header-fields-warning-57" class="iref"></span>
31153115+ <span id="iref-warning-header-field-58" class="iref"></span>
31163116+ <p id="section-5.5-1">
31173117+ The "Warning" header field was used to carry additional information
31183118+ about the status or transformation of a message that might not be reflected
31193119+ in the status code. This specification obsoletes it, as it is not widely
31203120+ generated or surfaced to users. The information it carried can be gleaned
31213121+ from examining other header fields, such as <a href="#field.age" class="xref">Age</a>.<a href="#section-5.5-1" class="pilcrow">¶</a></p>
31223122+</section>
31233123+</div>
31243124+</section>
31253125+</div>
31263126+<div id="history.lists">
31273127+<section id="section-6">
31283128+ <h2 id="name-relationship-to-application">
31293129+<a href="#section-6" class="section-number selfRef">6. </a><a href="#name-relationship-to-application" class="section-name selfRef">Relationship to Applications and Other Caches</a>
31303130+ </h2>
31313131+<p id="section-6-1">
31323132+ Applications using HTTP often specify additional forms of caching. For
31333133+ example, Web browsers often have history mechanisms such as "Back" buttons
31343134+ that can be used to redisplay a representation retrieved earlier in a
31353135+ session.<a href="#section-6-1" class="pilcrow">¶</a></p>
31363136+<p id="section-6-2">
31373137+ Likewise, some Web browsers implement caching of images and other assets
31383138+ within a page view; they may or may not honor HTTP caching semantics.<a href="#section-6-2" class="pilcrow">¶</a></p>
31393139+<p id="section-6-3">
31403140+ The requirements in this specification do not necessarily apply to how
31413141+ applications use data after it is retrieved from an HTTP cache. For example, a
31423142+ history mechanism can display a previous representation even if it has
31433143+ expired, and an application can use cached data in other ways beyond its
31443144+ freshness lifetime.<a href="#section-6-3" class="pilcrow">¶</a></p>
31453145+<p id="section-6-4">
31463146+ This specification does not prohibit the application from taking HTTP caching into
31473147+ account; for example, a history mechanism might tell the user that a view
31483148+ is stale, or it might honor cache directives (e.g., Cache-Control:
31493149+ no-store).<a href="#section-6-4" class="pilcrow">¶</a></p>
31503150+<p id="section-6-5">
31513151+ However, when an application caches data and does not make this
31523152+ apparent to or easily controllable by the user, it is strongly encouraged to
31533153+ define its operation with respect to HTTP cache directives so as
31543154+ not to surprise authors who expect caching semantics
31553155+ to be honored. For example, while it might be reasonable to define an
31563156+ application cache "above" HTTP that allows a response containing
31573157+ Cache-Control: no-store to be reused for requests that are directly related
31583158+ to the request that fetched it (such as those created during the same page
31593159+ load), it would likely be surprising and confusing to users and authors if it
31603160+ were allowed to be reused for requests unrelated in any way to the one from
31613161+ which it was obtained.<a href="#section-6-5" class="pilcrow">¶</a></p>
31623162+</section>
31633163+</div>
31643164+<div id="security.considerations">
31653165+<section id="section-7">
31663166+ <h2 id="name-security-considerations">
31673167+<a href="#section-7" class="section-number selfRef">7. </a><a href="#name-security-considerations" class="section-name selfRef">Security Considerations</a>
31683168+ </h2>
31693169+<p id="section-7-1">
31703170+ This section is meant to inform developers, information providers, and
31713171+ users of known security concerns specific to HTTP caching.
31723172+ More general security considerations are addressed in "HTTP/1.1"
31733173+ (<span><a href="https://www.rfc-editor.org/rfc/rfc9112#section-11" class="relref">Section 11</a> of [<a href="#HTTP11" class="xref">HTTP/1.1</a>]</span>)
31743174+ and "HTTP Semantics"
31753175+ (<span><a href="https://www.rfc-editor.org/rfc/rfc9110#section-17" class="relref">Section 17</a> of [<a href="#HTTP" class="xref">HTTP</a>]</span>).<a href="#section-7-1" class="pilcrow">¶</a></p>
31763176+<p id="section-7-2">
31773177+ Caches expose an additional attack surface because the contents of
31783178+ the cache represent an attractive target for malicious exploitation.
31793179+ Since cache contents persist after an HTTP request is complete, an attack
31803180+ on the cache can reveal information long after a user believes that the
31813181+ information has been removed from the network. Therefore, cache contents
31823182+ need to be protected as sensitive information.<a href="#section-7-2" class="pilcrow">¶</a></p>
31833183+<p id="section-7-3">
31843184+ In particular, because private caches are restricted to a single user,
31853185+ they can be used to reconstruct a user's activity. As a result, it is
31863186+ important for user agents to allow end users to control them, for example,
31873187+ by allowing stored responses to be removed for some or all origin servers.<a href="#section-7-3" class="pilcrow">¶</a></p>
31883188+<div id="cache.poisoning">
31893189+<section id="section-7.1">
31903190+ <h3 id="name-cache-poisoning">
31913191+<a href="#section-7.1" class="section-number selfRef">7.1. </a><a href="#name-cache-poisoning" class="section-name selfRef">Cache Poisoning</a>
31923192+ </h3>
31933193+<p id="section-7.1-1">
31943194+ Storing malicious content in a cache can extend the reach of an attacker
31953195+ to affect multiple users. Such
31963196+ "cache poisoning" attacks happen when an attacker uses
31973197+ implementation flaws, elevated privileges, or other techniques to insert
31983198+ a response into a cache. This is especially effective when shared caches
31993199+ are used to distribute malicious content to many clients.<a href="#section-7.1-1" class="pilcrow">¶</a></p>
32003200+<p id="section-7.1-2">
32013201+ One common attack vector for cache poisoning is to exploit differences in
32023202+ message parsing on proxies and in user agents; see <span><a href="https://www.rfc-editor.org/rfc/rfc9112#section-6.3" class="relref">Section 6.3</a> of [<a href="#HTTP11" class="xref">HTTP/1.1</a>]</span> for the relevant requirements regarding
32033203+ HTTP/1.1.<a href="#section-7.1-2" class="pilcrow">¶</a></p>
32043204+</section>
32053205+</div>
32063206+<div id="security.timing">
32073207+<section id="section-7.2">
32083208+ <h3 id="name-timing-attacks">
32093209+<a href="#section-7.2" class="section-number selfRef">7.2. </a><a href="#name-timing-attacks" class="section-name selfRef">Timing Attacks</a>
32103210+ </h3>
32113211+<p id="section-7.2-1">
32123212+ Because one of the primary uses of a cache is to optimize performance,
32133213+ its use can "leak" information about which resources have been previously
32143214+ requested.<a href="#section-7.2-1" class="pilcrow">¶</a></p>
32153215+<p id="section-7.2-2">
32163216+ For example, if a user visits a site and their browser caches some of its
32173217+ responses and then navigates to a second site, that site can attempt to
32183218+ load responses it knows exist on the first site. If they load
32193219+ quickly, it can be assumed that the user has visited that site, or even
32203220+ a specific page on it.<a href="#section-7.2-2" class="pilcrow">¶</a></p>
32213221+<p id="section-7.2-3">
32223222+ Such "timing attacks" can be mitigated by adding more information to the
32233223+ cache key, such as the identity of the referring site (to prevent the
32243224+ attack described above). This is sometimes called "double keying".<a href="#section-7.2-3" class="pilcrow">¶</a></p>
32253225+</section>
32263226+</div>
32273227+<div id="caching.of.sensitive.information">
32283228+<section id="section-7.3">
32293229+ <h3 id="name-caching-of-sensitive-inform">
32303230+<a href="#section-7.3" class="section-number selfRef">7.3. </a><a href="#name-caching-of-sensitive-inform" class="section-name selfRef">Caching of Sensitive Information</a>
32313231+ </h3>
32323232+<p id="section-7.3-1">
32333233+ Implementation and deployment flaws (often led to by the misunderstanding of cache
32343234+ operation) might lead to the caching of sensitive information (e.g.,
32353235+ authentication credentials) that is thought to be private, exposing it to
32363236+ unauthorized parties.<a href="#section-7.3-1" class="pilcrow">¶</a></p>
32373237+<p id="section-7.3-2">
32383238+ Note that the Set-Cookie response header field <span>[<a href="#COOKIE" class="xref">COOKIE</a>]</span>
32393239+ does not inhibit caching; a cacheable response with a Set-Cookie header
32403240+ field can be (and often is) used to satisfy subsequent requests to caches.
32413241+ Servers that wish to control caching of these responses are encouraged to
32423242+ emit appropriate Cache-Control response header fields.<a href="#section-7.3-2" class="pilcrow">¶</a></p>
32433243+</section>
32443244+</div>
32453245+</section>
32463246+</div>
32473247+<div id="iana.considerations">
32483248+<section id="section-8">
32493249+ <h2 id="name-iana-considerations">
32503250+<a href="#section-8" class="section-number selfRef">8. </a><a href="#name-iana-considerations" class="section-name selfRef">IANA Considerations</a>
32513251+ </h2>
32523252+<p id="section-8-1">
32533253+ The change controller for the following registrations is:
32543254+ "IETF (iesg@ietf.org) - Internet Engineering Task Force".<a href="#section-8-1" class="pilcrow">¶</a></p>
32553255+<div id="field.name.registration">
32563256+<section id="section-8.1">
32573257+ <h3 id="name-field-name-registration">
32583258+<a href="#section-8.1" class="section-number selfRef">8.1. </a><a href="#name-field-name-registration" class="section-name selfRef">Field Name Registration</a>
32593259+ </h3>
32603260+<p id="section-8.1-1">
32613261+ IANA has updated the "Hypertext Transfer Protocol (HTTP) Field
32623262+ Name Registry" at <span><<a href="https://www.iana.org/assignments/http-fields">https://www.iana.org/assignments/http-fields</a>></span>,
32633263+ as described in <span><a href="https://www.rfc-editor.org/rfc/rfc9110#section-18.4" class="relref">Section 18.4</a> of [<a href="#HTTP" class="xref">HTTP</a>]</span>,
32643264+ with the field names listed in the table below:<a href="#section-8.1-1" class="pilcrow">¶</a></p>
32653265+<div id="iana.header.registration.table">
32663266+<table class="left" id="table-1">
32673267+ <caption><a href="#table-1" class="selfRef">Table 1</a></caption>
32683268+<thead>
32693269+ <tr>
32703270+ <th class="text-left" rowspan="1" colspan="1">Field Name</th>
32713271+ <th class="text-left" rowspan="1" colspan="1">Status</th>
32723272+ <th class="text-left" rowspan="1" colspan="1">Section</th>
32733273+ <th class="text-left" rowspan="1" colspan="1">Comments</th>
32743274+ </tr>
32753275+ </thead>
32763276+ <tbody>
32773277+ <tr>
32783278+ <td class="text-left" rowspan="1" colspan="1">Age</td>
32793279+ <td class="text-left" rowspan="1" colspan="1">permanent</td>
32803280+ <td class="text-left" rowspan="1" colspan="1">
32813281+ <a href="#field.age" class="xref">5.1</a>
32823282+ </td>
32833283+ <td class="text-left" rowspan="1" colspan="1"></td>
32843284+ </tr>
32853285+ <tr>
32863286+ <td class="text-left" rowspan="1" colspan="1">Cache-Control</td>
32873287+ <td class="text-left" rowspan="1" colspan="1">permanent</td>
32883288+ <td class="text-left" rowspan="1" colspan="1">
32893289+ <a href="#field.cache-control" class="xref">5.2</a>
32903290+ </td>
32913291+ <td class="text-left" rowspan="1" colspan="1"></td>
32923292+ </tr>
32933293+ <tr>
32943294+ <td class="text-left" rowspan="1" colspan="1">Expires</td>
32953295+ <td class="text-left" rowspan="1" colspan="1">permanent</td>
32963296+ <td class="text-left" rowspan="1" colspan="1">
32973297+ <a href="#field.expires" class="xref">5.3</a>
32983298+ </td>
32993299+ <td class="text-left" rowspan="1" colspan="1"></td>
33003300+ </tr>
33013301+ <tr>
33023302+ <td class="text-left" rowspan="1" colspan="1">Pragma</td>
33033303+ <td class="text-left" rowspan="1" colspan="1">deprecated</td>
33043304+ <td class="text-left" rowspan="1" colspan="1">
33053305+ <a href="#field.pragma" class="xref">5.4</a>
33063306+ </td>
33073307+ <td class="text-left" rowspan="1" colspan="1"></td>
33083308+ </tr>
33093309+ <tr>
33103310+ <td class="text-left" rowspan="1" colspan="1">Warning</td>
33113311+ <td class="text-left" rowspan="1" colspan="1">obsoleted</td>
33123312+ <td class="text-left" rowspan="1" colspan="1">
33133313+ <a href="#field.warning" class="xref">5.5</a>
33143314+ </td>
33153315+ <td class="text-left" rowspan="1" colspan="1"></td>
33163316+ </tr>
33173317+ </tbody>
33183318+ </table>
33193319+</div>
33203320+</section>
33213321+</div>
33223322+<div id="cache.directive.registration">
33233323+<section id="section-8.2">
33243324+ <h3 id="name-cache-directive-registratio">
33253325+<a href="#section-8.2" class="section-number selfRef">8.2. </a><a href="#name-cache-directive-registratio" class="section-name selfRef">Cache Directive Registration</a>
33263326+ </h3>
33273327+<p id="section-8.2-1">
33283328+ IANA has updated the
33293329+ "Hypertext Transfer Protocol (HTTP) Cache Directive Registry"
33303330+ at <span><<a href="https://www.iana.org/assignments/http-cache-directives">https://www.iana.org/assignments/http-cache-directives</a>></span>
33313331+ with the registration procedure per <a href="#cache.directive.registry" class="xref">Section 5.2.4</a>
33323332+ and the cache directive names summarized in the table below.<a href="#section-8.2-1" class="pilcrow">¶</a></p>
33333333+<div id="iana.cache.directive.registration.table">
33343334+<table class="left" id="table-2">
33353335+ <caption><a href="#table-2" class="selfRef">Table 2</a></caption>
33363336+<thead>
33373337+ <tr>
33383338+ <th class="text-left" rowspan="1" colspan="1">Cache Directive</th>
33393339+ <th class="text-left" rowspan="1" colspan="1">Section</th>
33403340+ </tr>
33413341+ </thead>
33423342+ <tbody>
33433343+ <tr>
33443344+ <td class="text-left" rowspan="1" colspan="1">max-age</td>
33453345+ <td class="text-left" rowspan="1" colspan="1">
33463346+ <a href="#cache-request-directive.max-age" class="xref">5.2.1.1</a>, <a href="#cache-response-directive.max-age" class="xref">5.2.2.1</a>
33473347+ </td>
33483348+ </tr>
33493349+ <tr>
33503350+ <td class="text-left" rowspan="1" colspan="1">max-stale</td>
33513351+ <td class="text-left" rowspan="1" colspan="1">
33523352+ <a href="#cache-request-directive.max-stale" class="xref">5.2.1.2</a>
33533353+ </td>
33543354+ </tr>
33553355+ <tr>
33563356+ <td class="text-left" rowspan="1" colspan="1">min-fresh</td>
33573357+ <td class="text-left" rowspan="1" colspan="1">
33583358+ <a href="#cache-request-directive.min-fresh" class="xref">5.2.1.3</a>
33593359+ </td>
33603360+ </tr>
33613361+ <tr>
33623362+ <td class="text-left" rowspan="1" colspan="1">must-revalidate</td>
33633363+ <td class="text-left" rowspan="1" colspan="1">
33643364+ <a href="#cache-response-directive.must-revalidate" class="xref">5.2.2.2</a>
33653365+ </td>
33663366+ </tr>
33673367+ <tr>
33683368+ <td class="text-left" rowspan="1" colspan="1">must-understand</td>
33693369+ <td class="text-left" rowspan="1" colspan="1">
33703370+ <a href="#cache-response-directive.must-understand" class="xref">5.2.2.3</a>
33713371+ </td>
33723372+ </tr>
33733373+ <tr>
33743374+ <td class="text-left" rowspan="1" colspan="1">no-cache</td>
33753375+ <td class="text-left" rowspan="1" colspan="1">
33763376+ <a href="#cache-request-directive.no-cache" class="xref">5.2.1.4</a>, <a href="#cache-response-directive.no-cache" class="xref">5.2.2.4</a>
33773377+ </td>
33783378+ </tr>
33793379+ <tr>
33803380+ <td class="text-left" rowspan="1" colspan="1">no-store</td>
33813381+ <td class="text-left" rowspan="1" colspan="1">
33823382+ <a href="#cache-request-directive.no-store" class="xref">5.2.1.5</a>, <a href="#cache-response-directive.no-store" class="xref">5.2.2.5</a>
33833383+ </td>
33843384+ </tr>
33853385+ <tr>
33863386+ <td class="text-left" rowspan="1" colspan="1">no-transform</td>
33873387+ <td class="text-left" rowspan="1" colspan="1">
33883388+ <a href="#cache-request-directive.no-transform" class="xref">5.2.1.6</a>, <a href="#cache-response-directive.no-transform" class="xref">5.2.2.6</a>
33893389+ </td>
33903390+ </tr>
33913391+ <tr>
33923392+ <td class="text-left" rowspan="1" colspan="1">only-if-cached</td>
33933393+ <td class="text-left" rowspan="1" colspan="1">
33943394+ <a href="#cache-request-directive.only-if-cached" class="xref">5.2.1.7</a>
33953395+ </td>
33963396+ </tr>
33973397+ <tr>
33983398+ <td class="text-left" rowspan="1" colspan="1">private</td>
33993399+ <td class="text-left" rowspan="1" colspan="1">
34003400+ <a href="#cache-response-directive.private" class="xref">5.2.2.7</a>
34013401+ </td>
34023402+ </tr>
34033403+ <tr>
34043404+ <td class="text-left" rowspan="1" colspan="1">proxy-revalidate</td>
34053405+ <td class="text-left" rowspan="1" colspan="1">
34063406+ <a href="#cache-response-directive.proxy-revalidate" class="xref">5.2.2.8</a>
34073407+ </td>
34083408+ </tr>
34093409+ <tr>
34103410+ <td class="text-left" rowspan="1" colspan="1">public</td>
34113411+ <td class="text-left" rowspan="1" colspan="1">
34123412+ <a href="#cache-response-directive.public" class="xref">5.2.2.9</a>
34133413+ </td>
34143414+ </tr>
34153415+ <tr>
34163416+ <td class="text-left" rowspan="1" colspan="1">s-maxage</td>
34173417+ <td class="text-left" rowspan="1" colspan="1">
34183418+ <a href="#cache-response-directive.s-maxage" class="xref">5.2.2.10</a>
34193419+ </td>
34203420+ </tr>
34213421+ </tbody>
34223422+ </table>
34233423+</div>
34243424+</section>
34253425+</div>
34263426+<div id="warn.code.registration">
34273427+<section id="section-8.3">
34283428+ <h3 id="name-warn-code-registry">
34293429+<a href="#section-8.3" class="section-number selfRef">8.3. </a><a href="#name-warn-code-registry" class="section-name selfRef">Warn Code Registry</a>
34303430+ </h3>
34313431+<p id="section-8.3-1">
34323432+ IANA has added the following note to the "Hypertext Transfer Protocol (HTTP) Warn Codes"
34333433+ registry at <span><<a href="https://www.iana.org/assignments/http-warn-codes">https://www.iana.org/assignments/http-warn-codes</a>></span>
34343434+ stating that "Warning" has been obsoleted:<a href="#section-8.3-1" class="pilcrow">¶</a></p>
34353435+<blockquote id="section-8.3-2">
34363436+ <p id="section-8.3-2.1">
34373437+ The Warning header field (and the warn codes that it uses) has been obsoleted
34383438+ for HTTP per [RFC9111].<a href="#section-8.3-2.1" class="pilcrow">¶</a></p>
34393439+</blockquote>
34403440+</section>
34413441+</div>
34423442+</section>
34433443+</div>
34443444+<section id="section-9">
34453445+ <h2 id="name-references">
34463446+<a href="#section-9" class="section-number selfRef">9. </a><a href="#name-references" class="section-name selfRef">References</a>
34473447+ </h2>
34483448+<section id="section-9.1">
34493449+ <h3 id="name-normative-references">
34503450+<a href="#section-9.1" class="section-number selfRef">9.1. </a><a href="#name-normative-references" class="section-name selfRef">Normative References</a>
34513451+ </h3>
34523452+<dl class="references">
34533453+<dt id="HTTP">[HTTP]</dt>
34543454+ <dd>
34553455+<span class="refAuthor">Fielding, R., Ed.</span>, <span class="refAuthor">Nottingham, M., Ed.</span>, and <span class="refAuthor">J. Reschke, Ed.</span>, <span class="refTitle">"HTTP Semantics"</span>, <span class="seriesInfo">STD 97</span>, <span class="seriesInfo">RFC 9110</span>, <span class="seriesInfo">DOI 10.17487/RFC9110</span>, <time datetime="2022-06" class="refDate">June 2022</time>, <span><<a href="https://www.rfc-editor.org/info/rfc9110">https://www.rfc-editor.org/info/rfc9110</a>></span>. </dd>
34563456+<dd class="break"></dd>
34573457+<dt id="RFC2119">[RFC2119]</dt>
34583458+ <dd>
34593459+<span class="refAuthor">Bradner, S.</span>, <span class="refTitle">"Key words for use in RFCs to Indicate Requirement Levels"</span>, <span class="seriesInfo">BCP 14</span>, <span class="seriesInfo">RFC 2119</span>, <span class="seriesInfo">DOI 10.17487/RFC2119</span>, <time datetime="1997-03" class="refDate">March 1997</time>, <span><<a href="https://www.rfc-editor.org/info/rfc2119">https://www.rfc-editor.org/info/rfc2119</a>></span>. </dd>
34603460+<dd class="break"></dd>
34613461+<dt id="RFC5234">[RFC5234]</dt>
34623462+ <dd>
34633463+<span class="refAuthor">Crocker, D., Ed.</span> and <span class="refAuthor">P. Overell</span>, <span class="refTitle">"Augmented BNF for Syntax Specifications: ABNF"</span>, <span class="seriesInfo">STD 68</span>, <span class="seriesInfo">RFC 5234</span>, <span class="seriesInfo">DOI 10.17487/RFC5234</span>, <time datetime="2008-01" class="refDate">January 2008</time>, <span><<a href="https://www.rfc-editor.org/info/rfc5234">https://www.rfc-editor.org/info/rfc5234</a>></span>. </dd>
34643464+<dd class="break"></dd>
34653465+<dt id="RFC7405">[RFC7405]</dt>
34663466+ <dd>
34673467+<span class="refAuthor">Kyzivat, P.</span>, <span class="refTitle">"Case-Sensitive String Support in ABNF"</span>, <span class="seriesInfo">RFC 7405</span>, <span class="seriesInfo">DOI 10.17487/RFC7405</span>, <time datetime="2014-12" class="refDate">December 2014</time>, <span><<a href="https://www.rfc-editor.org/info/rfc7405">https://www.rfc-editor.org/info/rfc7405</a>></span>. </dd>
34683468+<dd class="break"></dd>
34693469+<dt id="RFC8174">[RFC8174]</dt>
34703470+ <dd>
34713471+<span class="refAuthor">Leiba, B.</span>, <span class="refTitle">"Ambiguity of Uppercase vs Lowercase in RFC 2119 Key Words"</span>, <span class="seriesInfo">BCP 14</span>, <span class="seriesInfo">RFC 8174</span>, <span class="seriesInfo">DOI 10.17487/RFC8174</span>, <time datetime="2017-05" class="refDate">May 2017</time>, <span><<a href="https://www.rfc-editor.org/info/rfc8174">https://www.rfc-editor.org/info/rfc8174</a>></span>. </dd>
34723472+<dd class="break"></dd>
34733473+</dl>
34743474+</section>
34753475+<section id="section-9.2">
34763476+ <h3 id="name-informative-references">
34773477+<a href="#section-9.2" class="section-number selfRef">9.2. </a><a href="#name-informative-references" class="section-name selfRef">Informative References</a>
34783478+ </h3>
34793479+<dl class="references">
34803480+<dt id="COOKIE">[COOKIE]</dt>
34813481+ <dd>
34823482+<span class="refAuthor">Barth, A.</span>, <span class="refTitle">"HTTP State Management Mechanism"</span>, <span class="seriesInfo">RFC 6265</span>, <span class="seriesInfo">DOI 10.17487/RFC6265</span>, <time datetime="2011-04" class="refDate">April 2011</time>, <span><<a href="https://www.rfc-editor.org/info/rfc6265">https://www.rfc-editor.org/info/rfc6265</a>></span>. </dd>
34833483+<dd class="break"></dd>
34843484+<dt id="HTTP11">[HTTP/1.1]</dt>
34853485+ <dd>
34863486+<span class="refAuthor">Fielding, R., Ed.</span>, <span class="refAuthor">Nottingham, M., Ed.</span>, and <span class="refAuthor">J. Reschke, Ed.</span>, <span class="refTitle">"HTTP/1.1"</span>, <span class="seriesInfo">STD 99</span>, <span class="seriesInfo">RFC 9112</span>, <span class="seriesInfo">DOI 10.17487/RFC9112</span>, <time datetime="2022-06" class="refDate">June 2022</time>, <span><<a href="https://www.rfc-editor.org/info/rfc9112">https://www.rfc-editor.org/info/rfc9112</a>></span>. </dd>
34873487+<dd class="break"></dd>
34883488+<dt id="RFC2616">[RFC2616]</dt>
34893489+ <dd>
34903490+<span class="refAuthor">Fielding, R.</span>, <span class="refAuthor">Gettys, J.</span>, <span class="refAuthor">Mogul, J.</span>, <span class="refAuthor">Frystyk, H.</span>, <span class="refAuthor">Masinter, L.</span>, <span class="refAuthor">Leach, P.</span>, and <span class="refAuthor">T. Berners-Lee</span>, <span class="refTitle">"Hypertext Transfer Protocol -- HTTP/1.1"</span>, <span class="seriesInfo">RFC 2616</span>, <span class="seriesInfo">DOI 10.17487/RFC2616</span>, <time datetime="1999-06" class="refDate">June 1999</time>, <span><<a href="https://www.rfc-editor.org/info/rfc2616">https://www.rfc-editor.org/info/rfc2616</a>></span>. </dd>
34913491+<dd class="break"></dd>
34923492+<dt id="RFC5861">[RFC5861]</dt>
34933493+ <dd>
34943494+<span class="refAuthor">Nottingham, M.</span>, <span class="refTitle">"HTTP Cache-Control Extensions for Stale Content"</span>, <span class="seriesInfo">RFC 5861</span>, <span class="seriesInfo">DOI 10.17487/RFC5861</span>, <time datetime="2010-05" class="refDate">May 2010</time>, <span><<a href="https://www.rfc-editor.org/info/rfc5861">https://www.rfc-editor.org/info/rfc5861</a>></span>. </dd>
34953495+<dd class="break"></dd>
34963496+<dt id="RFC7234">[RFC7234]</dt>
34973497+ <dd>
34983498+<span class="refAuthor">Fielding, R., Ed.</span>, <span class="refAuthor">Nottingham, M., Ed.</span>, and <span class="refAuthor">J. Reschke, Ed.</span>, <span class="refTitle">"Hypertext Transfer Protocol (HTTP/1.1): Caching"</span>, <span class="seriesInfo">RFC 7234</span>, <span class="seriesInfo">DOI 10.17487/RFC7234</span>, <time datetime="2014-06" class="refDate">June 2014</time>, <span><<a href="https://www.rfc-editor.org/info/rfc7234">https://www.rfc-editor.org/info/rfc7234</a>></span>. </dd>
34993499+<dd class="break"></dd>
35003500+<dt id="RFC8126">[RFC8126]</dt>
35013501+ <dd>
35023502+<span class="refAuthor">Cotton, M.</span>, <span class="refAuthor">Leiba, B.</span>, and <span class="refAuthor">T. Narten</span>, <span class="refTitle">"Guidelines for Writing an IANA Considerations Section in RFCs"</span>, <span class="seriesInfo">BCP 26</span>, <span class="seriesInfo">RFC 8126</span>, <span class="seriesInfo">DOI 10.17487/RFC8126</span>, <time datetime="2017-06" class="refDate">June 2017</time>, <span><<a href="https://www.rfc-editor.org/info/rfc8126">https://www.rfc-editor.org/info/rfc8126</a>></span>. </dd>
35033503+<dd class="break"></dd>
35043504+</dl>
35053505+</section>
35063506+</section>
35073507+<div id="collected.abnf">
35083508+<section id="appendix-A">
35093509+ <h2 id="name-collected-abnf">
35103510+<a href="#appendix-A" class="section-number selfRef">Appendix A. </a><a href="#name-collected-abnf" class="section-name selfRef">Collected ABNF</a>
35113511+ </h2>
35123512+<p id="appendix-A-1">In the collected ABNF below, list rules are expanded per <span><a href="https://www.rfc-editor.org/rfc/rfc9110#section-5.6.1" class="relref">Section 5.6.1</a> of [<a href="#HTTP" class="xref">HTTP</a>]</span>.<a href="#appendix-A-1" class="pilcrow">¶</a></p>
35133513+<div id="appendix-A-2">
35143514+<pre class="lang-abnf sourcecode">Age = delta-seconds
35153515+35163516+Cache-Control = [ cache-directive *( OWS "," OWS cache-directive ) ]
35173517+35183518+Expires = HTTP-date
35193519+35203520+HTTP-date = <HTTP-date, see [HTTP], Section 5.6.7>
35213521+35223522+OWS = <OWS, see [HTTP], Section 5.6.3>
35233523+35243524+cache-directive = token [ "=" ( token / quoted-string ) ]
35253525+35263526+delta-seconds = 1*DIGIT
35273527+35283528+field-name = <field-name, see [HTTP], Section 5.1>
35293529+35303530+quoted-string = <quoted-string, see [HTTP], Section 5.6.4>
35313531+35323532+token = <token, see [HTTP], Section 5.6.2>
35333533+</pre><a href="#appendix-A-2" class="pilcrow">¶</a>
35343534+</div>
35353535+</section>
35363536+</div>
35373537+<div id="changes.from.rfc.7234">
35383538+<section id="appendix-B">
35393539+ <h2 id="name-changes-from-rfc-7234">
35403540+<a href="#appendix-B" class="section-number selfRef">Appendix B. </a><a href="#name-changes-from-rfc-7234" class="section-name selfRef">Changes from RFC 7234</a>
35413541+ </h2>
35423542+<p id="appendix-B-1">
35433543+ Handling of duplicate and conflicting cache directives has been clarified.
35443544+ (<a href="#calculating.freshness.lifetime" class="xref">Section 4.2.1</a>)<a href="#appendix-B-1" class="pilcrow">¶</a></p>
35453545+<p id="appendix-B-2">
35463546+ Cache invalidation of the URIs in the Location and Content-Location
35473547+ header fields is no longer required but is still allowed.
35483548+ (<a href="#invalidation" class="xref">Section 4.4</a>)<a href="#appendix-B-2" class="pilcrow">¶</a></p>
35493549+<p id="appendix-B-3">
35503550+ Cache invalidation of the URIs in the Location and Content-Location header fields is disallowed
35513551+ when the origin is different; previously, it was the host.
35523552+ (<a href="#invalidation" class="xref">Section 4.4</a>)<a href="#appendix-B-3" class="pilcrow">¶</a></p>
35533553+<p id="appendix-B-4">
35543554+ Handling invalid and multiple Age header field values has been clarified.
35553555+ (<a href="#field.age" class="xref">Section 5.1</a>)<a href="#appendix-B-4" class="pilcrow">¶</a></p>
35563556+<p id="appendix-B-5">
35573557+ Some cache directives defined by this specification now have stronger
35583558+ prohibitions against generating the quoted form of their values, since
35593559+ this has been found to create interoperability problems. Consumers of
35603560+ extension cache directives are no longer required to accept both token and
35613561+ quoted-string forms, but they still need to parse them properly for
35623562+ unknown extensions.
35633563+ (<a href="#field.cache-control" class="xref">Section 5.2</a>)<a href="#appendix-B-5" class="pilcrow">¶</a></p>
35643564+<p id="appendix-B-6">
35653565+ The public and private cache directives were clarified, so that they
35663566+ do not make responses reusable under any condition.
35673567+ (<a href="#cache-response-directive" class="xref">Section 5.2.2</a>)<a href="#appendix-B-6" class="pilcrow">¶</a></p>
35683568+<p id="appendix-B-7">
35693569+ The must-understand cache directive was introduced; caches are no
35703570+ longer required to understand the semantics of new response status codes
35713571+ unless it is present.
35723572+ (<a href="#cache-response-directive.must-understand" class="xref">Section 5.2.2.3</a>)<a href="#appendix-B-7" class="pilcrow">¶</a></p>
35733573+<p id="appendix-B-8">
35743574+ The Warning response header was obsoleted. Much of the information
35753575+ supported by Warning could be gleaned by examining the response, and the
35763576+ remaining information -- although potentially useful -- was entirely
35773577+ advisory. In practice, Warning was not added by caches or intermediaries.
35783578+ (<a href="#field.warning" class="xref">Section 5.5</a>)<a href="#appendix-B-8" class="pilcrow">¶</a></p>
35793579+</section>
35803580+</div>
35813581+<div id="acks">
35823582+<section id="appendix-C">
35833583+ <h2 id="name-acknowledgements">
35843584+<a href="#name-acknowledgements" class="section-name selfRef">Acknowledgements</a>
35853585+ </h2>
35863586+<p id="appendix-C-1">
35873587+ See Appendix "Acknowledgements" of <span>[<a href="#HTTP" class="xref">HTTP</a>]</span>, which applies to this document as well.<a href="#appendix-C-1" class="pilcrow">¶</a></p>
35883588+</section>
35893589+</div>
35903590+<section id="appendix-D">
35913591+ <h2 id="name-index">
35923592+<a href="#name-index" class="section-name selfRef">Index</a>
35933593+ </h2>
35943594+<div id="rfc.index.index">
35953595+<p id="appendix-D-1">
35963596+ <a href="#rfc.index.u65" class="xref">A</a>
35973597+ <a href="#rfc.index.u67" class="xref">C</a>
35983598+ <a href="#rfc.index.u69" class="xref">E</a>
35993599+ <a href="#rfc.index.u70" class="xref">F</a>
36003600+ <a href="#rfc.index.u71" class="xref">G</a>
36013601+ <a href="#rfc.index.u72" class="xref">H</a>
36023602+ <a href="#rfc.index.u77" class="xref">M</a>
36033603+ <a href="#rfc.index.u78" class="xref">N</a>
36043604+ <a href="#rfc.index.u79" class="xref">O</a>
36053605+ <a href="#rfc.index.u80" class="xref">P</a>
36063606+ <a href="#rfc.index.u83" class="xref">S</a>
36073607+ <a href="#rfc.index.u86" class="xref">V</a>
36083608+ <a href="#rfc.index.u87" class="xref">W</a><a href="#appendix-D-1" class="pilcrow">¶</a></p>
36093609+</div>
36103610+<ul class="normal ulEmpty">
36113611+<li class="normal ulEmpty" id="appendix-D-2.1">
36123612+ <div id="rfc.index.u65">
36133613+<p id="appendix-D-2.1.1" class="keepWithNext">
36143614+ <a href="#rfc.index.u65" class="xref">A</a><a href="#appendix-D-2.1.1" class="pilcrow">¶</a></p>
36153615+</div>
36163616+<ul class="compact normal ulEmpty">
36173617+<li class="compact normal ulEmpty" id="appendix-D-2.1.2.1">
36183618+ <span class="break"></span><dl class="dlCompact dlParallel" id="appendix-D-2.1.2.1.1">
36193619+ <dt id="appendix-D-2.1.2.1.1.1">age</dt>
36203620+ <dd style="margin-left: 1.5em" id="appendix-D-2.1.2.1.1.2">
36213621+ <p id="appendix-D-2.1.2.1.1.2.1">
36223622+ <a href="#expiration.model" class="xref">Section 4.2</a><a href="#appendix-D-2.1.2.1.1.2.1" class="pilcrow">¶</a></p>
36233623+</dd>
36243624+ <dd class="break"></dd>
36253625+<dt id="appendix-D-2.1.2.1.1.3">Age header field</dt>
36263626+ <dd style="margin-left: 1.5em" id="appendix-D-2.1.2.1.1.4">
36273627+ <p id="appendix-D-2.1.2.1.1.4.1">
36283628+ <strong><em><a href="#field.age" class="xref">Section 5.1</a></em></strong><a href="#appendix-D-2.1.2.1.1.4.1" class="pilcrow">¶</a></p>
36293629+</dd>
36303630+ <dd class="break"></dd>
36313631+</dl>
36323632+</li>
36333633+ </ul>
36343634+</li>
36353635+ <li class="normal ulEmpty" id="appendix-D-2.2">
36363636+ <div id="rfc.index.u67">
36373637+<p id="appendix-D-2.2.1" class="keepWithNext">
36383638+ <a href="#rfc.index.u67" class="xref">C</a><a href="#appendix-D-2.2.1" class="pilcrow">¶</a></p>
36393639+</div>
36403640+<ul class="compact normal ulEmpty">
36413641+<li class="compact normal ulEmpty" id="appendix-D-2.2.2.1">
36423642+ <span class="break"></span><dl class="dlCompact dlParallel" id="appendix-D-2.2.2.1.1">
36433643+ <dt id="appendix-D-2.2.2.1.1.1">cache</dt>
36443644+ <dd style="margin-left: 1.5em" id="appendix-D-2.2.2.1.1.2">
36453645+ <p id="appendix-D-2.2.2.1.1.2.1">
36463646+ <a href="#caching" class="xref">Section 1</a><a href="#appendix-D-2.2.2.1.1.2.1" class="pilcrow">¶</a></p>
36473647+</dd>
36483648+ <dd class="break"></dd>
36493649+<dt id="appendix-D-2.2.2.1.1.3">cache key</dt>
36503650+ <dd style="margin-left: 1.5em" id="appendix-D-2.2.2.1.1.4">
36513651+ <p id="appendix-D-2.2.2.1.1.4.1">
36523652+ <a href="#caching.overview" class="xref">Section 2</a>;
36533653+<a href="#caching.overview" class="xref">Section 2</a><a href="#appendix-D-2.2.2.1.1.4.1" class="pilcrow">¶</a></p>
36543654+</dd>
36553655+ <dd class="break"></dd>
36563656+<dt id="appendix-D-2.2.2.1.1.5">Cache-Control header field</dt>
36573657+ <dd style="margin-left: 1.5em" id="appendix-D-2.2.2.1.1.6">
36583658+ <p id="appendix-D-2.2.2.1.1.6.1">
36593659+ <strong><em><a href="#field.cache-control" class="xref">Section 5.2</a></em></strong><a href="#appendix-D-2.2.2.1.1.6.1" class="pilcrow">¶</a></p>
36603660+</dd>
36613661+ <dd class="break"></dd>
36623662+<dt id="appendix-D-2.2.2.1.1.7">collapsed requests</dt>
36633663+ <dd style="margin-left: 1.5em" id="appendix-D-2.2.2.1.1.8">
36643664+ <p id="appendix-D-2.2.2.1.1.8.1">
36653665+ <a href="#constructing.responses.from.caches" class="xref">Section 4</a><a href="#appendix-D-2.2.2.1.1.8.1" class="pilcrow">¶</a></p>
36663666+</dd>
36673667+ <dd class="break"></dd>
36683668+</dl>
36693669+</li>
36703670+ </ul>
36713671+</li>
36723672+ <li class="normal ulEmpty" id="appendix-D-2.3">
36733673+ <div id="rfc.index.u69">
36743674+<p id="appendix-D-2.3.1" class="keepWithNext">
36753675+ <a href="#rfc.index.u69" class="xref">E</a><a href="#appendix-D-2.3.1" class="pilcrow">¶</a></p>
36763676+</div>
36773677+<ul class="compact normal ulEmpty">
36783678+<li class="compact normal ulEmpty" id="appendix-D-2.3.2.1">
36793679+ <span class="break"></span><dl class="dlCompact dlParallel" id="appendix-D-2.3.2.1.1">
36803680+ <dt id="appendix-D-2.3.2.1.1.1">Expires header field</dt>
36813681+ <dd style="margin-left: 1.5em" id="appendix-D-2.3.2.1.1.2">
36823682+ <p id="appendix-D-2.3.2.1.1.2.1">
36833683+ <strong><em><a href="#field.expires" class="xref">Section 5.3</a></em></strong><a href="#appendix-D-2.3.2.1.1.2.1" class="pilcrow">¶</a></p>
36843684+</dd>
36853685+ <dd class="break"></dd>
36863686+<dt id="appendix-D-2.3.2.1.1.3">explicit expiration time</dt>
36873687+ <dd style="margin-left: 1.5em" id="appendix-D-2.3.2.1.1.4">
36883688+ <p id="appendix-D-2.3.2.1.1.4.1">
36893689+ <a href="#expiration.model" class="xref">Section 4.2</a><a href="#appendix-D-2.3.2.1.1.4.1" class="pilcrow">¶</a></p>
36903690+</dd>
36913691+ <dd class="break"></dd>
36923692+</dl>
36933693+</li>
36943694+ </ul>
36953695+</li>
36963696+ <li class="normal ulEmpty" id="appendix-D-2.4">
36973697+ <div id="rfc.index.u70">
36983698+<p id="appendix-D-2.4.1" class="keepWithNext">
36993699+ <a href="#rfc.index.u70" class="xref">F</a><a href="#appendix-D-2.4.1" class="pilcrow">¶</a></p>
37003700+</div>
37013701+<ul class="compact normal ulEmpty">
37023702+<li class="compact normal ulEmpty" id="appendix-D-2.4.2.1">
37033703+ <span class="break"></span><dl class="dlCompact dlParallel" id="appendix-D-2.4.2.1.1">
37043704+ <dt id="appendix-D-2.4.2.1.1.1">Fields</dt>
37053705+ <dd style="margin-left: 1.5em" id="appendix-D-2.4.2.1.1.2"></dd>
37063706+ <dd class="break"></dd>
37073707+<dt id="appendix-D-2.4.2.1.1.3"></dt>
37083708+ <dd style="margin-left: 1.5em" id="appendix-D-2.4.2.1.1.4">
37093709+ <span class="break"></span><dl class="dlCompact dlParallel" id="appendix-D-2.4.2.1.1.4.1">
37103710+ <dt id="appendix-D-2.4.2.1.1.4.1.1">Age</dt>
37113711+ <dd style="margin-left: 1.5em" id="appendix-D-2.4.2.1.1.4.1.2">
37123712+ <p id="appendix-D-2.4.2.1.1.4.1.2.1">
37133713+ <strong><em><a href="#field.age" class="xref">Section 5.1</a></em></strong>;
37143714+<strong><em><a href="#field.age" class="xref">Section 5.1</a></em></strong><a href="#appendix-D-2.4.2.1.1.4.1.2.1" class="pilcrow">¶</a></p>
37153715+</dd>
37163716+ <dd class="break"></dd>
37173717+<dt id="appendix-D-2.4.2.1.1.4.1.3">Cache-Control</dt>
37183718+ <dd style="margin-left: 1.5em" id="appendix-D-2.4.2.1.1.4.1.4">
37193719+ <p id="appendix-D-2.4.2.1.1.4.1.4.1">
37203720+ <strong><em><a href="#field.cache-control" class="xref">Section 5.2</a></em></strong><a href="#appendix-D-2.4.2.1.1.4.1.4.1" class="pilcrow">¶</a></p>
37213721+</dd>
37223722+ <dd class="break"></dd>
37233723+<dt id="appendix-D-2.4.2.1.1.4.1.5">Expires</dt>
37243724+ <dd style="margin-left: 1.5em" id="appendix-D-2.4.2.1.1.4.1.6">
37253725+ <p id="appendix-D-2.4.2.1.1.4.1.6.1">
37263726+ <strong><em><a href="#field.expires" class="xref">Section 5.3</a></em></strong>;
37273727+<strong><em><a href="#field.expires" class="xref">Section 5.3</a></em></strong><a href="#appendix-D-2.4.2.1.1.4.1.6.1" class="pilcrow">¶</a></p>
37283728+</dd>
37293729+ <dd class="break"></dd>
37303730+<dt id="appendix-D-2.4.2.1.1.4.1.7">Pragma</dt>
37313731+ <dd style="margin-left: 1.5em" id="appendix-D-2.4.2.1.1.4.1.8">
37323732+ <p id="appendix-D-2.4.2.1.1.4.1.8.1">
37333733+ <strong><em><a href="#field.pragma" class="xref">Section 5.4</a></em></strong>;
37343734+<strong><em><a href="#field.pragma" class="xref">Section 5.4</a></em></strong><a href="#appendix-D-2.4.2.1.1.4.1.8.1" class="pilcrow">¶</a></p>
37353735+</dd>
37363736+ <dd class="break"></dd>
37373737+<dt id="appendix-D-2.4.2.1.1.4.1.9">Warning</dt>
37383738+ <dd style="margin-left: 1.5em" id="appendix-D-2.4.2.1.1.4.1.10">
37393739+ <p id="appendix-D-2.4.2.1.1.4.1.10.1">
37403740+ <strong><em><a href="#field.warning" class="xref">Section 5.5</a></em></strong><a href="#appendix-D-2.4.2.1.1.4.1.10.1" class="pilcrow">¶</a></p>
37413741+</dd>
37423742+ <dd class="break"></dd>
37433743+</dl>
37443744+</dd>
37453745+ <dd class="break"></dd>
37463746+<dt id="appendix-D-2.4.2.1.1.5">fresh</dt>
37473747+ <dd style="margin-left: 1.5em" id="appendix-D-2.4.2.1.1.6">
37483748+ <p id="appendix-D-2.4.2.1.1.6.1">
37493749+ <a href="#expiration.model" class="xref">Section 4.2</a><a href="#appendix-D-2.4.2.1.1.6.1" class="pilcrow">¶</a></p>
37503750+</dd>
37513751+ <dd class="break"></dd>
37523752+<dt id="appendix-D-2.4.2.1.1.7">freshness lifetime</dt>
37533753+ <dd style="margin-left: 1.5em" id="appendix-D-2.4.2.1.1.8">
37543754+ <p id="appendix-D-2.4.2.1.1.8.1">
37553755+ <a href="#expiration.model" class="xref">Section 4.2</a><a href="#appendix-D-2.4.2.1.1.8.1" class="pilcrow">¶</a></p>
37563756+</dd>
37573757+ <dd class="break"></dd>
37583758+</dl>
37593759+</li>
37603760+ </ul>
37613761+</li>
37623762+ <li class="normal ulEmpty" id="appendix-D-2.5">
37633763+ <div id="rfc.index.u71">
37643764+<p id="appendix-D-2.5.1" class="keepWithNext">
37653765+ <a href="#rfc.index.u71" class="xref">G</a><a href="#appendix-D-2.5.1" class="pilcrow">¶</a></p>
37663766+</div>
37673767+<ul class="compact normal ulEmpty">
37683768+<li class="compact normal ulEmpty" id="appendix-D-2.5.2.1">
37693769+ <span class="break"></span><dl class="dlCompact dlParallel" id="appendix-D-2.5.2.1.1">
37703770+ <dt id="appendix-D-2.5.2.1.1.1">Grammar</dt>
37713771+ <dd style="margin-left: 1.5em" id="appendix-D-2.5.2.1.1.2"></dd>
37723772+ <dd class="break"></dd>
37733773+<dt id="appendix-D-2.5.2.1.1.3"></dt>
37743774+ <dd style="margin-left: 1.5em" id="appendix-D-2.5.2.1.1.4">
37753775+ <span class="break"></span><dl class="dlCompact dlParallel" id="appendix-D-2.5.2.1.1.4.1">
37763776+ <dt id="appendix-D-2.5.2.1.1.4.1.1">Age</dt>
37773777+ <dd style="margin-left: 1.5em" id="appendix-D-2.5.2.1.1.4.1.2">
37783778+ <p id="appendix-D-2.5.2.1.1.4.1.2.1">
37793779+ <strong><em><a href="#field.age" class="xref">Section 5.1</a></em></strong><a href="#appendix-D-2.5.2.1.1.4.1.2.1" class="pilcrow">¶</a></p>
37803780+</dd>
37813781+ <dd class="break"></dd>
37823782+<dt id="appendix-D-2.5.2.1.1.4.1.3">Cache-Control</dt>
37833783+ <dd style="margin-left: 1.5em" id="appendix-D-2.5.2.1.1.4.1.4">
37843784+ <p id="appendix-D-2.5.2.1.1.4.1.4.1">
37853785+ <strong><em><a href="#field.cache-control" class="xref">Section 5.2</a></em></strong><a href="#appendix-D-2.5.2.1.1.4.1.4.1" class="pilcrow">¶</a></p>
37863786+</dd>
37873787+ <dd class="break"></dd>
37883788+<dt id="appendix-D-2.5.2.1.1.4.1.5">DIGIT</dt>
37893789+ <dd style="margin-left: 1.5em" id="appendix-D-2.5.2.1.1.4.1.6">
37903790+ <p id="appendix-D-2.5.2.1.1.4.1.6.1">
37913791+ <strong><em><a href="#notation" class="xref">Section 1.2</a></em></strong><a href="#appendix-D-2.5.2.1.1.4.1.6.1" class="pilcrow">¶</a></p>
37923792+</dd>
37933793+ <dd class="break"></dd>
37943794+<dt id="appendix-D-2.5.2.1.1.4.1.7">Expires</dt>
37953795+ <dd style="margin-left: 1.5em" id="appendix-D-2.5.2.1.1.4.1.8">
37963796+ <p id="appendix-D-2.5.2.1.1.4.1.8.1">
37973797+ <strong><em><a href="#field.expires" class="xref">Section 5.3</a></em></strong><a href="#appendix-D-2.5.2.1.1.4.1.8.1" class="pilcrow">¶</a></p>
37983798+</dd>
37993799+ <dd class="break"></dd>
38003800+<dt id="appendix-D-2.5.2.1.1.4.1.9">cache-directive</dt>
38013801+ <dd style="margin-left: 1.5em" id="appendix-D-2.5.2.1.1.4.1.10">
38023802+ <p id="appendix-D-2.5.2.1.1.4.1.10.1">
38033803+ <strong><em><a href="#field.cache-control" class="xref">Section 5.2</a></em></strong><a href="#appendix-D-2.5.2.1.1.4.1.10.1" class="pilcrow">¶</a></p>
38043804+</dd>
38053805+ <dd class="break"></dd>
38063806+<dt id="appendix-D-2.5.2.1.1.4.1.11">delta-seconds</dt>
38073807+ <dd style="margin-left: 1.5em" id="appendix-D-2.5.2.1.1.4.1.12">
38083808+ <p id="appendix-D-2.5.2.1.1.4.1.12.1">
38093809+ <strong><em><a href="#delta-seconds" class="xref">Section 1.2.2</a></em></strong><a href="#appendix-D-2.5.2.1.1.4.1.12.1" class="pilcrow">¶</a></p>
38103810+</dd>
38113811+ <dd class="break"></dd>
38123812+</dl>
38133813+</dd>
38143814+ <dd class="break"></dd>
38153815+</dl>
38163816+</li>
38173817+ </ul>
38183818+</li>
38193819+ <li class="normal ulEmpty" id="appendix-D-2.6">
38203820+ <div id="rfc.index.u72">
38213821+<p id="appendix-D-2.6.1" class="keepWithNext">
38223822+ <a href="#rfc.index.u72" class="xref">H</a><a href="#appendix-D-2.6.1" class="pilcrow">¶</a></p>
38233823+</div>
38243824+<ul class="compact normal ulEmpty">
38253825+<li class="compact normal ulEmpty" id="appendix-D-2.6.2.1">
38263826+ <span class="break"></span><dl class="dlCompact dlParallel" id="appendix-D-2.6.2.1.1">
38273827+ <dt id="appendix-D-2.6.2.1.1.1">Header Fields</dt>
38283828+ <dd style="margin-left: 1.5em" id="appendix-D-2.6.2.1.1.2"></dd>
38293829+ <dd class="break"></dd>
38303830+<dt id="appendix-D-2.6.2.1.1.3"></dt>
38313831+ <dd style="margin-left: 1.5em" id="appendix-D-2.6.2.1.1.4">
38323832+ <span class="break"></span><dl class="dlCompact dlParallel" id="appendix-D-2.6.2.1.1.4.1">
38333833+ <dt id="appendix-D-2.6.2.1.1.4.1.1">Age</dt>
38343834+ <dd style="margin-left: 1.5em" id="appendix-D-2.6.2.1.1.4.1.2">
38353835+ <p id="appendix-D-2.6.2.1.1.4.1.2.1">
38363836+ <strong><em><a href="#field.age" class="xref">Section 5.1</a></em></strong>;
38373837+<strong><em><a href="#field.age" class="xref">Section 5.1</a></em></strong><a href="#appendix-D-2.6.2.1.1.4.1.2.1" class="pilcrow">¶</a></p>
38383838+</dd>
38393839+ <dd class="break"></dd>
38403840+<dt id="appendix-D-2.6.2.1.1.4.1.3">Cache-Control</dt>
38413841+ <dd style="margin-left: 1.5em" id="appendix-D-2.6.2.1.1.4.1.4">
38423842+ <p id="appendix-D-2.6.2.1.1.4.1.4.1">
38433843+ <strong><em><a href="#field.cache-control" class="xref">Section 5.2</a></em></strong><a href="#appendix-D-2.6.2.1.1.4.1.4.1" class="pilcrow">¶</a></p>
38443844+</dd>
38453845+ <dd class="break"></dd>
38463846+<dt id="appendix-D-2.6.2.1.1.4.1.5">Expires</dt>
38473847+ <dd style="margin-left: 1.5em" id="appendix-D-2.6.2.1.1.4.1.6">
38483848+ <p id="appendix-D-2.6.2.1.1.4.1.6.1">
38493849+ <strong><em><a href="#field.expires" class="xref">Section 5.3</a></em></strong>;
38503850+<strong><em><a href="#field.expires" class="xref">Section 5.3</a></em></strong><a href="#appendix-D-2.6.2.1.1.4.1.6.1" class="pilcrow">¶</a></p>
38513851+</dd>
38523852+ <dd class="break"></dd>
38533853+<dt id="appendix-D-2.6.2.1.1.4.1.7">Pragma</dt>
38543854+ <dd style="margin-left: 1.5em" id="appendix-D-2.6.2.1.1.4.1.8">
38553855+ <p id="appendix-D-2.6.2.1.1.4.1.8.1">
38563856+ <strong><em><a href="#field.pragma" class="xref">Section 5.4</a></em></strong>;
38573857+<strong><em><a href="#field.pragma" class="xref">Section 5.4</a></em></strong><a href="#appendix-D-2.6.2.1.1.4.1.8.1" class="pilcrow">¶</a></p>
38583858+</dd>
38593859+ <dd class="break"></dd>
38603860+<dt id="appendix-D-2.6.2.1.1.4.1.9">Warning</dt>
38613861+ <dd style="margin-left: 1.5em" id="appendix-D-2.6.2.1.1.4.1.10">
38623862+ <p id="appendix-D-2.6.2.1.1.4.1.10.1">
38633863+ <strong><em><a href="#field.warning" class="xref">Section 5.5</a></em></strong><a href="#appendix-D-2.6.2.1.1.4.1.10.1" class="pilcrow">¶</a></p>
38643864+</dd>
38653865+ <dd class="break"></dd>
38663866+</dl>
38673867+</dd>
38683868+ <dd class="break"></dd>
38693869+<dt id="appendix-D-2.6.2.1.1.5">heuristic expiration time</dt>
38703870+ <dd style="margin-left: 1.5em" id="appendix-D-2.6.2.1.1.6">
38713871+ <p id="appendix-D-2.6.2.1.1.6.1">
38723872+ <a href="#expiration.model" class="xref">Section 4.2</a><a href="#appendix-D-2.6.2.1.1.6.1" class="pilcrow">¶</a></p>
38733873+</dd>
38743874+ <dd class="break"></dd>
38753875+<dt id="appendix-D-2.6.2.1.1.7">heuristically cacheable</dt>
38763876+ <dd style="margin-left: 1.5em" id="appendix-D-2.6.2.1.1.8">
38773877+ <p id="appendix-D-2.6.2.1.1.8.1">
38783878+ <a href="#heuristic.freshness" class="xref">Section 4.2.2</a><a href="#appendix-D-2.6.2.1.1.8.1" class="pilcrow">¶</a></p>
38793879+</dd>
38803880+ <dd class="break"></dd>
38813881+</dl>
38823882+</li>
38833883+ </ul>
38843884+</li>
38853885+ <li class="normal ulEmpty" id="appendix-D-2.7">
38863886+ <div id="rfc.index.u77">
38873887+<p id="appendix-D-2.7.1" class="keepWithNext">
38883888+ <a href="#rfc.index.u77" class="xref">M</a><a href="#appendix-D-2.7.1" class="pilcrow">¶</a></p>
38893889+</div>
38903890+<ul class="compact normal ulEmpty">
38913891+<li class="compact normal ulEmpty" id="appendix-D-2.7.2.1">
38923892+ <span class="break"></span><dl class="dlCompact dlParallel" id="appendix-D-2.7.2.1.1">
38933893+ <dt id="appendix-D-2.7.2.1.1.1">max-age (cache directive)</dt>
38943894+ <dd style="margin-left: 1.5em" id="appendix-D-2.7.2.1.1.2">
38953895+ <p id="appendix-D-2.7.2.1.1.2.1">
38963896+ <strong><em><a href="#cache-request-directive.max-age" class="xref">Section 5.2.1.1</a></em></strong>;
38973897+<strong><em><a href="#cache-response-directive.max-age" class="xref">Section 5.2.2.1</a></em></strong><a href="#appendix-D-2.7.2.1.1.2.1" class="pilcrow">¶</a></p>
38983898+</dd>
38993899+ <dd class="break"></dd>
39003900+<dt id="appendix-D-2.7.2.1.1.3">max-stale (cache directive)</dt>
39013901+ <dd style="margin-left: 1.5em" id="appendix-D-2.7.2.1.1.4">
39023902+ <p id="appendix-D-2.7.2.1.1.4.1">
39033903+ <strong><em><a href="#cache-request-directive.max-stale" class="xref">Section 5.2.1.2</a></em></strong><a href="#appendix-D-2.7.2.1.1.4.1" class="pilcrow">¶</a></p>
39043904+</dd>
39053905+ <dd class="break"></dd>
39063906+<dt id="appendix-D-2.7.2.1.1.5">min-fresh (cache directive)</dt>
39073907+ <dd style="margin-left: 1.5em" id="appendix-D-2.7.2.1.1.6">
39083908+ <p id="appendix-D-2.7.2.1.1.6.1">
39093909+ <strong><em><a href="#cache-request-directive.min-fresh" class="xref">Section 5.2.1.3</a></em></strong><a href="#appendix-D-2.7.2.1.1.6.1" class="pilcrow">¶</a></p>
39103910+</dd>
39113911+ <dd class="break"></dd>
39123912+<dt id="appendix-D-2.7.2.1.1.7">must-revalidate (cache directive)</dt>
39133913+ <dd style="margin-left: 1.5em" id="appendix-D-2.7.2.1.1.8">
39143914+ <p id="appendix-D-2.7.2.1.1.8.1">
39153915+ <strong><em><a href="#cache-response-directive.must-revalidate" class="xref">Section 5.2.2.2</a></em></strong><a href="#appendix-D-2.7.2.1.1.8.1" class="pilcrow">¶</a></p>
39163916+</dd>
39173917+ <dd class="break"></dd>
39183918+<dt id="appendix-D-2.7.2.1.1.9">must-understand (cache directive)</dt>
39193919+ <dd style="margin-left: 1.5em" id="appendix-D-2.7.2.1.1.10">
39203920+ <p id="appendix-D-2.7.2.1.1.10.1">
39213921+ <strong><em><a href="#cache-response-directive.must-understand" class="xref">Section 5.2.2.3</a></em></strong><a href="#appendix-D-2.7.2.1.1.10.1" class="pilcrow">¶</a></p>
39223922+</dd>
39233923+ <dd class="break"></dd>
39243924+</dl>
39253925+</li>
39263926+ </ul>
39273927+</li>
39283928+ <li class="normal ulEmpty" id="appendix-D-2.8">
39293929+ <div id="rfc.index.u78">
39303930+<p id="appendix-D-2.8.1" class="keepWithNext">
39313931+ <a href="#rfc.index.u78" class="xref">N</a><a href="#appendix-D-2.8.1" class="pilcrow">¶</a></p>
39323932+</div>
39333933+<ul class="compact normal ulEmpty">
39343934+<li class="compact normal ulEmpty" id="appendix-D-2.8.2.1">
39353935+ <span class="break"></span><dl class="dlCompact dlParallel" id="appendix-D-2.8.2.1.1">
39363936+ <dt id="appendix-D-2.8.2.1.1.1">no-cache (cache directive)</dt>
39373937+ <dd style="margin-left: 1.5em" id="appendix-D-2.8.2.1.1.2">
39383938+ <p id="appendix-D-2.8.2.1.1.2.1">
39393939+ <strong><em><a href="#cache-request-directive.no-cache" class="xref">Section 5.2.1.4</a></em></strong>;
39403940+<strong><em><a href="#cache-response-directive.no-cache" class="xref">Section 5.2.2.4</a></em></strong><a href="#appendix-D-2.8.2.1.1.2.1" class="pilcrow">¶</a></p>
39413941+</dd>
39423942+ <dd class="break"></dd>
39433943+<dt id="appendix-D-2.8.2.1.1.3">no-store (cache directive)</dt>
39443944+ <dd style="margin-left: 1.5em" id="appendix-D-2.8.2.1.1.4">
39453945+ <p id="appendix-D-2.8.2.1.1.4.1">
39463946+ <strong><em><a href="#cache-request-directive.no-store" class="xref">Section 5.2.1.5</a></em></strong>;
39473947+<strong><em><a href="#cache-response-directive.no-store" class="xref">Section 5.2.2.5</a></em></strong><a href="#appendix-D-2.8.2.1.1.4.1" class="pilcrow">¶</a></p>
39483948+</dd>
39493949+ <dd class="break"></dd>
39503950+<dt id="appendix-D-2.8.2.1.1.5">no-transform (cache directive)</dt>
39513951+ <dd style="margin-left: 1.5em" id="appendix-D-2.8.2.1.1.6">
39523952+ <p id="appendix-D-2.8.2.1.1.6.1">
39533953+ <strong><em><a href="#cache-request-directive.no-transform" class="xref">Section 5.2.1.6</a></em></strong>;
39543954+<strong><em><a href="#cache-response-directive.no-transform" class="xref">Section 5.2.2.6</a></em></strong><a href="#appendix-D-2.8.2.1.1.6.1" class="pilcrow">¶</a></p>
39553955+</dd>
39563956+ <dd class="break"></dd>
39573957+</dl>
39583958+</li>
39593959+ </ul>
39603960+</li>
39613961+ <li class="normal ulEmpty" id="appendix-D-2.9">
39623962+ <div id="rfc.index.u79">
39633963+<p id="appendix-D-2.9.1" class="keepWithNext">
39643964+ <a href="#rfc.index.u79" class="xref">O</a><a href="#appendix-D-2.9.1" class="pilcrow">¶</a></p>
39653965+</div>
39663966+<ul class="compact normal ulEmpty">
39673967+<li class="compact normal ulEmpty" id="appendix-D-2.9.2.1">
39683968+ <span class="break"></span><dl class="dlCompact dlParallel" id="appendix-D-2.9.2.1.1">
39693969+ <dt id="appendix-D-2.9.2.1.1.1">only-if-cached (cache directive)</dt>
39703970+ <dd style="margin-left: 1.5em" id="appendix-D-2.9.2.1.1.2">
39713971+ <p id="appendix-D-2.9.2.1.1.2.1">
39723972+ <strong><em><a href="#cache-request-directive.only-if-cached" class="xref">Section 5.2.1.7</a></em></strong><a href="#appendix-D-2.9.2.1.1.2.1" class="pilcrow">¶</a></p>
39733973+</dd>
39743974+ <dd class="break"></dd>
39753975+</dl>
39763976+</li>
39773977+ </ul>
39783978+</li>
39793979+ <li class="normal ulEmpty" id="appendix-D-2.10">
39803980+ <div id="rfc.index.u80">
39813981+<p id="appendix-D-2.10.1" class="keepWithNext">
39823982+ <a href="#rfc.index.u80" class="xref">P</a><a href="#appendix-D-2.10.1" class="pilcrow">¶</a></p>
39833983+</div>
39843984+<ul class="compact normal ulEmpty">
39853985+<li class="compact normal ulEmpty" id="appendix-D-2.10.2.1">
39863986+ <span class="break"></span><dl class="dlCompact dlParallel" id="appendix-D-2.10.2.1.1">
39873987+ <dt id="appendix-D-2.10.2.1.1.1">Pragma header field</dt>
39883988+ <dd style="margin-left: 1.5em" id="appendix-D-2.10.2.1.1.2">
39893989+ <p id="appendix-D-2.10.2.1.1.2.1">
39903990+ <strong><em><a href="#field.pragma" class="xref">Section 5.4</a></em></strong><a href="#appendix-D-2.10.2.1.1.2.1" class="pilcrow">¶</a></p>
39913991+</dd>
39923992+ <dd class="break"></dd>
39933993+<dt id="appendix-D-2.10.2.1.1.3">private (cache directive)</dt>
39943994+ <dd style="margin-left: 1.5em" id="appendix-D-2.10.2.1.1.4">
39953995+ <p id="appendix-D-2.10.2.1.1.4.1">
39963996+ <strong><em><a href="#cache-response-directive.private" class="xref">Section 5.2.2.7</a></em></strong><a href="#appendix-D-2.10.2.1.1.4.1" class="pilcrow">¶</a></p>
39973997+</dd>
39983998+ <dd class="break"></dd>
39993999+<dt id="appendix-D-2.10.2.1.1.5">private cache</dt>
40004000+ <dd style="margin-left: 1.5em" id="appendix-D-2.10.2.1.1.6">
40014001+ <p id="appendix-D-2.10.2.1.1.6.1">
40024002+ <a href="#caching" class="xref">Section 1</a><a href="#appendix-D-2.10.2.1.1.6.1" class="pilcrow">¶</a></p>
40034003+</dd>
40044004+ <dd class="break"></dd>
40054005+<dt id="appendix-D-2.10.2.1.1.7">proxy-revalidate (cache directive)</dt>
40064006+ <dd style="margin-left: 1.5em" id="appendix-D-2.10.2.1.1.8">
40074007+ <p id="appendix-D-2.10.2.1.1.8.1">
40084008+ <strong><em><a href="#cache-response-directive.proxy-revalidate" class="xref">Section 5.2.2.8</a></em></strong><a href="#appendix-D-2.10.2.1.1.8.1" class="pilcrow">¶</a></p>
40094009+</dd>
40104010+ <dd class="break"></dd>
40114011+<dt id="appendix-D-2.10.2.1.1.9">public (cache directive)</dt>
40124012+ <dd style="margin-left: 1.5em" id="appendix-D-2.10.2.1.1.10">
40134013+ <p id="appendix-D-2.10.2.1.1.10.1">
40144014+ <strong><em><a href="#cache-response-directive.public" class="xref">Section 5.2.2.9</a></em></strong><a href="#appendix-D-2.10.2.1.1.10.1" class="pilcrow">¶</a></p>
40154015+</dd>
40164016+ <dd class="break"></dd>
40174017+</dl>
40184018+</li>
40194019+ </ul>
40204020+</li>
40214021+ <li class="normal ulEmpty" id="appendix-D-2.11">
40224022+ <div id="rfc.index.u83">
40234023+<p id="appendix-D-2.11.1" class="keepWithNext">
40244024+ <a href="#rfc.index.u83" class="xref">S</a><a href="#appendix-D-2.11.1" class="pilcrow">¶</a></p>
40254025+</div>
40264026+<ul class="compact normal ulEmpty">
40274027+<li class="compact normal ulEmpty" id="appendix-D-2.11.2.1">
40284028+ <span class="break"></span><dl class="dlCompact dlParallel" id="appendix-D-2.11.2.1.1">
40294029+ <dt id="appendix-D-2.11.2.1.1.1">s-maxage (cache directive)</dt>
40304030+ <dd style="margin-left: 1.5em" id="appendix-D-2.11.2.1.1.2">
40314031+ <p id="appendix-D-2.11.2.1.1.2.1">
40324032+ <strong><em><a href="#cache-response-directive.s-maxage" class="xref">Section 5.2.2.10</a></em></strong><a href="#appendix-D-2.11.2.1.1.2.1" class="pilcrow">¶</a></p>
40334033+</dd>
40344034+ <dd class="break"></dd>
40354035+<dt id="appendix-D-2.11.2.1.1.3">shared cache</dt>
40364036+ <dd style="margin-left: 1.5em" id="appendix-D-2.11.2.1.1.4">
40374037+ <p id="appendix-D-2.11.2.1.1.4.1">
40384038+ <a href="#caching" class="xref">Section 1</a><a href="#appendix-D-2.11.2.1.1.4.1" class="pilcrow">¶</a></p>
40394039+</dd>
40404040+ <dd class="break"></dd>
40414041+<dt id="appendix-D-2.11.2.1.1.5">stale</dt>
40424042+ <dd style="margin-left: 1.5em" id="appendix-D-2.11.2.1.1.6">
40434043+ <p id="appendix-D-2.11.2.1.1.6.1">
40444044+ <a href="#expiration.model" class="xref">Section 4.2</a><a href="#appendix-D-2.11.2.1.1.6.1" class="pilcrow">¶</a></p>
40454045+</dd>
40464046+ <dd class="break"></dd>
40474047+</dl>
40484048+</li>
40494049+ </ul>
40504050+</li>
40514051+ <li class="normal ulEmpty" id="appendix-D-2.12">
40524052+ <div id="rfc.index.u86">
40534053+<p id="appendix-D-2.12.1" class="keepWithNext">
40544054+ <a href="#rfc.index.u86" class="xref">V</a><a href="#appendix-D-2.12.1" class="pilcrow">¶</a></p>
40554055+</div>
40564056+<ul class="compact normal ulEmpty">
40574057+<li class="compact normal ulEmpty" id="appendix-D-2.12.2.1">
40584058+ <span class="break"></span><dl class="dlCompact dlParallel" id="appendix-D-2.12.2.1.1">
40594059+ <dt id="appendix-D-2.12.2.1.1.1">validator</dt>
40604060+ <dd style="margin-left: 1.5em" id="appendix-D-2.12.2.1.1.2">
40614061+ <p id="appendix-D-2.12.2.1.1.2.1">
40624062+ <a href="#validation.sent" class="xref">Section 4.3.1</a><a href="#appendix-D-2.12.2.1.1.2.1" class="pilcrow">¶</a></p>
40634063+</dd>
40644064+ <dd class="break"></dd>
40654065+</dl>
40664066+</li>
40674067+ </ul>
40684068+</li>
40694069+ <li class="normal ulEmpty" id="appendix-D-2.13">
40704070+ <div id="rfc.index.u87">
40714071+<p id="appendix-D-2.13.1" class="keepWithNext">
40724072+ <a href="#rfc.index.u87" class="xref">W</a><a href="#appendix-D-2.13.1" class="pilcrow">¶</a></p>
40734073+</div>
40744074+<ul class="compact normal ulEmpty">
40754075+<li class="compact normal ulEmpty" id="appendix-D-2.13.2.1">
40764076+ <span class="break"></span><dl class="dlCompact dlParallel" id="appendix-D-2.13.2.1.1">
40774077+ <dt id="appendix-D-2.13.2.1.1.1">Warning header field</dt>
40784078+ <dd style="margin-left: 1.5em" id="appendix-D-2.13.2.1.1.2">
40794079+ <p id="appendix-D-2.13.2.1.1.2.1">
40804080+ <strong><em><a href="#field.warning" class="xref">Section 5.5</a></em></strong><a href="#appendix-D-2.13.2.1.1.2.1" class="pilcrow">¶</a></p>
40814081+</dd>
40824082+ <dd class="break"></dd>
40834083+</dl>
40844084+</li>
40854085+ </ul>
40864086+</li>
40874087+ </ul>
40884088+</section>
40894089+<div id="authors-addresses">
40904090+<section id="appendix-E">
40914091+ <h2 id="name-authors-addresses">
40924092+<a href="#name-authors-addresses" class="section-name selfRef">Authors' Addresses</a>
40934093+ </h2>
40944094+<address class="vcard">
40954095+ <div dir="auto" class="left"><span class="fn nameRole">Roy T. Fielding (<span class="role">editor</span>)</span></div>
40964096+<div dir="auto" class="left"><span class="org">Adobe</span></div>
40974097+<div dir="auto" class="left"><span class="street-address">345 Park Ave<br>San Jose, CA 95110</span></div>
40984098+<div dir="auto" class="left"><span class="country-name">United States of America</span></div>
40994099+<div class="email">
41004100+<span>Email:</span>
41014101+<a href="mailto:fielding@gbiv.com" class="email">fielding@gbiv.com</a>
41024102+</div>
41034103+<div class="url">
41044104+<span>URI:</span>
41054105+<a href="https://roy.gbiv.com/" class="url">https://roy.gbiv.com/</a>
41064106+</div>
41074107+</address>
41084108+<address class="vcard">
41094109+ <div dir="auto" class="left"><span class="fn nameRole">Mark Nottingham (<span class="role">editor</span>)</span></div>
41104110+<div dir="auto" class="left"><span class="org">Fastly</span></div>
41114111+<div dir="auto" class="left"><span class="street-address">Prahran</span></div>
41124112+<div dir="auto" class="left"><span class="country-name">Australia</span></div>
41134113+<div class="email">
41144114+<span>Email:</span>
41154115+<a href="mailto:mnot@mnot.net" class="email">mnot@mnot.net</a>
41164116+</div>
41174117+<div class="url">
41184118+<span>URI:</span>
41194119+<a href="https://www.mnot.net/" class="url">https://www.mnot.net/</a>
41204120+</div>
41214121+</address>
41224122+<address class="vcard">
41234123+ <div dir="auto" class="left"><span class="fn nameRole">Julian Reschke (<span class="role">editor</span>)</span></div>
41244124+<div dir="auto" class="left"><span class="org">greenbytes GmbH</span></div>
41254125+<div dir="auto" class="left"><span class="street-address">Hafenweg 16<br>48155 Münster</span></div>
41264126+<div dir="auto" class="left"><span class="country-name">Germany</span></div>
41274127+<div class="email">
41284128+<span>Email:</span>
41294129+<a href="mailto:julian.reschke@greenbytes.de" class="email">julian.reschke@greenbytes.de</a>
41304130+</div>
41314131+<div class="url">
41324132+<span>URI:</span>
41334133+<a href="https://greenbytes.de/tech/webdav/" class="url">https://greenbytes.de/tech/webdav/</a>
41344134+</div>
41354135+</address>
41364136+</section>
41374137+</div>
41384138+</div>
41394139+41404140+ </div>
41414141+41424142+ </div>
41434143+ <div class="d-print-none col-md-3 bg-light-subtle collapse show" id="sidebar">
41444144+ <div class="position-fixed border-start sidebar overflow-scroll overscroll-none no-scrollbar">
41454145+ <div class="d-flex flex-column vh-100 pt-2 pt-lg-3 ps-3 pl-md-2 pl-lg-3">
41464146+ <div>
41474147+ <a class="btn btn-primary btn-sm" href="/doc/rfc9111/">Datatracker</a>
41484148+ <p class="fw-bold pt-2">
41494149+41504150+ RFC 9111
41514151+41524152+ <br>
41534153+41544154+41554155+41564156+41574157+41584158+41594159+<span class="text-success">RFC
41604160+41614161+ - Internet Standard
41624162+41634163+</span>
41644164+41654165+ </p>
41664166+ </div>
41674167+41684168+ <ul class="nav nav-tabs nav-fill small me-2" role="tablist">
41694169+ <li class="nav-item" role="presentation" title="Document information">
41704170+ <button class="nav-link px-2"
41714171+ id="docinfo-tab"
41724172+ data-bs-toggle="tab"
41734173+ data-bs-target="#docinfo-tab-pane"
41744174+ type="button"
41754175+ role="tab"
41764176+ aria-controls="docinfo-tab-pane"
41774177+ aria-selected="true">
41784178+ <i class="bi bi-info-circle"></i><span class="d-none d-md-block d-xl-inline ms-xl-1">Info</span>
41794179+ </button>
41804180+ </li>
41814181+ <li class="nav-item" role="presentation" title="Table of contents">
41824182+ <button class="nav-link px-2"
41834183+ id="toc-tab"
41844184+ data-bs-toggle="tab"
41854185+ data-bs-target="#toc-tab-pane"
41864186+ type="button"
41874187+ role="tab"
41884188+ aria-controls="toc-tab-pane"
41894189+ aria-selected="false">
41904190+ <i class="bi bi-list-ol"></i><span class="d-none d-md-block d-xl-inline ms-xl-1">Contents</span>
41914191+ </button>
41924192+ </li>
41934193+ <li class="nav-item" role="presentation" title="Preferences">
41944194+ <button class="nav-link px-2"
41954195+ id="pref-tab"
41964196+ data-bs-toggle="tab"
41974197+ data-bs-target="#pref-tab-pane"
41984198+ type="button"
41994199+ role="tab"
42004200+ aria-controls="pref-tab-pane"
42014201+ aria-selected="false">
42024202+ <i class="bi bi-gear"></i><span class="d-none d-md-block d-xl-inline ms-xl-1">Prefs</span>
42034203+ </button>
42044204+ </li>
42054205+ </ul>
42064206+ <div class="overflow-auto tab-content pt-2 me-2">
42074207+ <div class="tab-pane"
42084208+ id="docinfo-tab-pane"
42094209+ role="tabpanel"
42104210+ aria-labelledby="docinfo-tab"
42114211+ tabindex="0">
42124212+ <table class="table table-sm table-borderless">
42134213+42144214+42154215+42164216+42174217+42184218+42194219+42204220+42214221+<tbody class="meta align-top ">
42224222+ <tr>
42234223+ <th scope="row">Document</th>
42244224+ <th scope="row">Document type</th>
42254225+ <td class="edit"></td>
42264226+ <td>
42274227+42284228+42294229+42304230+42314231+42324232+42334233+<span class="text-success">RFC
42344234+42354235+ - Internet Standard
42364236+42374237+</span>
42384238+42394239+42404240+42414241+ <br>June 2022
42424242+42434243+ <br>
42444244+42454245+42464246+ <a class="btn btn-sm btn-warning"
42474247+ title="Click to report an error in the document."
42484248+ href="https://www.rfc-editor.org/errata.php#reportnew"
42494249+ target="_blank">
42504250+ Report errata
42514251+ </a>
42524252+42534253+42544254+42554255+42564256+ <div>Obsoletes <a href="/doc/html/rfc7234" title="Hypertext Transfer Protocol (HTTP/1.1): Caching">RFC 7234</a></div>
42574257+42584258+42594259+42604260+42614261+ <div>
42624262+ Was
42634263+ <a href="/doc/draft-ietf-httpbis-cache/19/">draft-ietf-httpbis-cache</a>
42644264+ (<a href="/wg/httpbis/about/">httpbis WG</a>)
42654265+ </div>
42664266+42674267+42684268+42694269+42704270+42714271+42724272+42734273+42744274+42754275+42764276+42774277+42784278+42794279+ </td>
42804280+ </tr>
42814281+42824282+ <tr>
42834283+ <td></td>
42844284+ <th scope="row">Select version</th>
42854285+ <td class="edit"></td>
42864286+ <td>
42874287+42884288+42894289+42904290+42914291+ <ul class="revision-list pagination pagination-sm text-center flex-wrap my-0">
42924292+42934293+42944294+42954295+42964296+ <li class="page-item">
42974297+ <a class="page-link"
42984298+ href="/doc/html/draft-ietf-httpbis-cache-00"
42994299+ rel="nofollow">
43004300+ 00
43014301+ </a>
43024302+ </li>
43034303+43044304+ <li class="page-item">
43054305+ <a class="page-link"
43064306+ href="/doc/html/draft-ietf-httpbis-cache-01"
43074307+ rel="nofollow">
43084308+ 01
43094309+ </a>
43104310+ </li>
43114311+43124312+ <li class="page-item">
43134313+ <a class="page-link"
43144314+ href="/doc/html/draft-ietf-httpbis-cache-02"
43154315+ rel="nofollow">
43164316+ 02
43174317+ </a>
43184318+ </li>
43194319+43204320+ <li class="page-item">
43214321+ <a class="page-link"
43224322+ href="/doc/html/draft-ietf-httpbis-cache-03"
43234323+ rel="nofollow">
43244324+ 03
43254325+ </a>
43264326+ </li>
43274327+43284328+ <li class="page-item">
43294329+ <a class="page-link"
43304330+ href="/doc/html/draft-ietf-httpbis-cache-04"
43314331+ rel="nofollow">
43324332+ 04
43334333+ </a>
43344334+ </li>
43354335+43364336+ <li class="page-item">
43374337+ <a class="page-link"
43384338+ href="/doc/html/draft-ietf-httpbis-cache-05"
43394339+ rel="nofollow">
43404340+ 05
43414341+ </a>
43424342+ </li>
43434343+43444344+ <li class="page-item">
43454345+ <a class="page-link"
43464346+ href="/doc/html/draft-ietf-httpbis-cache-06"
43474347+ rel="nofollow">
43484348+ 06
43494349+ </a>
43504350+ </li>
43514351+43524352+ <li class="page-item">
43534353+ <a class="page-link"
43544354+ href="/doc/html/draft-ietf-httpbis-cache-07"
43554355+ rel="nofollow">
43564356+ 07
43574357+ </a>
43584358+ </li>
43594359+43604360+ <li class="page-item">
43614361+ <a class="page-link"
43624362+ href="/doc/html/draft-ietf-httpbis-cache-08"
43634363+ rel="nofollow">
43644364+ 08
43654365+ </a>
43664366+ </li>
43674367+43684368+ <li class="page-item">
43694369+ <a class="page-link"
43704370+ href="/doc/html/draft-ietf-httpbis-cache-09"
43714371+ rel="nofollow">
43724372+ 09
43734373+ </a>
43744374+ </li>
43754375+43764376+ <li class="page-item">
43774377+ <a class="page-link"
43784378+ href="/doc/html/draft-ietf-httpbis-cache-10"
43794379+ rel="nofollow">
43804380+ 10
43814381+ </a>
43824382+ </li>
43834383+43844384+ <li class="page-item">
43854385+ <a class="page-link"
43864386+ href="/doc/html/draft-ietf-httpbis-cache-11"
43874387+ rel="nofollow">
43884388+ 11
43894389+ </a>
43904390+ </li>
43914391+43924392+ <li class="page-item">
43934393+ <a class="page-link"
43944394+ href="/doc/html/draft-ietf-httpbis-cache-12"
43954395+ rel="nofollow">
43964396+ 12
43974397+ </a>
43984398+ </li>
43994399+44004400+ <li class="page-item">
44014401+ <a class="page-link"
44024402+ href="/doc/html/draft-ietf-httpbis-cache-13"
44034403+ rel="nofollow">
44044404+ 13
44054405+ </a>
44064406+ </li>
44074407+44084408+ <li class="page-item">
44094409+ <a class="page-link"
44104410+ href="/doc/html/draft-ietf-httpbis-cache-14"
44114411+ rel="nofollow">
44124412+ 14
44134413+ </a>
44144414+ </li>
44154415+44164416+ <li class="page-item">
44174417+ <a class="page-link"
44184418+ href="/doc/html/draft-ietf-httpbis-cache-15"
44194419+ rel="nofollow">
44204420+ 15
44214421+ </a>
44224422+ </li>
44234423+44244424+ <li class="page-item">
44254425+ <a class="page-link"
44264426+ href="/doc/html/draft-ietf-httpbis-cache-16"
44274427+ rel="nofollow">
44284428+ 16
44294429+ </a>
44304430+ </li>
44314431+44324432+ <li class="page-item">
44334433+ <a class="page-link"
44344434+ href="/doc/html/draft-ietf-httpbis-cache-17"
44354435+ rel="nofollow">
44364436+ 17
44374437+ </a>
44384438+ </li>
44394439+44404440+ <li class="page-item">
44414441+ <a class="page-link"
44424442+ href="/doc/html/draft-ietf-httpbis-cache-18"
44434443+ rel="nofollow">
44444444+ 18
44454445+ </a>
44464446+ </li>
44474447+44484448+ <li class="page-item">
44494449+ <a class="page-link"
44504450+ href="/doc/html/draft-ietf-httpbis-cache-19"
44514451+ rel="nofollow">
44524452+ 19
44534453+ </a>
44544454+ </li>
44554455+44564456+44574457+44584458+ <li class="page-item rfc active">
44594459+ <a class="page-link"
44604460+ href="/doc/html/rfc9111">
44614461+ RFC 9111
44624462+ </a>
44634463+ </li>
44644464+44654465+ </ul>
44664466+44674467+ </td>
44684468+ </tr>
44694469+44704470+ <tr>
44714471+ <td></td>
44724472+ <th scope="row">Compare versions</th>
44734473+ <td class="edit"></td>
44744474+ <td>
44754475+44764476+44774477+44784478+44794479+<form class="form-horizontal diff-form"
44804480+ action="https://author-tools.ietf.org/iddiff"
44814481+ method="get"
44824482+ target="_blank">
44834483+44844484+ <select class="form-select form-select-sm mb-1 select2-field"
44854485+ data-max-entries="1"
44864486+ data-width="resolve"
44874487+ data-allow-clear="false"
44884488+ data-minimum-input-length="0"
44894489+ aria-label="From revision"
44904490+ name="url1">
44914491+44924492+ <option value="rfc9111">
44934493+ RFC 9111
44944494+44954495+ </option>
44964496+44974497+ <option value="draft-ietf-httpbis-cache-19" selected>
44984498+ draft-ietf-httpbis-cache-19
44994499+45004500+ </option>
45014501+45024502+ <option value="draft-ietf-httpbis-cache-18">
45034503+ draft-ietf-httpbis-cache-18
45044504+45054505+ </option>
45064506+45074507+ <option value="draft-ietf-httpbis-cache-17">
45084508+ draft-ietf-httpbis-cache-17
45094509+45104510+ </option>
45114511+45124512+ <option value="draft-ietf-httpbis-cache-16">
45134513+ draft-ietf-httpbis-cache-16
45144514+45154515+ </option>
45164516+45174517+ <option value="draft-ietf-httpbis-cache-15">
45184518+ draft-ietf-httpbis-cache-15
45194519+45204520+ </option>
45214521+45224522+ <option value="draft-ietf-httpbis-cache-14">
45234523+ draft-ietf-httpbis-cache-14
45244524+45254525+ </option>
45264526+45274527+ <option value="draft-ietf-httpbis-cache-13">
45284528+ draft-ietf-httpbis-cache-13
45294529+45304530+ </option>
45314531+45324532+ <option value="draft-ietf-httpbis-cache-12">
45334533+ draft-ietf-httpbis-cache-12
45344534+45354535+ </option>
45364536+45374537+ <option value="draft-ietf-httpbis-cache-11">
45384538+ draft-ietf-httpbis-cache-11
45394539+45404540+ </option>
45414541+45424542+ <option value="draft-ietf-httpbis-cache-10">
45434543+ draft-ietf-httpbis-cache-10
45444544+45454545+ </option>
45464546+45474547+ <option value="draft-ietf-httpbis-cache-09">
45484548+ draft-ietf-httpbis-cache-09
45494549+45504550+ </option>
45514551+45524552+ <option value="draft-ietf-httpbis-cache-08">
45534553+ draft-ietf-httpbis-cache-08
45544554+45554555+ </option>
45564556+45574557+ <option value="draft-ietf-httpbis-cache-07">
45584558+ draft-ietf-httpbis-cache-07
45594559+45604560+ </option>
45614561+45624562+ <option value="draft-ietf-httpbis-cache-06">
45634563+ draft-ietf-httpbis-cache-06
45644564+45654565+ </option>
45664566+45674567+ <option value="draft-ietf-httpbis-cache-05">
45684568+ draft-ietf-httpbis-cache-05
45694569+45704570+ </option>
45714571+45724572+ <option value="draft-ietf-httpbis-cache-04">
45734573+ draft-ietf-httpbis-cache-04
45744574+45754575+ </option>
45764576+45774577+ <option value="draft-ietf-httpbis-cache-03">
45784578+ draft-ietf-httpbis-cache-03
45794579+45804580+ </option>
45814581+45824582+ <option value="draft-ietf-httpbis-cache-02">
45834583+ draft-ietf-httpbis-cache-02
45844584+45854585+ </option>
45864586+45874587+ <option value="draft-ietf-httpbis-cache-01">
45884588+ draft-ietf-httpbis-cache-01
45894589+45904590+ </option>
45914591+45924592+ <option value="draft-ietf-httpbis-cache-00">
45934593+ draft-ietf-httpbis-cache-00
45944594+45954595+ </option>
45964596+45974597+45984598+ </select>
45994599+46004600+ <select class="form-select form-select-sm mb-1 select2-field"
46014601+ data-max-entries="1"
46024602+ data-width="resolve"
46034603+ data-allow-clear="false"
46044604+ data-minimum-input-length="0"
46054605+ aria-label="To revision"
46064606+ name="url2">
46074607+46084608+ <option value="rfc9111" selected>
46094609+ RFC 9111
46104610+46114611+ </option>
46124612+46134613+ <option value="draft-ietf-httpbis-cache-19">
46144614+ draft-ietf-httpbis-cache-19
46154615+46164616+ </option>
46174617+46184618+ <option value="draft-ietf-httpbis-cache-18">
46194619+ draft-ietf-httpbis-cache-18
46204620+46214621+ </option>
46224622+46234623+ <option value="draft-ietf-httpbis-cache-17">
46244624+ draft-ietf-httpbis-cache-17
46254625+46264626+ </option>
46274627+46284628+ <option value="draft-ietf-httpbis-cache-16">
46294629+ draft-ietf-httpbis-cache-16
46304630+46314631+ </option>
46324632+46334633+ <option value="draft-ietf-httpbis-cache-15">
46344634+ draft-ietf-httpbis-cache-15
46354635+46364636+ </option>
46374637+46384638+ <option value="draft-ietf-httpbis-cache-14">
46394639+ draft-ietf-httpbis-cache-14
46404640+46414641+ </option>
46424642+46434643+ <option value="draft-ietf-httpbis-cache-13">
46444644+ draft-ietf-httpbis-cache-13
46454645+46464646+ </option>
46474647+46484648+ <option value="draft-ietf-httpbis-cache-12">
46494649+ draft-ietf-httpbis-cache-12
46504650+46514651+ </option>
46524652+46534653+ <option value="draft-ietf-httpbis-cache-11">
46544654+ draft-ietf-httpbis-cache-11
46554655+46564656+ </option>
46574657+46584658+ <option value="draft-ietf-httpbis-cache-10">
46594659+ draft-ietf-httpbis-cache-10
46604660+46614661+ </option>
46624662+46634663+ <option value="draft-ietf-httpbis-cache-09">
46644664+ draft-ietf-httpbis-cache-09
46654665+46664666+ </option>
46674667+46684668+ <option value="draft-ietf-httpbis-cache-08">
46694669+ draft-ietf-httpbis-cache-08
46704670+46714671+ </option>
46724672+46734673+ <option value="draft-ietf-httpbis-cache-07">
46744674+ draft-ietf-httpbis-cache-07
46754675+46764676+ </option>
46774677+46784678+ <option value="draft-ietf-httpbis-cache-06">
46794679+ draft-ietf-httpbis-cache-06
46804680+46814681+ </option>
46824682+46834683+ <option value="draft-ietf-httpbis-cache-05">
46844684+ draft-ietf-httpbis-cache-05
46854685+46864686+ </option>
46874687+46884688+ <option value="draft-ietf-httpbis-cache-04">
46894689+ draft-ietf-httpbis-cache-04
46904690+46914691+ </option>
46924692+46934693+ <option value="draft-ietf-httpbis-cache-03">
46944694+ draft-ietf-httpbis-cache-03
46954695+46964696+ </option>
46974697+46984698+ <option value="draft-ietf-httpbis-cache-02">
46994699+ draft-ietf-httpbis-cache-02
47004700+47014701+ </option>
47024702+47034703+ <option value="draft-ietf-httpbis-cache-01">
47044704+ draft-ietf-httpbis-cache-01
47054705+47064706+ </option>
47074707+47084708+ <option value="draft-ietf-httpbis-cache-00">
47094709+ draft-ietf-httpbis-cache-00
47104710+47114711+ </option>
47124712+47134713+47144714+ </select>
47154715+47164716+ <button type="submit"
47174717+ class="btn btn-primary btn-sm"
47184718+ value="--html"
47194719+ name="difftype">
47204720+ Side-by-side
47214721+ </button>
47224722+47234723+ <button type="submit"
47244724+ class="btn btn-primary btn-sm"
47254725+ value="--hwdiff"
47264726+ name="difftype">
47274727+ Inline
47284728+ </button>
47294729+47304730+</form>
47314731+ </td>
47324732+ </tr>
47334733+47344734+47354735+ <tr>
47364736+ <td></td>
47374737+ <th scope="row">Authors</th>
47384738+ <td class="edit">
47394739+47404740+ </td>
47414741+ <td>
47424742+47434743+47444744+ <span ><a
47454745+ title="Datatracker profile of Roy T. Fielding"
47464746+ href="/person/fielding@gbiv.com" >Roy T. Fielding</a> <a
47474747+ href="mailto:fielding%40gbiv.com"
47484748+ aria-label="Compose email to fielding@gbiv.com"
47494749+ title="Compose email to fielding@gbiv.com">
47504750+ <i class="bi bi-envelope"></i></a></span>,
47514751+47524752+ <span ><a
47534753+ title="Datatracker profile of Mark Nottingham"
47544754+ href="/person/mnot@mnot.net" >Mark Nottingham</a> <a
47554755+ href="mailto:mnot%40mnot.net"
47564756+ aria-label="Compose email to mnot@mnot.net"
47574757+ title="Compose email to mnot@mnot.net">
47584758+ <i class="bi bi-envelope"></i></a></span>,
47594759+47604760+ <span ><a
47614761+ title="Datatracker profile of Julian Reschke"
47624762+ href="/person/julian.reschke@gmx.de" >Julian Reschke</a> <a
47634763+ href="mailto:julian.reschke%40gmx.de"
47644764+ aria-label="Compose email to julian.reschke@gmx.de"
47654765+ title="Compose email to julian.reschke@gmx.de">
47664766+ <i class="bi bi-envelope"></i></a></span>
47674767+47684768+47694769+ <br>
47704770+ <a class="btn btn-primary btn-sm mt-1" href="mailto:rfc9111@ietf.org?subject=rfc9111" title="Send email to the document authors">Email authors</a>
47714771+47724772+ </td>
47734773+ </tr>
47744774+47754775+47764776+ <tr>
47774777+ <td></td>
47784778+ <th scope="row">
47794779+ RFC stream
47804780+ </th>
47814781+ <td class="edit">
47824782+47834783+ </td>
47844784+ <td >
47854785+47864786+47874787+47884788+47894789+47904790+47914791+47924792+47934793+<img alt="IETF Logo"
47944794+ class="d-lm-none w-25 mt-1"
47954795+47964796+47974797+47984798+ src="https://static.ietf.org/dt/12.54.0/ietf/images/ietf-logo-nor-white.svg"
47994799+48004800+48014801+ >
48024802+48034803+<img alt="IETF Logo"
48044804+ class="d-dm-none w-25 mt-1"
48054805+48064806+48074807+48084808+ src="https://static.ietf.org/dt/12.54.0/ietf/images/ietf-logo-nor.svg"
48094809+48104810+48114811+ >
48124812+48134813+48144814+48154815+48164816+ </td>
48174817+ </tr>
48184818+48194819+ <tr>
48204820+ <td></td>
48214821+ <th scope="row">
48224822+ Other formats
48234823+ </th>
48244824+ <td class="edit">
48254825+ </td>
48264826+ <td>
48274827+48284828+48294829+ <div class="buttonlist">
48304830+48314831+48324832+ <a class="btn btn-primary btn-sm"
48334833+48344834+ target="_blank"
48354835+ href="https://www.rfc-editor.org/rfc/rfc9111.txt">
48364836+48374837+ <i class="bi bi-file-text"></i> txt
48384838+48394839+ </a>
48404840+48414841+48424842+48434843+ <a class="btn btn-primary btn-sm"
48444844+48454845+ target="_blank"
48464846+ href="https://www.rfc-editor.org/rfc/rfc9111.html">
48474847+48484848+ <i class="bi bi-file-code"></i> html
48494849+48504850+ </a>
48514851+48524852+48534853+48544854+ <a class="btn btn-primary btn-sm"
48554855+48564856+ target="_blank"
48574857+ href="https://www.rfc-editor.org/rfc/rfc9111.xml">
48584858+48594859+ <i class="bi bi-file-code"></i> xml
48604860+48614861+ </a>
48624862+48634863+48644864+48654865+ <a class="btn btn-primary btn-sm"
48664866+48674867+ download="rfc9111.pdf"
48684868+48694869+48704870+ target="_blank"
48714871+ href="https://www.rfc-editor.org/rfc/rfc9111.pdf">
48724872+48734873+ <i class="bi bi-file-pdf"></i> pdf
48744874+48754875+ </a>
48764876+48774877+48784878+48794879+48804880+48814881+ <a class="btn btn-primary btn-sm"
48824882+48834883+ target="_blank"
48844884+ href="/doc/rfc9111/bibtex/">
48854885+48864886+ <i class="bi bi-file-ruled"></i> bibtex
48874887+48884888+ </a>
48894889+48904890+48914891+</div>
48924892+48934893+48944894+ </td>
48954895+ </tr>
48964896+48974897+48984898+48994899+ <tr>
49004900+ <td>
49014901+ </td>
49024902+ <th scope="row">
49034903+ Additional resources
49044904+ </th>
49054905+ <td class="edit">
49064906+49074907+ </td>
49084908+ <td>
49094909+49104910+49114911+49124912+49134913+ <a href="http://lists.w3.org/Archives/Public/ietf-http-wg/">
49144914+ Mailing list discussion
49154915+ </a>
49164916+49174917+49184918+49194919+ </td>
49204920+ </tr>
49214921+49224922+49234923+</tbody>
49244924+ </table>
49254925+ <a class="btn btn-sm btn-warning mb-3"
49264926+ target="_blank"
49274927+ href="https://github.com/ietf-tools/datatracker/issues/new/choose">
49284928+ Report a datatracker bug
49294929+ <i class="bi bi-bug"></i>
49304930+ </a>
49314931+ </div>
49324932+ <div class="tab-pane mb-5"
49334933+ id="toc-tab-pane"
49344934+ role="tabpanel"
49354935+ aria-labelledby="toc-tab"
49364936+ tabindex="0">
49374937+ <nav class="nav nav-pills flex-column small" id="toc-nav">
49384938+ </nav>
49394939+ </div>
49404940+ <div class="tab-pane mb-5 small"
49414941+ id="pref-tab-pane"
49424942+ role="tabpanel"
49434943+ aria-labelledby="pref-tab"
49444944+ tabindex="0">
49454945+ <label class="form-label fw-bold mb-2">Show sidebar by default</label>
49464946+ <div class="btn-group-vertical btn-group-sm d-flex" role="group">
49474947+ <input type="radio" class="btn-check" name="sidebar" id="on-radio">
49484948+ <label class="btn btn-outline-primary" for="on-radio">Yes</label>
49494949+ <input type="radio" class="btn-check" name="sidebar" id="off-radio">
49504950+ <label class="btn btn-outline-primary" for="off-radio">No</label>
49514951+ </div>
49524952+ <label class="form-label fw-bold mt-4 mb-2">Tab to show by default</label>
49534953+ <div class="btn-group-vertical btn-group-sm d-flex" role="group">
49544954+ <input type="radio" class="btn-check" name="deftab" id="docinfo-radio">
49554955+ <label class="btn btn-outline-primary" for="docinfo-radio">
49564956+ <i class="bi bi-info-circle me-1"></i>Info
49574957+ </label>
49584958+ <input type="radio" class="btn-check" name="deftab" id="toc-radio">
49594959+ <label class="btn btn-outline-primary" for="toc-radio">
49604960+ <i class="bi bi-list-ol me-1"></i>Contents
49614961+ </label>
49624962+ </div>
49634963+ <label class="form-label fw-bold mt-4 mb-2">HTMLization configuration</label>
49644964+ <div class="btn-group-vertical btn-group-sm d-flex" role="group">
49654965+ <input type="radio" class="btn-check" name="htmlconf" id="txt-radio">
49664966+ <label class="btn btn-outline-primary" for="txt-radio" title="This is the traditional HTMLization method.">
49674967+ <i class="bi bi-badge-sd me-1"></i>HTMLize the plaintext
49684968+ </label>
49694969+ <input type="radio" class="btn-check" name="htmlconf" id="html-radio">
49704970+ <label class="btn btn-outline-primary" for="html-radio" title="This is the modern HTMLization method.">
49714971+ <i class="bi bi-badge-hd me-1"></i>Plaintextify the HTML
49724972+ </label>
49734973+ </div>
49744974+ <label class="form-label fw-bold mt-4 mb-2" for="ptsize">Maximum font size</label>
49754975+ <input type="range" class="form-range" min="7" max="16" id="ptsize" oninput="ptdemo.value = ptsize.value">
49764976+ <label class="form-label fw-bold mt-4 mb-2">Page dependencies</label>
49774977+ <div class="btn-group-vertical btn-group-sm d-flex" role="group">
49784978+ <input type="radio" class="btn-check" name="pagedeps" id="inline-radio">
49794979+ <label class="btn btn-outline-primary" for="inline-radio" title="Generate larger, standalone web pages that do not require network access to render.">
49804980+ <i class="bi bi-box me-1"></i>Inline
49814981+ </label>
49824982+ <input type="radio" class="btn-check" name="pagedeps" id="reference-radio">
49834983+ <label class="btn btn-outline-primary" for="reference-radio" title="Generate regular web pages that require network access to render.">
49844984+ <i class="bi bi-link-45deg me-1"></i>Reference
49854985+ </label>
49864986+ </div>
49874987+ <label class="form-label fw-bold mt-4 mb-2">Citation links</label>
49884988+ <div class="btn-group-vertical btn-group-sm d-flex" role="group">
49894989+ <input type="radio" class="btn-check" name="reflinks" id="refsection-radio">
49904990+ <label class="btn btn-outline-primary" for="refsection-radio" title="Citation links go to the reference section.">
49914991+ <i class="bi bi-arrow-clockwise"></i> Go to reference section
49924992+ </label>
49934993+ <input type="radio" class="btn-check" name="reflinks" id="citation-radio">
49944994+ <label class="btn btn-outline-primary" for="citation-radio" title="Citation links go directly to the cited document.">
49954995+ <i class="bi bi-link-45deg me-1"></i>Go to linked document
49964996+ </label>
49974997+ </div>
49984998+ </div>
49994999+ </div>
50005000+ </div>
50015001+ </div>
50025002+ </div>
50035003+ </div>
50045004+50055005+<script>
50065006+ var _paq = window._paq || [];
50075007+50085008+ _paq.push(['disableCookies']);
50095009+ _paq.push(['trackPageView']);
50105010+ _paq.push(['enableLinkTracking']);
50115011+ (function() {
50125012+ var u="//analytics.ietf.org/";
50135013+ _paq.push(['setTrackerUrl', u+'matomo.php']);
50145014+ _paq.push(['setSiteId', 7]);
50155015+ var d=document, g=d.createElement('script'), s=d.getElementsByTagName('script')[0];
50165016+ g.type='text/javascript'; g.async=true; g.defer=true; g.src=u+'matomo.js'; s.parentNode.insertBefore(g,s);
50175017+ })();
50185018+</script>
50195019+<noscript><p><img src="//analytics.ietf.org/matomo.php?idsite=7" style="border:0;" alt="" /></p></noscript>
50205020+50215021+ </body>
50225022+</html>
+237
test/test_http_date.ml
···11+(*---------------------------------------------------------------------------
22+ Copyright (c) 2025 Anil Madhavapeddy <anil@recoil.org>. All rights reserved.
33+ SPDX-License-Identifier: ISC
44+ ---------------------------------------------------------------------------*)
55+66+(** Comprehensive tests for HTTP-date parsing per RFC 9110 Section 5.6.7 *)
77+88+open Requests
99+1010+(** Alcotest testable for Ptime.t *)
1111+module Alcotest_ptime = struct
1212+ let pp = Ptime.pp_rfc3339 ()
1313+ let equal = Ptime.equal
1414+ let testable = Alcotest.testable pp equal
1515+end
1616+1717+(** Helper to create expected Ptime.t values *)
1818+let make_time year month day hour min sec =
1919+ match Ptime.of_date_time ((year, month, day), ((hour, min, sec), 0)) with
2020+ | Some t -> t
2121+ | None -> failwith (Printf.sprintf "Invalid test time: %d-%02d-%02d %02d:%02d:%02d"
2222+ year month day hour min sec)
2323+2424+(** {1 RFC 1123 Format Tests} *)
2525+2626+let test_rfc1123_basic () =
2727+ (* RFC 9110 Section 5.6.7: preferred format "Sun, 06 Nov 1994 08:49:37 GMT" *)
2828+ let result = Http_date.parse "Sun, 06 Nov 1994 08:49:37 GMT" in
2929+ let expected = Some (make_time 1994 11 6 8 49 37) in
3030+ Alcotest.(check (option Alcotest_ptime.testable))
3131+ "RFC 1123 basic parsing" expected result
3232+3333+let test_rfc1123_all_months () =
3434+ (* Test all month names *)
3535+ let months = [
3636+ ("Jan", 1); ("Feb", 2); ("Mar", 3); ("Apr", 4);
3737+ ("May", 5); ("Jun", 6); ("Jul", 7); ("Aug", 8);
3838+ ("Sep", 9); ("Oct", 10); ("Nov", 11); ("Dec", 12);
3939+ ] in
4040+ List.iter (fun (month_str, month_num) ->
4141+ let date_str = Printf.sprintf "Mon, 01 %s 2020 00:00:00 GMT" month_str in
4242+ let result = Http_date.parse date_str in
4343+ let expected = Some (make_time 2020 month_num 1 0 0 0) in
4444+ Alcotest.(check (option Alcotest_ptime.testable))
4545+ (Printf.sprintf "RFC 1123 month %s" month_str) expected result
4646+ ) months
4747+4848+let test_rfc1123_all_weekdays () =
4949+ (* Test all weekday names - the weekday is not validated, just skipped *)
5050+ let weekdays = ["Sun"; "Mon"; "Tue"; "Wed"; "Thu"; "Fri"; "Sat"] in
5151+ List.iter (fun wday ->
5252+ let date_str = Printf.sprintf "%s, 06 Nov 1994 08:49:37 GMT" wday in
5353+ let result = Http_date.parse date_str in
5454+ let expected = Some (make_time 1994 11 6 8 49 37) in
5555+ Alcotest.(check (option Alcotest_ptime.testable))
5656+ (Printf.sprintf "RFC 1123 weekday %s" wday) expected result
5757+ ) weekdays
5858+5959+let test_rfc1123_edge_dates () =
6060+ (* Test edge cases for dates *)
6161+ let test_cases = [
6262+ ("Thu, 01 Jan 1970 00:00:00 GMT", 1970, 1, 1, 0, 0, 0, "Unix epoch");
6363+ ("Fri, 31 Dec 1999 23:59:59 GMT", 1999, 12, 31, 23, 59, 59, "Y2K eve");
6464+ ("Sat, 01 Jan 2000 00:00:00 GMT", 2000, 1, 1, 0, 0, 0, "Y2K");
6565+ ("Tue, 29 Feb 2000 12:00:00 GMT", 2000, 2, 29, 12, 0, 0, "Leap year");
6666+ ("Fri, 13 Dec 2024 23:59:59 GMT", 2024, 12, 13, 23, 59, 59, "Near current");
6767+ ] in
6868+ List.iter (fun (date_str, y, m, d, h, min, s, desc) ->
6969+ let result = Http_date.parse date_str in
7070+ let expected = Some (make_time y m d h min s) in
7171+ Alcotest.(check (option Alcotest_ptime.testable))
7272+ (Printf.sprintf "RFC 1123 edge: %s" desc) expected result
7373+ ) test_cases
7474+7575+(** {1 RFC 850 Format Tests (Obsolete)} *)
7676+7777+let test_rfc850_basic () =
7878+ (* RFC 850 format: "Sunday, 06-Nov-94 08:49:37 GMT" *)
7979+ let result = Http_date.parse "Sunday, 06-Nov-94 08:49:37 GMT" in
8080+ let expected = Some (make_time 1994 11 6 8 49 37) in
8181+ Alcotest.(check (option Alcotest_ptime.testable))
8282+ "RFC 850 basic parsing (2-digit year)" expected result
8383+8484+let test_rfc850_year_interpretation () =
8585+ (* Test Y2K two-digit year interpretation: 70-99 -> 1970-1999, 00-69 -> 2000-2069 *)
8686+ let test_cases = [
8787+ ("Monday, 01-Jan-70 00:00:00 GMT", 1970, "Year 70 -> 1970");
8888+ ("Tuesday, 01-Jan-99 00:00:00 GMT", 1999, "Year 99 -> 1999");
8989+ ("Saturday, 01-Jan-00 00:00:00 GMT", 2000, "Year 00 -> 2000");
9090+ ("Sunday, 01-Jan-25 00:00:00 GMT", 2025, "Year 25 -> 2025");
9191+ ("Thursday, 01-Jan-69 00:00:00 GMT", 2069, "Year 69 -> 2069");
9292+ ] in
9393+ List.iter (fun (date_str, expected_year, desc) ->
9494+ let result = Http_date.parse date_str in
9595+ let expected = Some (make_time expected_year 1 1 0 0 0) in
9696+ Alcotest.(check (option Alcotest_ptime.testable))
9797+ (Printf.sprintf "RFC 850 %s" desc) expected result
9898+ ) test_cases
9999+100100+(** {1 ANSI C asctime() Format Tests (Obsolete)} *)
101101+102102+let test_asctime_basic () =
103103+ (* asctime() format: "Sun Nov 6 08:49:37 1994" *)
104104+ let result = Http_date.parse "Sun Nov 6 08:49:37 1994" in
105105+ let expected = Some (make_time 1994 11 6 8 49 37) in
106106+ Alcotest.(check (option Alcotest_ptime.testable))
107107+ "asctime basic parsing" expected result
108108+109109+let test_asctime_single_digit_day () =
110110+ (* asctime has space-padded day for single digits *)
111111+ let test_cases = [
112112+ ("Sun Nov 1 08:49:37 1994", 1, "Day 1");
113113+ ("Sun Nov 9 08:49:37 1994", 9, "Day 9");
114114+ ] in
115115+ List.iter (fun (date_str, day, desc) ->
116116+ let result = Http_date.parse date_str in
117117+ let expected = Some (make_time 1994 11 day 8 49 37) in
118118+ Alcotest.(check (option Alcotest_ptime.testable))
119119+ (Printf.sprintf "asctime %s" desc) expected result
120120+ ) test_cases
121121+122122+(** {1 Invalid Input Tests} *)
123123+124124+let test_invalid_completely_wrong () =
125125+ (* Completely invalid strings *)
126126+ let invalid_inputs = [
127127+ "";
128128+ "not a date";
129129+ "2024-12-13"; (* ISO 8601 not supported *)
130130+ "12/13/2024"; (* US format not supported *)
131131+ "13-Dec-2024"; (* No day name *)
132132+ ] in
133133+ List.iter (fun input ->
134134+ let result = Http_date.parse input in
135135+ Alcotest.(check (option Alcotest_ptime.testable))
136136+ (Printf.sprintf "Invalid input: %S" input) None result
137137+ ) invalid_inputs
138138+139139+let test_invalid_month_names () =
140140+ (* Invalid month names *)
141141+ let invalid_months = [
142142+ "Sun, 06 Foo 1994 08:49:37 GMT";
143143+ "Sun, 06 13 1994 08:49:37 GMT"; (* Numeric month *)
144144+ "Sun, 06 November 1994 08:49:37 GMT"; (* Full month name *)
145145+ ] in
146146+ List.iter (fun input ->
147147+ let result = Http_date.parse input in
148148+ Alcotest.(check (option Alcotest_ptime.testable))
149149+ (Printf.sprintf "Invalid month: %S" input) None result
150150+ ) invalid_months
151151+152152+let test_invalid_dates () =
153153+ (* Dates that are syntactically correct but semantically invalid *)
154154+ let invalid_dates = [
155155+ "Sun, 32 Jan 2020 00:00:00 GMT"; (* Day 32 *)
156156+ "Sun, 00 Jan 2020 00:00:00 GMT"; (* Day 0 *)
157157+ "Sun, 29 Feb 2021 00:00:00 GMT"; (* Feb 29 in non-leap year *)
158158+ "Sun, 31 Apr 2020 00:00:00 GMT"; (* April has 30 days *)
159159+ ] in
160160+ List.iter (fun input ->
161161+ let result = Http_date.parse input in
162162+ Alcotest.(check (option Alcotest_ptime.testable))
163163+ (Printf.sprintf "Invalid date: %S" input) None result
164164+ ) invalid_dates
165165+166166+let test_invalid_times () =
167167+ (* Invalid time components *)
168168+ let invalid_times = [
169169+ "Sun, 06 Nov 1994 25:00:00 GMT"; (* Hour 25 *)
170170+ "Sun, 06 Nov 1994 00:60:00 GMT"; (* Minute 60 *)
171171+ "Sun, 06 Nov 1994 00:00:60 GMT"; (* Second 60 (no leap second support) *)
172172+ ] in
173173+ List.iter (fun input ->
174174+ let result = Http_date.parse input in
175175+ Alcotest.(check (option Alcotest_ptime.testable))
176176+ (Printf.sprintf "Invalid time: %S" input) None result
177177+ ) invalid_times
178178+179179+(** {1 Whitespace and Case Tests} *)
180180+181181+let test_trimming_whitespace () =
182182+ (* Should handle leading/trailing whitespace *)
183183+ let test_cases = [
184184+ " Sun, 06 Nov 1994 08:49:37 GMT ";
185185+ "\tSun, 06 Nov 1994 08:49:37 GMT\t";
186186+ "\n Sun, 06 Nov 1994 08:49:37 GMT \n";
187187+ ] in
188188+ let expected = Some (make_time 1994 11 6 8 49 37) in
189189+ List.iter (fun input ->
190190+ let result = Http_date.parse input in
191191+ Alcotest.(check (option Alcotest_ptime.testable))
192192+ "Whitespace trimming" expected result
193193+ ) test_cases
194194+195195+let test_case_insensitive_months () =
196196+ (* Month names should be case-insensitive *)
197197+ let test_cases = [
198198+ ("Sun, 06 nov 1994 08:49:37 GMT", "lowercase");
199199+ ("Sun, 06 NOV 1994 08:49:37 GMT", "uppercase");
200200+ ("Sun, 06 NoV 1994 08:49:37 GMT", "mixed case");
201201+ ] in
202202+ let expected = Some (make_time 1994 11 6 8 49 37) in
203203+ List.iter (fun (input, desc) ->
204204+ let result = Http_date.parse input in
205205+ Alcotest.(check (option Alcotest_ptime.testable))
206206+ (Printf.sprintf "Case insensitive: %s" desc) expected result
207207+ ) test_cases
208208+209209+(** {1 Test Suite} *)
210210+211211+let () =
212212+ Alcotest.run "HTTP Date Parsing (RFC 9110 Section 5.6.7)" [
213213+ ("RFC 1123 format", [
214214+ Alcotest.test_case "Basic parsing" `Quick test_rfc1123_basic;
215215+ Alcotest.test_case "All months" `Quick test_rfc1123_all_months;
216216+ Alcotest.test_case "All weekdays" `Quick test_rfc1123_all_weekdays;
217217+ Alcotest.test_case "Edge dates" `Quick test_rfc1123_edge_dates;
218218+ ]);
219219+ ("RFC 850 format (obsolete)", [
220220+ Alcotest.test_case "Basic parsing" `Quick test_rfc850_basic;
221221+ Alcotest.test_case "Y2K year interpretation" `Quick test_rfc850_year_interpretation;
222222+ ]);
223223+ ("asctime format (obsolete)", [
224224+ Alcotest.test_case "Basic parsing" `Quick test_asctime_basic;
225225+ Alcotest.test_case "Single digit day" `Quick test_asctime_single_digit_day;
226226+ ]);
227227+ ("Invalid inputs", [
228228+ Alcotest.test_case "Completely wrong format" `Quick test_invalid_completely_wrong;
229229+ Alcotest.test_case "Invalid month names" `Quick test_invalid_month_names;
230230+ Alcotest.test_case "Invalid dates" `Quick test_invalid_dates;
231231+ Alcotest.test_case "Invalid times" `Quick test_invalid_times;
232232+ ]);
233233+ ("Whitespace and case", [
234234+ Alcotest.test_case "Trimming whitespace" `Quick test_trimming_whitespace;
235235+ Alcotest.test_case "Case insensitive months" `Quick test_case_insensitive_months;
236236+ ]);
237237+ ]
+6
test/test_http_date.mli
···11+(*---------------------------------------------------------------------------
22+ Copyright (c) 2025 Anil Madhavapeddy <anil@recoil.org>. All rights reserved.
33+ SPDX-License-Identifier: ISC
44+ ---------------------------------------------------------------------------*)
55+66+(** Comprehensive tests for HTTP-date parsing per RFC 9110 Section 5.6.7 *)