/usr/share/doc/racket/web-server/http.html is in racket-doc 6.1-4.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 | <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html><head><meta http-equiv="content-type" content="text/html; charset=utf-8"/><title>4 HTTP: Hypertext Transfer Protocol</title><link rel="stylesheet" type="text/css" href="../scribble.css" title="default"/><link rel="stylesheet" type="text/css" href="../racket.css" title="default"/><link rel="stylesheet" type="text/css" href="../manual-style.css" title="default"/><link rel="stylesheet" type="text/css" href="../manual-racket.css" title="default"/><link rel="stylesheet" type="text/css" href="../doc-site.css" title="default"/><script type="text/javascript" src="../scribble-common.js"></script><script type="text/javascript" src="../manual-racket.js"></script><script type="text/javascript" src="../doc-site.js"></script><script type="text/javascript" src="../local-redirect/local-redirect.js"></script><script type="text/javascript" src="../local-redirect/local-user-redirect.js"></script><!--[if IE 6]><style type="text/css">.SIEHidden { overflow: hidden; }</style><![endif]--></head><body id="doc-racket-lang-org"><div class="tocset"><div class="tocview"><div class="tocviewlist tocviewlisttopspace"><div class="tocviewtitle"><table cellspacing="0" cellpadding="0"><tr><td style="width: 1em;"><a href="javascript:void(0);" title="Expand/Collapse" class="tocviewtoggle" onclick="TocviewToggle(this,"tocview_0");">▼</a></td><td></td><td><a href="index.html" class="tocviewlink" data-pltdoc="x">Web Applications in Racket</a></td></tr></table></div><div class="tocviewsublisttop" style="display: block;" id="tocview_0"><table cellspacing="0" cellpadding="0"><tr><td align="right">1 </td><td><a href="run.html" class="tocviewlink" data-pltdoc="x">Running Web Servlets</a></td></tr><tr><td align="right">2 </td><td><a href="servlet.html" class="tocviewlink" data-pltdoc="x">Stateful Servlets</a></td></tr><tr><td align="right">3 </td><td><a href="stateless.html" class="tocviewlink" data-pltdoc="x">Stateless Servlets</a></td></tr><tr><td align="right">4 </td><td><a href="" class="tocviewselflink" data-pltdoc="x">HTTP:<span class="mywbr"> </span> Hypertext Transfer Protocol</a></td></tr><tr><td align="right">5 </td><td><a href="dispatch.html" class="tocviewlink" data-pltdoc="x">URL-<wbr></wbr>Based Dispatch</a></td></tr><tr><td align="right">6 </td><td><a href="formlets.html" class="tocviewlink" data-pltdoc="x">Formlets:<span class="mywbr"> </span> Functional Form Abstraction</a></td></tr><tr><td align="right">7 </td><td><a href="templates.html" class="tocviewlink" data-pltdoc="x">Templates:<span class="mywbr"> </span> Separation of View</a></td></tr><tr><td align="right">8 </td><td><a href="page.html" class="tocviewlink" data-pltdoc="x">Page:<span class="mywbr"> </span> Short-<wbr></wbr>hand for Common Patterns</a></td></tr><tr><td align="right">9 </td><td><a href="test.html" class="tocviewlink" data-pltdoc="x">Testing Servlets</a></td></tr><tr><td align="right">10 </td><td><a href="faq.html" class="tocviewlink" data-pltdoc="x">Troubleshooting and Tips</a></td></tr><tr><td align="right"></td><td><a href="doc-index.html" class="tocviewlink" data-pltdoc="x">Index</a></td></tr></table></div></div><div class="tocviewlist"><table cellspacing="0" cellpadding="0"><tr><td style="width: 1em;"><a href="javascript:void(0);" title="Expand/Collapse" class="tocviewtoggle" onclick="TocviewToggle(this,"tocview_1");">►</a></td><td>4 </td><td><a href="" class="tocviewselflink" data-pltdoc="x">HTTP:<span class="mywbr"> </span> Hypertext Transfer Protocol</a></td></tr></table><div class="tocviewsublistbottom" style="display: none;" id="tocview_1"><table cellspacing="0" cellpadding="0"><tr><td align="right">4.1 </td><td><a href="#%28part._request-structs%29" class="tocviewlink" data-pltdoc="x">Requests</a></td></tr><tr><td align="right">4.2 </td><td><a href="#%28part._bindings%29" class="tocviewlink" data-pltdoc="x">Bindings</a></td></tr><tr><td align="right">4.3 </td><td><a href="#%28part._response-structs%29" class="tocviewlink" data-pltdoc="x">Responses</a></td></tr><tr><td align="right">4.4 </td><td><a href="#%28part._cookie%29" class="tocviewlink" data-pltdoc="x">Placing Cookies</a></td></tr><tr><td align="right">4.5 </td><td><a href="#%28part._id-cookie%29" class="tocviewlink" data-pltdoc="x">Authenticated Cookies</a></td></tr><tr><td align="right">4.6 </td><td><a href="#%28part._cookie-parse%29" class="tocviewlink" data-pltdoc="x">Extracting Cookies</a></td></tr><tr><td align="right">4.7 </td><td><a href="#%28part._redirect%29" class="tocviewlink" data-pltdoc="x">Redirect</a></td></tr><tr><td align="right">4.8 </td><td><a href="#%28part._basic-auth%29" class="tocviewlink" data-pltdoc="x">Basic Authentication</a></td></tr><tr><td align="right">4.9 </td><td><a href="#%28part._digest-auth%29" class="tocviewlink" data-pltdoc="x">Digest Authentication</a></td></tr><tr><td align="right">4.10 </td><td><a href="#%28part._xexpr%29" class="tocviewlink" data-pltdoc="x">X-<wbr></wbr>expression Support</a></td></tr></table></div></div></div><div class="tocsub"><div class="tocsubtitle">On this page:</div><table class="tocsublist" cellspacing="0"><tr><td><span class="tocsublinknumber">4.1<tt> </tt></span><a href="#%28part._request-structs%29" class="tocsubseclink" data-pltdoc="x">Requests</a></td></tr><tr><td><a href="#%28def._%28%28lib._web-server%2Fhttp%2Frequest-structs..rkt%29._header%29%29" class="tocsubnonseclink" data-pltdoc="x"><span class="RktSym"><span class="RktValLink">header</span></span></a></td></tr><tr><td><a href="#%28def._%28%28lib._web-server%2Fhttp%2Frequest-structs..rkt%29._headers-assq%29%29" class="tocsubnonseclink" data-pltdoc="x"><span class="RktSym"><span class="RktValLink">headers-<wbr></wbr>assq</span></span></a></td></tr><tr><td><a href="#%28def._%28%28lib._web-server%2Fhttp%2Frequest-structs..rkt%29._headers-assq%2A%29%29" class="tocsubnonseclink" data-pltdoc="x"><span class="RktSym"><span class="RktValLink">headers-<wbr></wbr>assq*</span></span></a></td></tr><tr><td><a href="#%28def._%28%28lib._web-server%2Fhttp%2Frequest-structs..rkt%29._binding%29%29" class="tocsubnonseclink" data-pltdoc="x"><span class="RktSym"><span class="RktValLink">binding</span></span></a></td></tr><tr><td><a href="#%28def._%28%28lib._web-server%2Fhttp%2Frequest-structs..rkt%29._binding~3aform%29%29" class="tocsubnonseclink" data-pltdoc="x"><span class="RktSym"><span class="RktValLink">binding:<span class="mywbr"> </span>form</span></span></a></td></tr><tr><td><a href="#%28def._%28%28lib._web-server%2Fhttp%2Frequest-structs..rkt%29._binding~3afile%29%29" class="tocsubnonseclink" data-pltdoc="x"><span class="RktSym"><span class="RktValLink">binding:<span class="mywbr"> </span>file</span></span></a></td></tr><tr><td><a href="#%28def._%28%28lib._web-server%2Fhttp%2Frequest-structs..rkt%29._bindings-assq%29%29" class="tocsubnonseclink" data-pltdoc="x"><span class="RktSym"><span class="RktValLink">bindings-<wbr></wbr>assq</span></span></a></td></tr><tr><td><a href="#%28def._%28%28lib._web-server%2Fhttp%2Frequest-structs..rkt%29._bindings-assq-all%29%29" class="tocsubnonseclink" data-pltdoc="x"><span class="RktSym"><span class="RktValLink">bindings-<wbr></wbr>assq-<wbr></wbr>all</span></span></a></td></tr><tr><td><a href="#%28def._%28%28lib._web-server%2Fhttp%2Frequest-structs..rkt%29._request%29%29" class="tocsubnonseclink" data-pltdoc="x"><span class="RktSym"><span class="RktValLink">request</span></span></a></td></tr><tr><td><a href="#%28def._%28%28lib._web-server%2Fhttp%2Frequest-structs..rkt%29._request-bindings%2Fraw%29%29" class="tocsubnonseclink" data-pltdoc="x"><span class="RktSym"><span class="RktValLink">request-<wbr></wbr>bindings/<span class="mywbr"> </span>raw</span></span></a></td></tr><tr><td><span class="tocsublinknumber">4.2<tt> </tt></span><a href="#%28part._bindings%29" class="tocsubseclink" data-pltdoc="x">Bindings</a></td></tr><tr><td><a href="#%28def._%28%28lib._web-server%2Fhttp%2Fbindings..rkt%29._request-bindings%29%29" class="tocsubnonseclink" data-pltdoc="x"><span class="RktSym"><span class="RktValLink">request-<wbr></wbr>bindings</span></span></a></td></tr><tr><td><a href="#%28def._%28%28lib._web-server%2Fhttp%2Fbindings..rkt%29._request-headers%29%29" class="tocsubnonseclink" data-pltdoc="x"><span class="RktSym"><span class="RktValLink">request-<wbr></wbr>headers</span></span></a></td></tr><tr><td><a href="#%28def._%28%28lib._web-server%2Fhttp%2Fbindings..rkt%29._extract-binding%2Fsingle%29%29" class="tocsubnonseclink" data-pltdoc="x"><span class="RktSym"><span class="RktValLink">extract-<wbr></wbr>binding/<span class="mywbr"> </span>single</span></span></a></td></tr><tr><td><a href="#%28def._%28%28lib._web-server%2Fhttp%2Fbindings..rkt%29._extract-bindings%29%29" class="tocsubnonseclink" data-pltdoc="x"><span class="RktSym"><span class="RktValLink">extract-<wbr></wbr>bindings</span></span></a></td></tr><tr><td><a href="#%28def._%28%28lib._web-server%2Fhttp%2Fbindings..rkt%29._exists-binding~3f%29%29" class="tocsubnonseclink" data-pltdoc="x"><span class="RktSym"><span class="RktValLink">exists-<wbr></wbr>binding?</span></span></a></td></tr><tr><td><span class="tocsublinknumber">4.3<tt> </tt></span><a href="#%28part._response-structs%29" class="tocsubseclink" data-pltdoc="x">Responses</a></td></tr><tr><td><a href="#%28def._%28%28lib._web-server%2Fhttp%2Fresponse-structs..rkt%29._response%29%29" class="tocsubnonseclink" data-pltdoc="x"><span class="RktSym"><span class="RktValLink">response</span></span></a></td></tr><tr><td><a href="#%28def._%28%28lib._web-server%2Fhttp%2Fresponse-structs..rkt%29._response%2Ffull%29%29" class="tocsubnonseclink" data-pltdoc="x"><span class="RktSym"><span class="RktValLink">response/<span class="mywbr"> </span>full</span></span></a></td></tr><tr><td><a href="#%28def._%28%28lib._web-server%2Fhttp%2Fresponse-structs..rkt%29._response%2Foutput%29%29" class="tocsubnonseclink" data-pltdoc="x"><span class="RktSym"><span class="RktValLink">response/<span class="mywbr"> </span>output</span></span></a></td></tr><tr><td><a href="#%28def._%28%28lib._web-server%2Fhttp%2Fresponse-structs..rkt%29._.T.E.X.T%2F.H.T.M.L-.M.I.M.E-.T.Y.P.E%29%29" class="tocsubnonseclink" data-pltdoc="x"><span class="RktSym"><span class="RktValLink">TEXT/<span class="mywbr"> </span>HTML-<wbr></wbr>MIME-<wbr></wbr>TYPE</span></span></a></td></tr><tr><td><span class="tocsublinknumber">4.4<tt> </tt></span><a href="#%28part._cookie%29" class="tocsubseclink" data-pltdoc="x">Placing Cookies</a></td></tr><tr><td><a href="#%28def._%28%28lib._web-server%2Fhttp%2Fcookie..rkt%29._make-cookie%29%29" class="tocsubnonseclink" data-pltdoc="x"><span class="RktSym"><span class="RktValLink">make-<wbr></wbr>cookie</span></span></a></td></tr><tr><td><a href="#%28def._%28%28lib._web-server%2Fhttp%2Fcookie..rkt%29._cookie-~3eheader%29%29" class="tocsubnonseclink" data-pltdoc="x"><span class="RktSym"><span class="RktValLink">cookie-<wbr></wbr>>header</span></span></a></td></tr><tr><td><span class="tocsublinknumber">4.5<tt> </tt></span><a href="#%28part._id-cookie%29" class="tocsubseclink" data-pltdoc="x">Authenticated Cookies</a></td></tr><tr><td><a href="#%28def._%28%28lib._web-server%2Fhttp%2Fid-cookie..rkt%29._make-id-cookie%29%29" class="tocsubnonseclink" data-pltdoc="x"><span class="RktSym"><span class="RktValLink">make-<wbr></wbr>id-<wbr></wbr>cookie</span></span></a></td></tr><tr><td><a href="#%28def._%28%28lib._web-server%2Fhttp%2Fid-cookie..rkt%29._request-id-cookie%29%29" class="tocsubnonseclink" data-pltdoc="x"><span class="RktSym"><span class="RktValLink">request-<wbr></wbr>id-<wbr></wbr>cookie</span></span></a></td></tr><tr><td><a href="#%28def._%28%28lib._web-server%2Fhttp%2Fid-cookie..rkt%29._logout-id-cookie%29%29" class="tocsubnonseclink" data-pltdoc="x"><span class="RktSym"><span class="RktValLink">logout-<wbr></wbr>id-<wbr></wbr>cookie</span></span></a></td></tr><tr><td><a href="#%28def._%28%28lib._web-server%2Fhttp%2Fid-cookie..rkt%29._make-secret-salt%2Ffile%29%29" class="tocsubnonseclink" data-pltdoc="x"><span class="RktSym"><span class="RktValLink">make-<wbr></wbr>secret-<wbr></wbr>salt/<span class="mywbr"> </span>file</span></span></a></td></tr><tr><td><span class="tocsublinknumber">4.6<tt> </tt></span><a href="#%28part._cookie-parse%29" class="tocsubseclink" data-pltdoc="x">Extracting Cookies</a></td></tr><tr><td><a href="#%28def._%28%28lib._web-server%2Fhttp%2Fcookie-parse..rkt%29._client-cookie%29%29" class="tocsubnonseclink" data-pltdoc="x"><span class="RktSym"><span class="RktValLink">client-<wbr></wbr>cookie</span></span></a></td></tr><tr><td><a href="#%28def._%28%28lib._web-server%2Fhttp%2Fcookie-parse..rkt%29._request-cookies%29%29" class="tocsubnonseclink" data-pltdoc="x"><span class="RktSym"><span class="RktValLink">request-<wbr></wbr>cookies</span></span></a></td></tr><tr><td><span class="tocsublinknumber">4.7<tt> </tt></span><a href="#%28part._redirect%29" class="tocsubseclink" data-pltdoc="x">Redirect</a></td></tr><tr><td><a href="#%28def._%28%28lib._web-server%2Fhttp%2Fredirect..rkt%29._redirect-to%29%29" class="tocsubnonseclink" data-pltdoc="x"><span class="RktSym"><span class="RktValLink">redirect-<wbr></wbr>to</span></span></a></td></tr><tr><td><a href="#%28def._%28%28lib._web-server%2Fhttp%2Fredirect..rkt%29._redirection-status~3f%29%29" class="tocsubnonseclink" data-pltdoc="x"><span class="RktSym"><span class="RktValLink">redirection-<wbr></wbr>status?</span></span></a></td></tr><tr><td><a href="#%28def._%28%28lib._web-server%2Fhttp%2Fredirect..rkt%29._permanently%29%29" class="tocsubnonseclink" data-pltdoc="x"><span class="RktSym"><span class="RktValLink">permanently</span></span></a></td></tr><tr><td><a href="#%28def._%28%28lib._web-server%2Fhttp%2Fredirect..rkt%29._temporarily%29%29" class="tocsubnonseclink" data-pltdoc="x"><span class="RktSym"><span class="RktValLink">temporarily</span></span></a></td></tr><tr><td><a href="#%28def._%28%28lib._web-server%2Fhttp%2Fredirect..rkt%29._see-other%29%29" class="tocsubnonseclink" data-pltdoc="x"><span class="RktSym"><span class="RktValLink">see-<wbr></wbr>other</span></span></a></td></tr><tr><td><span class="tocsublinknumber">4.8<tt> </tt></span><a href="#%28part._basic-auth%29" class="tocsubseclink" data-pltdoc="x">Basic Authentication</a></td></tr><tr><td><a href="#%28def._%28%28lib._web-server%2Fhttp%2Fbasic-auth..rkt%29._make-basic-auth-header%29%29" class="tocsubnonseclink" data-pltdoc="x"><span class="RktSym"><span class="RktValLink">make-<wbr></wbr>basic-<wbr></wbr>auth-<wbr></wbr>header</span></span></a></td></tr><tr><td><a href="#%28def._%28%28lib._web-server%2Fhttp%2Fbasic-auth..rkt%29._request-~3ebasic-credentials%29%29" class="tocsubnonseclink" data-pltdoc="x"><span class="RktSym"><span class="RktValLink">request-<wbr></wbr>>basic-<wbr></wbr>credentials</span></span></a></td></tr><tr><td><span class="tocsublinknumber">4.9<tt> </tt></span><a href="#%28part._digest-auth%29" class="tocsubseclink" data-pltdoc="x">Digest Authentication</a></td></tr><tr><td><a href="#%28def._%28%28lib._web-server%2Fhttp%2Fdigest-auth..rkt%29._make-digest-auth-header%29%29" class="tocsubnonseclink" data-pltdoc="x"><span class="RktSym"><span class="RktValLink">make-<wbr></wbr>digest-<wbr></wbr>auth-<wbr></wbr>header</span></span></a></td></tr><tr><td><a href="#%28def._%28%28lib._web-server%2Fhttp%2Fdigest-auth..rkt%29._request-~3edigest-credentials%29%29" class="tocsubnonseclink" data-pltdoc="x"><span class="RktSym"><span class="RktValLink">request-<wbr></wbr>>digest-<wbr></wbr>credentials</span></span></a></td></tr><tr><td><a href="#%28def._%28%28lib._web-server%2Fhttp%2Fdigest-auth..rkt%29._username%2Arealm-~3epassword%2Fc%29%29" class="tocsubnonseclink" data-pltdoc="x"><span class="RktSym"><span class="RktValLink">username*realm-<wbr></wbr>>password/<span class="mywbr"> </span>c</span></span></a></td></tr><tr><td><a href="#%28def._%28%28lib._web-server%2Fhttp%2Fdigest-auth..rkt%29._username%2Arealm-~3edigest-.H.A1%2Fc%29%29" class="tocsubnonseclink" data-pltdoc="x"><span class="RktSym"><span class="RktValLink">username*realm-<wbr></wbr>>digest-<wbr></wbr>HA1/<span class="mywbr"> </span>c</span></span></a></td></tr><tr><td><a href="#%28def._%28%28lib._web-server%2Fhttp%2Fdigest-auth..rkt%29._password-~3edigest-.H.A1%29%29" class="tocsubnonseclink" data-pltdoc="x"><span class="RktSym"><span class="RktValLink">password-<wbr></wbr>>digest-<wbr></wbr>HA1</span></span></a></td></tr><tr><td><a href="#%28def._%28%28lib._web-server%2Fhttp%2Fdigest-auth..rkt%29._make-check-digest-credentials%29%29" class="tocsubnonseclink" data-pltdoc="x"><span class="RktSym"><span class="RktValLink">make-<wbr></wbr>check-<wbr></wbr>digest-<wbr></wbr>credentials</span></span></a></td></tr><tr><td><span class="tocsublinknumber">4.10<tt> </tt></span><a href="#%28part._xexpr%29" class="tocsubseclink" data-pltdoc="x">X-<wbr></wbr>expression Support</a></td></tr><tr><td><a href="#%28def._%28%28lib._web-server%2Fhttp%2Fxexpr..rkt%29._response%2Fxexpr%29%29" class="tocsubnonseclink" data-pltdoc="x"><span class="RktSym"><span class="RktValLink">response/<span class="mywbr"> </span>xexpr</span></span></a></td></tr></table></div></div><div class="maincolumn"><div class="main"><div class="navsettop"><span class="navleft"><form class="searchform"><input class="searchbox" style="color: #888;" type="text" value="...search manuals..." title="Enter a search string to search the manuals" onkeypress="return DoSearchKey(event, this, "6.1", "../");" onfocus="this.style.color="black"; this.style.textAlign="left"; if (this.value == "...search manuals...") this.value="";" onblur="if (this.value.match(/^ *$/)) { this.style.color="#888"; this.style.textAlign="center"; this.value="...search manuals..."; }"/></form> <a href="../index.html" title="up to the documentation top" data-pltdoc="x" onclick="return GotoPLTRoot("6.1");">top</a></span><span class="navright"> <a href="stateless.html" title="backward to "3 Stateless Servlets"" data-pltdoc="x">← prev</a> <a href="index.html" title="up to "Web Applications in Racket"" data-pltdoc="x">up</a> <a href="dispatch.html" title="forward to "5 URL-Based Dispatch"" data-pltdoc="x">next →</a></span> </div><h3 x-source-module="(lib "web-server/scribblings/web-server.scrbl")" x-part-tag=""http"">4<tt> </tt><a name="(part._http)"></a><a name="(mod-path._web-server/http)"></a>HTTP: Hypertext Transfer Protocol</h3><p><table cellspacing="0" cellpadding="0" class="defmodule"><tr><td align="left"><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=require.html%23%2528form._%2528%2528lib._racket%252Fprivate%252Fbase..rkt%2529._require%2529%2529&version=6.1" class="RktStxLink Sq" data-pltdoc="x">require</a></span><span class="stt"> </span><a href="" class="RktModLink" data-pltdoc="x"><span class="RktSym">web-server/http</span></a><span class="RktPn">)</span></td><td align="right"><span class="RpackageSpec"><span class="Smaller"> package:</span> <span class="stt">web-server-lib</span></span></td></tr></table></p><p>The Web Server implements many HTTP libraries that are provided by this module.</p><h4 x-source-module="(lib "web-server/scribblings/web-server.scrbl")" x-part-tag=""request-structs"">4.1<tt> </tt><a name="(part._request-structs)"></a><a name="(mod-path._web-server/http/request-structs)"></a>Requests</h4><p><div class="SIntrapara"><table cellspacing="0" cellpadding="0" class="defmodule"><tr><td align="left" colspan="2"><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=require.html%23%2528form._%2528%2528lib._racket%252Fprivate%252Fbase..rkt%2529._require%2529%2529&version=6.1" class="RktStxLink Sq" data-pltdoc="x">require</a></span><span class="stt"> </span><a href="#%28mod-path._web-server%2Fhttp%2Frequest-structs%29" class="RktModLink" data-pltdoc="x"><span class="RktSym">web-server/http/request-structs</span></a><span class="RktPn">)</span></td></tr><tr><td align="left"> </td><td align="right"><span class="RpackageSpec"><span class="Smaller"> package:</span> <span class="stt">web-server-lib</span></span></td></tr></table></div><div class="SIntrapara"><p><div class="SIntrapara"><blockquote class="SVInsetFlow"><table cellspacing="0" cellpadding="0" class="boxed RBoxed"><tr><td><blockquote class="SubFlow"><div class="RBackgroundLabel SIEHidden"><div class="RBackgroundLabelInner"><p>struct</p></div></div><table cellspacing="0" cellpadding="0" class="RForeground"><tr><td><span class="RktPn">(</span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=define-struct.html%23%2528form._%2528%2528lib._racket%252Fprivate%252Fbase..rkt%2529._struct%2529%2529&version=6.1" class="RktStxLink Sq" data-pltdoc="x">struct</a></span></td><td><span class="hspace"> </span></td><td><a name="(def._((lib._web-server/http/request-structs..rkt)._header-value))"></a><a name="(def._((lib._web-server/http/request-structs..rkt)._header-field))"></a><a name="(def._((lib._web-server/http/request-structs..rkt)._make-header))"></a><a name="(def._((lib._web-server/http/request-structs..rkt)._header~3f))"></a><a name="(def._((lib._web-server/http/request-structs..rkt)._struct~3aheader))"></a><a name="(def._((lib._web-server/http/request-structs..rkt)._header))"></a><span title="Provided from: web-server/http/request-structs | Package: web-server-lib"><span class="RktSym"><a href="#%28def._%28%28lib._web-server%2Fhttp%2Frequest-structs..rkt%29._header%29%29" class="RktValDef RktValLink" data-pltdoc="x">header</a></span></span><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym">field</span><span class="stt"> </span><span class="RktSym">value</span><span class="RktPn">)</span></td></tr></table></blockquote></td></tr><tr><td><span class="hspace"> </span><span class="RktPn">#:extra-constructor-name</span><span class="hspace"> </span><span class="RktSym"><a href="#%28def._%28%28lib._web-server%2Fhttp%2Frequest-structs..rkt%29._make-header%29%29" class="RktValLink" data-pltdoc="x">make-header</a></span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace"> </span><span class="RktSym">field</span><span class="hspace"> </span>:<span class="hspace"> </span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=bytestrings.html%23%2528def._%2528%2528quote._%7E23%7E25kernel%2529._bytes%7E3f%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">bytes?</a></span></td></tr><tr><td><span class="hspace"> </span><span class="RktSym">value</span><span class="hspace"> </span>:<span class="hspace"> </span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=bytestrings.html%23%2528def._%2528%2528quote._%7E23%7E25kernel%2529._bytes%7E3f%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">bytes?</a></span></td></tr></table></blockquote></div><div class="SIntrapara">Represents a header of <span class="RktSym">field</span> to <span class="RktSym">value</span>.</div></p></div><div class="SIntrapara"><p><div class="SIntrapara"><blockquote class="SVInsetFlow"><table cellspacing="0" cellpadding="0" class="boxed RBoxed"><tr><td><blockquote class="SubFlow"><div class="RBackgroundLabel SIEHidden"><div class="RBackgroundLabelInner"><p>procedure</p></div></div><p class="RForeground"><span class="RktPn">(</span><a name="(def._((lib._web-server/http/request-structs..rkt)._headers-assq))"></a><span title="Provided from: web-server/http/request-structs | Package: web-server-lib"><span class="RktSym"><a href="#%28def._%28%28lib._web-server%2Fhttp%2Frequest-structs..rkt%29._headers-assq%29%29" class="RktValDef RktValLink" data-pltdoc="x">headers-assq</a></span></span><span class="hspace"> </span><span class="RktVar">id</span><span class="hspace"> </span><span class="RktVar">heads</span><span class="RktPn">)</span><span class="hspace"> </span>→<span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=data-structure-contracts.html%23%2528def._%2528%2528lib._racket%252Fcontract%252Fbase..rkt%2529._or%252Fc%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">or/c</a></span><span class="hspace"> </span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=data-structure-contracts.html%23%2528def._%2528%2528lib._racket%252Fcontract%252Fprivate%252Fmisc..rkt%2529._false%252Fc%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">false/c</a></span><span class="hspace"> </span><span class="RktSym"><a href="#%28def._%28%28lib._web-server%2Fhttp%2Frequest-structs..rkt%29._header~3f%29%29" class="RktValLink" data-pltdoc="x">header?</a></span><span class="RktPn">)</span></p></blockquote></td></tr><tr><td><span class="hspace"> </span><span class="RktVar">id</span><span class="hspace"> </span>:<span class="hspace"> </span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=bytestrings.html%23%2528def._%2528%2528quote._%7E23%7E25kernel%2529._bytes%7E3f%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">bytes?</a></span></td></tr><tr><td><span class="hspace"> </span><span class="RktVar">heads</span><span class="hspace"> </span>:<span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=data-structure-contracts.html%23%2528def._%2528%2528lib._racket%252Fcontract%252Fprivate%252Fmisc..rkt%2529._listof%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">listof</a></span><span class="hspace"> </span><span class="RktSym"><a href="#%28def._%28%28lib._web-server%2Fhttp%2Frequest-structs..rkt%29._header~3f%29%29" class="RktValLink" data-pltdoc="x">header?</a></span><span class="RktPn">)</span></td></tr></table></blockquote></div><div class="SIntrapara">Returns the header with a field equal to <span class="RktVar">id</span> from <span class="RktVar">heads</span> or <span class="RktVal">#f</span>.</div></p></div><div class="SIntrapara"><p><div class="SIntrapara"><blockquote class="SVInsetFlow"><table cellspacing="0" cellpadding="0" class="boxed RBoxed"><tr><td><blockquote class="SubFlow"><div class="RBackgroundLabel SIEHidden"><div class="RBackgroundLabelInner"><p>procedure</p></div></div><p class="RForeground"><span class="RktPn">(</span><a name="(def._((lib._web-server/http/request-structs..rkt)._headers-assq*))"></a><span title="Provided from: web-server/http/request-structs | Package: web-server-lib"><span class="RktSym"><a href="#%28def._%28%28lib._web-server%2Fhttp%2Frequest-structs..rkt%29._headers-assq%2A%29%29" class="RktValDef RktValLink" data-pltdoc="x">headers-assq*</a></span></span><span class="hspace"> </span><span class="RktVar">id</span><span class="hspace"> </span><span class="RktVar">heads</span><span class="RktPn">)</span><span class="hspace"> </span>→<span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=data-structure-contracts.html%23%2528def._%2528%2528lib._racket%252Fcontract%252Fbase..rkt%2529._or%252Fc%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">or/c</a></span><span class="hspace"> </span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=data-structure-contracts.html%23%2528def._%2528%2528lib._racket%252Fcontract%252Fprivate%252Fmisc..rkt%2529._false%252Fc%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">false/c</a></span><span class="hspace"> </span><span class="RktSym"><a href="#%28def._%28%28lib._web-server%2Fhttp%2Frequest-structs..rkt%29._header~3f%29%29" class="RktValLink" data-pltdoc="x">header?</a></span><span class="RktPn">)</span></p></blockquote></td></tr><tr><td><span class="hspace"> </span><span class="RktVar">id</span><span class="hspace"> </span>:<span class="hspace"> </span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=bytestrings.html%23%2528def._%2528%2528quote._%7E23%7E25kernel%2529._bytes%7E3f%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">bytes?</a></span></td></tr><tr><td><span class="hspace"> </span><span class="RktVar">heads</span><span class="hspace"> </span>:<span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=data-structure-contracts.html%23%2528def._%2528%2528lib._racket%252Fcontract%252Fprivate%252Fmisc..rkt%2529._listof%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">listof</a></span><span class="hspace"> </span><span class="RktSym"><a href="#%28def._%28%28lib._web-server%2Fhttp%2Frequest-structs..rkt%29._header~3f%29%29" class="RktValLink" data-pltdoc="x">header?</a></span><span class="RktPn">)</span></td></tr></table></blockquote></div><div class="SIntrapara">Returns the header with a field case-insensitively equal to <span class="RktVar">id</span> from <span class="RktVar">heads</span> or <span class="RktVal">#f</span>.</div></p></div><div class="SIntrapara">You almost <span style="font-weight: bold">always</span> want to use this, rather than <span class="RktSym"><a href="#%28def._%28%28lib._web-server%2Fhttp%2Frequest-structs..rkt%29._headers-assq%29%29" class="RktValLink" data-pltdoc="x">headers-assq</a></span> because Web browsers may send headers with arbitrary casing.</div><div class="SIntrapara"><p><div class="SIntrapara"><blockquote class="SVInsetFlow"><table cellspacing="0" cellpadding="0" class="boxed RBoxed"><tr><td><blockquote class="SubFlow"><div class="RBackgroundLabel SIEHidden"><div class="RBackgroundLabelInner"><p>struct</p></div></div><table cellspacing="0" cellpadding="0" class="RForeground"><tr><td><span class="RktPn">(</span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=define-struct.html%23%2528form._%2528%2528lib._racket%252Fprivate%252Fbase..rkt%2529._struct%2529%2529&version=6.1" class="RktStxLink Sq" data-pltdoc="x">struct</a></span></td><td><span class="hspace"> </span></td><td><a name="(def._((lib._web-server/http/request-structs..rkt)._binding-id))"></a><a name="(def._((lib._web-server/http/request-structs..rkt)._make-binding))"></a><a name="(def._((lib._web-server/http/request-structs..rkt)._binding~3f))"></a><a name="(def._((lib._web-server/http/request-structs..rkt)._struct~3abinding))"></a><a name="(def._((lib._web-server/http/request-structs..rkt)._binding))"></a><span title="Provided from: web-server/http/request-structs | Package: web-server-lib"><span class="RktSym"><a href="#%28def._%28%28lib._web-server%2Fhttp%2Frequest-structs..rkt%29._binding%29%29" class="RktValDef RktValLink" data-pltdoc="x">binding</a></span></span><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym">id</span><span class="RktPn">)</span></td></tr></table></blockquote></td></tr><tr><td><span class="hspace"> </span><span class="RktPn">#:extra-constructor-name</span><span class="hspace"> </span><span class="RktSym"><a href="#%28def._%28%28lib._web-server%2Fhttp%2Frequest-structs..rkt%29._make-binding%29%29" class="RktValLink" data-pltdoc="x">make-binding</a></span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace"> </span><span class="RktSym">id</span><span class="hspace"> </span>:<span class="hspace"> </span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=bytestrings.html%23%2528def._%2528%2528quote._%7E23%7E25kernel%2529._bytes%7E3f%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">bytes?</a></span></td></tr></table></blockquote></div><div class="SIntrapara">Represents a binding of <span class="RktSym">id</span>.</div></p></div><div class="SIntrapara"><p><div class="SIntrapara"><blockquote class="SVInsetFlow"><table cellspacing="0" cellpadding="0" class="boxed RBoxed"><tr><td><blockquote class="SubFlow"><div class="RBackgroundLabel SIEHidden"><div class="RBackgroundLabelInner"><p>struct</p></div></div><table cellspacing="0" cellpadding="0" class="RForeground"><tr><td><span class="RktPn">(</span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=define-struct.html%23%2528form._%2528%2528lib._racket%252Fprivate%252Fbase..rkt%2529._struct%2529%2529&version=6.1" class="RktStxLink Sq" data-pltdoc="x">struct</a></span></td><td><span class="hspace"> </span></td><td><a name="(def._((lib._web-server/http/request-structs..rkt)._binding~3aform-value))"></a><a name="(def._((lib._web-server/http/request-structs..rkt)._make-binding~3aform))"></a><a name="(def._((lib._web-server/http/request-structs..rkt)._binding~3aform~3f))"></a><a name="(def._((lib._web-server/http/request-structs..rkt)._struct~3abinding~3aform))"></a><a name="(def._((lib._web-server/http/request-structs..rkt)._binding~3aform))"></a><span title="Provided from: web-server/http/request-structs | Package: web-server-lib"><span class="RktSym"><a href="#%28def._%28%28lib._web-server%2Fhttp%2Frequest-structs..rkt%29._binding~3aform%29%29" class="RktValDef RktValLink" data-pltdoc="x">binding:form</a></span></span><span class="hspace"> </span><span class="RktSym"><a href="#%28def._%28%28lib._web-server%2Fhttp%2Frequest-structs..rkt%29._binding%29%29" class="RktValLink" data-pltdoc="x">binding</a></span><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym">value</span><span class="RktPn">)</span></td></tr></table></blockquote></td></tr><tr><td><span class="hspace"> </span><span class="RktPn">#:extra-constructor-name</span><span class="hspace"> </span><span class="RktSym"><a href="#%28def._%28%28lib._web-server%2Fhttp%2Frequest-structs..rkt%29._make-binding~3aform%29%29" class="RktValLink" data-pltdoc="x">make-binding:form</a></span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace"> </span><span class="RktSym">value</span><span class="hspace"> </span>:<span class="hspace"> </span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=bytestrings.html%23%2528def._%2528%2528quote._%7E23%7E25kernel%2529._bytes%7E3f%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">bytes?</a></span></td></tr></table></blockquote></div><div class="SIntrapara">Represents a form binding of <span class="RktSym">id</span> to <span class="RktSym">value</span>.</div></p></div><div class="SIntrapara"><p><div class="SIntrapara"><blockquote class="SVInsetFlow"><table cellspacing="0" cellpadding="0" class="boxed RBoxed"><tr><td><blockquote class="SubFlow"><div class="RBackgroundLabel SIEHidden"><div class="RBackgroundLabelInner"><p>struct</p></div></div><table cellspacing="0" cellpadding="0" class="RForeground"><tr><td><span class="RktPn">(</span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=define-struct.html%23%2528form._%2528%2528lib._racket%252Fprivate%252Fbase..rkt%2529._struct%2529%2529&version=6.1" class="RktStxLink Sq" data-pltdoc="x">struct</a></span></td><td><span class="hspace"> </span></td><td><a name="(def._((lib._web-server/http/request-structs..rkt)._binding~3afile-content))"></a><a name="(def._((lib._web-server/http/request-structs..rkt)._binding~3afile-headers))"></a><a name="(def._((lib._web-server/http/request-structs..rkt)._binding~3afile-filename))"></a><a name="(def._((lib._web-server/http/request-structs..rkt)._make-binding~3afile))"></a><a name="(def._((lib._web-server/http/request-structs..rkt)._binding~3afile~3f))"></a><a name="(def._((lib._web-server/http/request-structs..rkt)._struct~3abinding~3afile))"></a><a name="(def._((lib._web-server/http/request-structs..rkt)._binding~3afile))"></a><span title="Provided from: web-server/http/request-structs | Package: web-server-lib"><span class="RktSym"><a href="#%28def._%28%28lib._web-server%2Fhttp%2Frequest-structs..rkt%29._binding~3afile%29%29" class="RktValDef RktValLink" data-pltdoc="x">binding:file</a></span></span><span class="hspace"> </span><span class="RktSym"><a href="#%28def._%28%28lib._web-server%2Fhttp%2Frequest-structs..rkt%29._binding%29%29" class="RktValLink" data-pltdoc="x">binding</a></span><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym">filename</span><span class="stt"> </span><span class="RktSym">headers</span><span class="stt"> </span><span class="RktSym">content</span><span class="RktPn">)</span></td></tr></table></blockquote></td></tr><tr><td><span class="hspace"> </span><span class="RktPn">#:extra-constructor-name</span><span class="hspace"> </span><span class="RktSym"><a href="#%28def._%28%28lib._web-server%2Fhttp%2Frequest-structs..rkt%29._make-binding~3afile%29%29" class="RktValLink" data-pltdoc="x">make-binding:file</a></span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace"> </span><span class="RktSym">filename</span><span class="hspace"> </span>:<span class="hspace"> </span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=bytestrings.html%23%2528def._%2528%2528quote._%7E23%7E25kernel%2529._bytes%7E3f%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">bytes?</a></span></td></tr><tr><td><span class="hspace"> </span><span class="RktSym">headers</span><span class="hspace"> </span>:<span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=data-structure-contracts.html%23%2528def._%2528%2528lib._racket%252Fcontract%252Fprivate%252Fmisc..rkt%2529._listof%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">listof</a></span><span class="hspace"> </span><span class="RktSym"><a href="#%28def._%28%28lib._web-server%2Fhttp%2Frequest-structs..rkt%29._header~3f%29%29" class="RktValLink" data-pltdoc="x">header?</a></span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace"> </span><span class="RktSym">content</span><span class="hspace"> </span>:<span class="hspace"> </span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=bytestrings.html%23%2528def._%2528%2528quote._%7E23%7E25kernel%2529._bytes%7E3f%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">bytes?</a></span></td></tr></table></blockquote></div><div class="SIntrapara">Represents the uploading of the file <span class="RktSym">filename</span> with the id <span class="RktSym">id</span>
and the content <span class="RktSym">content</span>, where <span class="RktSym">headers</span> are the additional headers from
the MIME envelope the file was in. (For example, the <span class="RktVal">#"Content-Type"</span> header may
be included by some browsers.)</div></p></div><div class="SIntrapara"><p><div class="SIntrapara"><blockquote class="SVInsetFlow"><table cellspacing="0" cellpadding="0" class="boxed RBoxed"><tr><td><blockquote class="SubFlow"><div class="RBackgroundLabel SIEHidden"><div class="RBackgroundLabelInner"><p>procedure</p></div></div><p class="RForeground"><span class="RktPn">(</span><a name="(def._((lib._web-server/http/request-structs..rkt)._bindings-assq))"></a><span title="Provided from: web-server/http/request-structs | Package: web-server-lib"><span class="RktSym"><a href="#%28def._%28%28lib._web-server%2Fhttp%2Frequest-structs..rkt%29._bindings-assq%29%29" class="RktValDef RktValLink" data-pltdoc="x">bindings-assq</a></span></span><span class="hspace"> </span><span class="RktVar">id</span><span class="hspace"> </span><span class="RktVar">binds</span><span class="RktPn">)</span><span class="hspace"> </span>→<span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=data-structure-contracts.html%23%2528def._%2528%2528lib._racket%252Fcontract%252Fbase..rkt%2529._or%252Fc%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">or/c</a></span><span class="hspace"> </span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=data-structure-contracts.html%23%2528def._%2528%2528lib._racket%252Fcontract%252Fprivate%252Fmisc..rkt%2529._false%252Fc%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">false/c</a></span><span class="hspace"> </span><span class="RktSym"><a href="#%28def._%28%28lib._web-server%2Fhttp%2Frequest-structs..rkt%29._binding~3f%29%29" class="RktValLink" data-pltdoc="x">binding?</a></span><span class="RktPn">)</span></p></blockquote></td></tr><tr><td><span class="hspace"> </span><span class="RktVar">id</span><span class="hspace"> </span>:<span class="hspace"> </span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=bytestrings.html%23%2528def._%2528%2528quote._%7E23%7E25kernel%2529._bytes%7E3f%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">bytes?</a></span></td></tr><tr><td><span class="hspace"> </span><span class="RktVar">binds</span><span class="hspace"> </span>:<span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=data-structure-contracts.html%23%2528def._%2528%2528lib._racket%252Fcontract%252Fprivate%252Fmisc..rkt%2529._listof%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">listof</a></span><span class="hspace"> </span><span class="RktSym"><a href="#%28def._%28%28lib._web-server%2Fhttp%2Frequest-structs..rkt%29._binding~3f%29%29" class="RktValLink" data-pltdoc="x">binding?</a></span><span class="RktPn">)</span></td></tr></table></blockquote></div><div class="SIntrapara">Returns the binding with an id equal to <span class="RktVar">id</span> from <span class="RktVar">binds</span> or <span class="RktVal">#f</span>.</div></p></div><div class="SIntrapara"><p><div class="SIntrapara"><blockquote class="SVInsetFlow"><table cellspacing="0" cellpadding="0" class="boxed RBoxed"><tr><td><blockquote class="SubFlow"><div class="RBackgroundLabel SIEHidden"><div class="RBackgroundLabelInner"><p>procedure</p></div></div><p class="RForeground"><span class="RktPn">(</span><a name="(def._((lib._web-server/http/request-structs..rkt)._bindings-assq-all))"></a><span title="Provided from: web-server/http/request-structs | Package: web-server-lib"><span class="RktSym"><a href="#%28def._%28%28lib._web-server%2Fhttp%2Frequest-structs..rkt%29._bindings-assq-all%29%29" class="RktValDef RktValLink" data-pltdoc="x">bindings-assq-all</a></span></span><span class="hspace"> </span><span class="RktVar">id</span><span class="hspace"> </span><span class="RktVar">binds</span><span class="RktPn">)</span><span class="hspace"> </span>→<span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=data-structure-contracts.html%23%2528def._%2528%2528lib._racket%252Fcontract%252Fprivate%252Fmisc..rkt%2529._listof%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">listof</a></span><span class="hspace"> </span><span class="RktSym"><a href="#%28def._%28%28lib._web-server%2Fhttp%2Frequest-structs..rkt%29._binding~3f%29%29" class="RktValLink" data-pltdoc="x">binding?</a></span><span class="RktPn">)</span></p></blockquote></td></tr><tr><td><span class="hspace"> </span><span class="RktVar">id</span><span class="hspace"> </span>:<span class="hspace"> </span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=bytestrings.html%23%2528def._%2528%2528quote._%7E23%7E25kernel%2529._bytes%7E3f%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">bytes?</a></span></td></tr><tr><td><span class="hspace"> </span><span class="RktVar">binds</span><span class="hspace"> </span>:<span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=data-structure-contracts.html%23%2528def._%2528%2528lib._racket%252Fcontract%252Fprivate%252Fmisc..rkt%2529._listof%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">listof</a></span><span class="hspace"> </span><span class="RktSym"><a href="#%28def._%28%28lib._web-server%2Fhttp%2Frequest-structs..rkt%29._binding~3f%29%29" class="RktValLink" data-pltdoc="x">binding?</a></span><span class="RktPn">)</span></td></tr></table></blockquote></div><div class="SIntrapara">Like <span class="RktSym"><a href="#%28def._%28%28lib._web-server%2Fhttp%2Frequest-structs..rkt%29._bindings-assq%29%29" class="RktValLink" data-pltdoc="x">bindings-assq</a></span>, but returns a list of all bindings matching <span class="RktVar">id</span>.</div></p></div><div class="SIntrapara"><p><div class="SIntrapara"><blockquote class="SVInsetFlow"><table cellspacing="0" cellpadding="0" class="boxed RBoxed"><tr><td><blockquote class="SubFlow"><div class="RBackgroundLabel SIEHidden"><div class="RBackgroundLabelInner"><p>struct</p></div></div><table cellspacing="0" cellpadding="0" class="RForeground"><tr><td><span class="RktPn">(</span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=define-struct.html%23%2528form._%2528%2528lib._racket%252Fprivate%252Fbase..rkt%2529._struct%2529%2529&version=6.1" class="RktStxLink Sq" data-pltdoc="x">struct</a></span></td><td><span class="hspace"> </span></td><td><span class="nobreak"><a name="(def._((lib._web-server/http/request-structs..rkt)._request-client-ip))"></a><a name="(def._((lib._web-server/http/request-structs..rkt)._request-host-port))"></a><a name="(def._((lib._web-server/http/request-structs..rkt)._request-host-ip))"></a><a name="(def._((lib._web-server/http/request-structs..rkt)._request-post-data/raw))"></a><a name="(def._((lib._web-server/http/request-structs..rkt)._request-bindings/raw-promise))"></a><a name="(def._((lib._web-server/http/request-structs..rkt)._request-headers/raw))"></a><a name="(def._((lib._web-server/http/request-structs..rkt)._request-uri))"></a><a name="(def._((lib._web-server/http/request-structs..rkt)._request-method))"></a><a name="(def._((lib._web-server/http/request-structs..rkt)._make-request))"></a><a name="(def._((lib._web-server/http/request-structs..rkt)._request~3f))"></a><a name="(def._((lib._web-server/http/request-structs..rkt)._struct~3arequest))"></a><a name="(def._((lib._web-server/http/request-structs..rkt)._request))"></a><span title="Provided from: web-server/http/request-structs | Package: web-server-lib"><span class="RktSym"><a href="#%28def._%28%28lib._web-server%2Fhttp%2Frequest-structs..rkt%29._request%29%29" class="RktValDef RktValLink" data-pltdoc="x">request</a></span></span></span></td><td><span class="hspace"> </span><span class="RktPn">(</span></td><td><span class="nobreak"><span class="RktSym">method</span></span></td></tr><tr><td><span class="hspace"> </span></td><td><span class="hspace"> </span></td><td><span class="hspace"> </span></td><td><span class="hspace"> </span></td><td><span class="RktSym">uri</span></td></tr><tr><td><span class="hspace"> </span></td><td><span class="hspace"> </span></td><td><span class="hspace"> </span></td><td><span class="hspace"> </span></td><td><span class="RktSym">headers/raw</span></td></tr><tr><td><span class="hspace"> </span></td><td><span class="hspace"> </span></td><td><span class="hspace"> </span></td><td><span class="hspace"> </span></td><td><span class="RktSym">bindings/raw-promise</span></td></tr><tr><td><span class="hspace"> </span></td><td><span class="hspace"> </span></td><td><span class="hspace"> </span></td><td><span class="hspace"> </span></td><td><span class="RktSym">post-data/raw</span></td></tr><tr><td><span class="hspace"> </span></td><td><span class="hspace"> </span></td><td><span class="hspace"> </span></td><td><span class="hspace"> </span></td><td><span class="RktSym">host-ip</span></td></tr><tr><td><span class="hspace"> </span></td><td><span class="hspace"> </span></td><td><span class="hspace"> </span></td><td><span class="hspace"> </span></td><td><span class="RktSym">host-port</span></td></tr><tr><td><span class="hspace"> </span></td><td><span class="hspace"> </span></td><td><span class="hspace"> </span></td><td><span class="hspace"> </span></td><td><span class="RktSym">client-ip</span><span class="RktPn">)</span></td></tr></table></blockquote></td></tr><tr><td><span class="hspace"> </span><span class="RktPn">#:extra-constructor-name</span><span class="hspace"> </span><span class="RktSym"><a href="#%28def._%28%28lib._web-server%2Fhttp%2Frequest-structs..rkt%29._make-request%29%29" class="RktValLink" data-pltdoc="x">make-request</a></span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace"> </span><span class="RktSym">method</span><span class="hspace"> </span>:<span class="hspace"> </span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=bytestrings.html%23%2528def._%2528%2528quote._%7E23%7E25kernel%2529._bytes%7E3f%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">bytes?</a></span></td></tr><tr><td><span class="hspace"> </span><span class="RktSym">uri</span><span class="hspace"> </span>:<span class="hspace"> </span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=net&rel=url.html%23%2528def._%2528%2528lib._net%252Furl-structs..rkt%2529._url%7E3f%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">url?</a></span></td></tr><tr><td><span class="hspace"> </span><span class="RktSym">headers/raw</span><span class="hspace"> </span>:<span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=data-structure-contracts.html%23%2528def._%2528%2528lib._racket%252Fcontract%252Fprivate%252Fmisc..rkt%2529._listof%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">listof</a></span><span class="hspace"> </span><span class="RktSym"><a href="#%28def._%28%28lib._web-server%2Fhttp%2Frequest-structs..rkt%29._header~3f%29%29" class="RktValLink" data-pltdoc="x">header?</a></span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace"> </span><span class="RktSym">bindings/raw-promise</span><span class="hspace"> </span>:<span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=data-structure-contracts.html%23%2528def._%2528%2528lib._racket%252Fcontract%252Fprivate%252Fmisc..rkt%2529._promise%252Fc%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">promise/c</a></span><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=data-structure-contracts.html%23%2528def._%2528%2528lib._racket%252Fcontract%252Fprivate%252Fmisc..rkt%2529._listof%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">listof</a></span><span class="hspace"> </span><span class="RktSym"><a href="#%28def._%28%28lib._web-server%2Fhttp%2Frequest-structs..rkt%29._binding~3f%29%29" class="RktValLink" data-pltdoc="x">binding?</a></span><span class="RktPn">)</span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace"> </span><span class="RktSym">post-data/raw</span><span class="hspace"> </span>:<span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=data-structure-contracts.html%23%2528def._%2528%2528lib._racket%252Fcontract%252Fbase..rkt%2529._or%252Fc%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">or/c</a></span><span class="hspace"> </span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=data-structure-contracts.html%23%2528def._%2528%2528lib._racket%252Fcontract%252Fprivate%252Fmisc..rkt%2529._false%252Fc%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">false/c</a></span><span class="hspace"> </span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=bytestrings.html%23%2528def._%2528%2528quote._%7E23%7E25kernel%2529._bytes%7E3f%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">bytes?</a></span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace"> </span><span class="RktSym">host-ip</span><span class="hspace"> </span>:<span class="hspace"> </span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=strings.html%23%2528def._%2528%2528quote._%7E23%7E25kernel%2529._string%7E3f%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">string?</a></span></td></tr><tr><td><span class="hspace"> </span><span class="RktSym">host-port</span><span class="hspace"> </span>:<span class="hspace"> </span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=number-types.html%23%2528def._%2528%2528quote._%7E23%7E25kernel%2529._number%7E3f%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">number?</a></span></td></tr><tr><td><span class="hspace"> </span><span class="RktSym">client-ip</span><span class="hspace"> </span>:<span class="hspace"> </span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=strings.html%23%2528def._%2528%2528quote._%7E23%7E25kernel%2529._string%7E3f%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">string?</a></span></td></tr></table></blockquote></div><div class="SIntrapara">An HTTP <span class="RktSym">method</span> request to <span class="RktSym">uri</span> from <span class="RktSym">client-ip</span>
to the server at <span class="RktSym">host-ip</span>:<span class="RktSym">host-port</span> with <span class="RktSym">headers/raw</span>
headers, <span class="RktSym">bindings/raw</span> GET and POST queries and <span class="RktSym">post-data/raw</span>
POST data.</div></p></div><div class="SIntrapara">You are <span style="font-weight: bold">unlikely to need to construct</span> a request struct.</div><div class="SIntrapara"><p><div class="SIntrapara"><blockquote class="SVInsetFlow"><table cellspacing="0" cellpadding="0" class="boxed RBoxed"><tr><td><blockquote class="SubFlow"><div class="RBackgroundLabel SIEHidden"><div class="RBackgroundLabelInner"><p>procedure</p></div></div><p class="RForeground"><span class="RktPn">(</span><a name="(def._((lib._web-server/http/request-structs..rkt)._request-bindings/raw))"></a><span title="Provided from: web-server/http/request-structs | Package: web-server-lib"><span class="RktSym"><a href="#%28def._%28%28lib._web-server%2Fhttp%2Frequest-structs..rkt%29._request-bindings%2Fraw%29%29" class="RktValDef RktValLink" data-pltdoc="x">request-bindings/raw</a></span></span><span class="hspace"> </span><span class="RktVar">r</span><span class="RktPn">)</span><span class="hspace"> </span>→<span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=data-structure-contracts.html%23%2528def._%2528%2528lib._racket%252Fcontract%252Fprivate%252Fmisc..rkt%2529._listof%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">listof</a></span><span class="hspace"> </span><span class="RktSym"><a href="#%28def._%28%28lib._web-server%2Fhttp%2Frequest-structs..rkt%29._binding~3f%29%29" class="RktValLink" data-pltdoc="x">binding?</a></span><span class="RktPn">)</span></p></blockquote></td></tr><tr><td><span class="hspace"> </span><span class="RktVar">r</span><span class="hspace"> </span>:<span class="hspace"> </span><span class="RktSym"><a href="#%28def._%28%28lib._web-server%2Fhttp%2Frequest-structs..rkt%29._request~3f%29%29" class="RktValLink" data-pltdoc="x">request?</a></span></td></tr></table></blockquote></div><div class="SIntrapara">Forces <span class="RktPn">(</span><span class="RktSym"><a href="#%28def._%28%28lib._web-server%2Fhttp%2Frequest-structs..rkt%29._request-bindings%2Fraw-promise%29%29" class="RktValLink" data-pltdoc="x">request-bindings/raw-promise</a></span><span class="stt"> </span><span class="RktVar">r</span><span class="RktPn">)</span>.</div></p></div><div class="SIntrapara"><p><div class="SIntrapara">Here is an example typical of what you will find in many applications:
</div><div class="SIntrapara"><blockquote class="SCodeFlow"><table cellspacing="0" cellpadding="0" class="RktBlk"><tr><td><span class="RktPn">(</span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=define.html%23%2528form._%2528%2528lib._racket%252Fprivate%252Fbase..rkt%2529._define%2529%2529&version=6.1" class="RktStxLink Sq" data-pltdoc="x">define</a></span><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym">get-number</span><span class="hspace"> </span><span class="RktSym">req</span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=match.html%23%2528form._%2528%2528lib._racket%252Fmatch..rkt%2529._match%2529%2529&version=6.1" class="RktStxLink Sq" data-pltdoc="x">match</a></span></td></tr><tr><td><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="#%28def._%28%28lib._web-server%2Fhttp%2Frequest-structs..rkt%29._bindings-assq%29%29" class="RktValLink" data-pltdoc="x">bindings-assq</a></span></td></tr><tr><td><span class="hspace"> </span><span class="RktVal">#"number"</span></td></tr><tr><td><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="#%28def._%28%28lib._web-server%2Fhttp%2Frequest-structs..rkt%29._request-bindings%2Fraw%29%29" class="RktValLink" data-pltdoc="x">request-bindings/raw</a></span><span class="hspace"> </span><span class="RktSym">req</span><span class="RktPn">)</span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace"> </span><span class="RktPn">[</span><span class="RktPn">(</span><span class="RktSym">?</span><span class="hspace"> </span><span class="RktSym"><a href="#%28def._%28%28lib._web-server%2Fhttp%2Frequest-structs..rkt%29._binding~3aform~3f%29%29" class="RktValLink" data-pltdoc="x">binding:form?</a></span><span class="hspace"> </span><span class="RktSym">b</span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=generic-numbers.html%23%2528def._%2528%2528quote._%7E23%7E25kernel%2529._string-%7E3enumber%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">string->number</a></span></td></tr><tr><td><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=bytestrings.html%23%2528def._%2528%2528quote._%7E23%7E25kernel%2529._bytes-%7E3estring%252Futf-8%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">bytes->string/utf-8</a></span></td></tr><tr><td><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="#%28def._%28%28lib._web-server%2Fhttp%2Frequest-structs..rkt%29._binding~3aform-value%29%29" class="RktValLink" data-pltdoc="x">binding:form-value</a></span><span class="hspace"> </span><span class="RktSym">b</span><span class="RktPn">)</span><span class="RktPn">)</span><span class="RktPn">)</span><span class="RktPn">]</span></td></tr><tr><td><span class="hspace"> </span><span class="RktPn">[</span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=stx-patterns.html%23%2528form._%2528%2528lib._racket%252Fprivate%252Fstxcase-scheme..rkt%2529.__%2529%2529&version=6.1" class="RktStxLink Sq" data-pltdoc="x">_</a></span></td></tr><tr><td><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym">get-number</span><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym">request-number</span><span class="RktPn">)</span><span class="RktPn">)</span><span class="RktPn">]</span><span class="RktPn">)</span><span class="RktPn">)</span></td></tr></table></blockquote></div></p></div></p><h4 x-source-module="(lib "web-server/scribblings/web-server.scrbl")" x-part-tag=""bindings"">4.2<tt> </tt><a name="(part._bindings)"></a><a name="(mod-path._web-server/http/bindings)"></a>Bindings</h4><p><div class="SIntrapara"><table cellspacing="0" cellpadding="0" class="defmodule"><tr><td align="left" colspan="2"><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=require.html%23%2528form._%2528%2528lib._racket%252Fprivate%252Fbase..rkt%2529._require%2529%2529&version=6.1" class="RktStxLink Sq" data-pltdoc="x">require</a></span><span class="stt"> </span><a href="#%28mod-path._web-server%2Fhttp%2Fbindings%29" class="RktModLink" data-pltdoc="x"><span class="RktSym">web-server/http/bindings</span></a><span class="RktPn">)</span></td></tr><tr><td align="left"> </td><td align="right"><span class="RpackageSpec"><span class="Smaller"> package:</span> <span class="stt">web-server-lib</span></span></td></tr></table></div><div class="SIntrapara">These functions, while convenient, could introduce subtle errors into your
application. Examples: that they are case-insensitive could introduce
an error; if the data submitted is not in UTF-8 format, then the conversion
to a string will fail; if an attacker submits a form field as if it were
a file, when it is not, then the <span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=continue&rel=index.html%23%2528def._%2528%2528lib._web-server%252Fservlet..rkt%2529._request-bindings%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">request-bindings</a></span> will hold a
<span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=bytestrings.html%23%2528def._%2528%2528quote._%7E23%7E25kernel%2529._bytes%7E3f%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">bytes?</a></span> object and your program will error; and, for file uploads
you lose the filename. <span style="font-weight: bold">Therefore, we recommend against their use, but
they are provided for compatibility with old code.</span></div><div class="SIntrapara"><p><div class="SIntrapara"><blockquote class="SVInsetFlow"><table cellspacing="0" cellpadding="0" class="boxed RBoxed"><tr><td><blockquote class="SubFlow"><div class="RBackgroundLabel SIEHidden"><div class="RBackgroundLabelInner"><p>procedure</p></div></div><p class="RForeground"><span class="RktPn">(</span><a name="(def._((lib._web-server/http/bindings..rkt)._request-bindings))"></a><span title="Provided from: web-server/http/bindings | Package: web-server-lib"><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=continue&rel=index.html%23%2528def._%2528%2528lib._web-server%252Fservlet..rkt%2529._request-bindings%2529%2529&version=6.1" class="RktValDef Sq RktValLink" data-pltdoc="x">request-bindings</a></span></span><span class="hspace"> </span><span class="RktVar">req</span><span class="RktPn">)</span></p></blockquote></td></tr><tr><td><table cellspacing="0" cellpadding="0" class="prototype"><tr><td><span class="hspace"> </span></td><td>→</td><td><span class="hspace"> </span></td><td><table cellspacing="0" cellpadding="0" class="RktBlk"><tr><td><span class="RktPn">(</span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=data-structure-contracts.html%23%2528def._%2528%2528lib._racket%252Fcontract%252Fprivate%252Fmisc..rkt%2529._listof%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">listof</a></span><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=data-structure-contracts.html%23%2528def._%2528%2528lib._racket%252Fcontract%252Fbase..rkt%2529._or%252Fc%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">or/c</a></span><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=data-structure-contracts.html%23%2528def._%2528%2528lib._racket%252Fcontract%252Fprivate%252Fmisc..rkt%2529._cons%252Fc%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">cons/c</a></span><span class="hspace"> </span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=symbols.html%23%2528def._%2528%2528quote._%7E23%7E25kernel%2529._symbol%7E3f%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">symbol?</a></span><span class="hspace"> </span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=strings.html%23%2528def._%2528%2528quote._%7E23%7E25kernel%2529._string%7E3f%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">string?</a></span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=data-structure-contracts.html%23%2528def._%2528%2528lib._racket%252Fcontract%252Fprivate%252Fmisc..rkt%2529._cons%252Fc%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">cons/c</a></span><span class="hspace"> </span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=symbols.html%23%2528def._%2528%2528quote._%7E23%7E25kernel%2529._symbol%7E3f%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">symbol?</a></span><span class="hspace"> </span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=bytestrings.html%23%2528def._%2528%2528quote._%7E23%7E25kernel%2529._bytes%7E3f%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">bytes?</a></span><span class="RktPn">)</span><span class="RktPn">)</span><span class="RktPn">)</span></td></tr></table></td></tr></table></td></tr><tr><td><span class="hspace"> </span><span class="RktVar">req</span><span class="hspace"> </span>:<span class="hspace"> </span><span class="RktSym"><a href="#%28def._%28%28lib._web-server%2Fhttp%2Frequest-structs..rkt%29._request~3f%29%29" class="RktValLink" data-pltdoc="x">request?</a></span></td></tr></table></blockquote></div><div class="SIntrapara">Translates the <span class="RktSym"><a href="#%28def._%28%28lib._web-server%2Fhttp%2Frequest-structs..rkt%29._request-bindings%2Fraw%29%29" class="RktValLink" data-pltdoc="x">request-bindings/raw</a></span> of <span class="RktVar">req</span> by
interpreting <span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=bytestrings.html%23%2528def._%2528%2528quote._%7E23%7E25kernel%2529._bytes%7E3f%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">bytes?</a></span> as <span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=strings.html%23%2528def._%2528%2528quote._%7E23%7E25kernel%2529._string%7E3f%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">string?</a></span>s, except in the case
of <span class="RktSym"><a href="#%28def._%28%28lib._web-server%2Fhttp%2Frequest-structs..rkt%29._binding~3afile%29%29" class="RktValLink" data-pltdoc="x">binding:file</a></span> bindings, which are left as is. Ids are then
translated into lowercase symbols.</div></p></div><div class="SIntrapara"><p><div class="SIntrapara"><blockquote class="SVInsetFlow"><table cellspacing="0" cellpadding="0" class="boxed RBoxed"><tr><td><blockquote class="SubFlow"><div class="RBackgroundLabel SIEHidden"><div class="RBackgroundLabelInner"><p>procedure</p></div></div><p class="RForeground"><span class="RktPn">(</span><a name="(def._((lib._web-server/http/bindings..rkt)._request-headers))"></a><span title="Provided from: web-server/http/bindings | Package: web-server-lib"><span class="RktSym"><a href="#%28def._%28%28lib._web-server%2Fhttp%2Fbindings..rkt%29._request-headers%29%29" class="RktValDef RktValLink" data-pltdoc="x">request-headers</a></span></span><span class="hspace"> </span><span class="RktVar">req</span><span class="RktPn">)</span><span class="hspace"> </span>→<span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=data-structure-contracts.html%23%2528def._%2528%2528lib._racket%252Fcontract%252Fprivate%252Fmisc..rkt%2529._listof%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">listof</a></span><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=data-structure-contracts.html%23%2528def._%2528%2528lib._racket%252Fcontract%252Fprivate%252Fmisc..rkt%2529._cons%252Fc%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">cons/c</a></span><span class="hspace"> </span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=symbols.html%23%2528def._%2528%2528quote._%7E23%7E25kernel%2529._symbol%7E3f%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">symbol?</a></span><span class="hspace"> </span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=strings.html%23%2528def._%2528%2528quote._%7E23%7E25kernel%2529._string%7E3f%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">string?</a></span><span class="RktPn">)</span><span class="RktPn">)</span></p></blockquote></td></tr><tr><td><span class="hspace"> </span><span class="RktVar">req</span><span class="hspace"> </span>:<span class="hspace"> </span><span class="RktSym"><a href="#%28def._%28%28lib._web-server%2Fhttp%2Frequest-structs..rkt%29._request~3f%29%29" class="RktValLink" data-pltdoc="x">request?</a></span></td></tr></table></blockquote></div><div class="SIntrapara">Translates the <span class="RktSym"><a href="#%28def._%28%28lib._web-server%2Fhttp%2Frequest-structs..rkt%29._request-headers%2Fraw%29%29" class="RktValLink" data-pltdoc="x">request-headers/raw</a></span> of <span class="RktVar">req</span> by
interpreting <span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=bytestrings.html%23%2528def._%2528%2528quote._%7E23%7E25kernel%2529._bytes%7E3f%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">bytes?</a></span> as <span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=strings.html%23%2528def._%2528%2528quote._%7E23%7E25kernel%2529._string%7E3f%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">string?</a></span>s. Ids are then
translated into lowercase symbols.</div></p></div><div class="SIntrapara"><p><div class="SIntrapara"><blockquote class="SVInsetFlow"><table cellspacing="0" cellpadding="0" class="boxed RBoxed"><tr><td><blockquote class="SubFlow"><div class="RBackgroundLabel SIEHidden"><div class="RBackgroundLabelInner"><p>procedure</p></div></div><p class="RForeground"><span class="RktPn">(</span><a name="(def._((lib._web-server/http/bindings..rkt)._extract-binding/single))"></a><span title="Provided from: web-server/http/bindings | Package: web-server-lib"><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=continue&rel=index.html%23%2528def._%2528%2528lib._web-server%252Fservlet..rkt%2529._extract-binding%252Fsingle%2529%2529&version=6.1" class="RktValDef Sq RktValLink" data-pltdoc="x">extract-binding/single</a></span></span><span class="hspace"> </span><span class="RktVar">id</span><span class="hspace"> </span><span class="RktVar">binds</span><span class="RktPn">)</span><span class="hspace"> </span>→<span class="hspace"> </span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=strings.html%23%2528def._%2528%2528quote._%7E23%7E25kernel%2529._string%7E3f%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">string?</a></span></p></blockquote></td></tr><tr><td><span class="hspace"> </span><span class="RktVar">id</span><span class="hspace"> </span>:<span class="hspace"> </span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=symbols.html%23%2528def._%2528%2528quote._%7E23%7E25kernel%2529._symbol%7E3f%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">symbol?</a></span></td></tr><tr><td><span class="hspace"> </span><span class="RktVar">binds</span><span class="hspace"> </span>:<span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=data-structure-contracts.html%23%2528def._%2528%2528lib._racket%252Fcontract%252Fprivate%252Fmisc..rkt%2529._listof%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">listof</a></span><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=data-structure-contracts.html%23%2528def._%2528%2528lib._racket%252Fcontract%252Fprivate%252Fmisc..rkt%2529._cons%252Fc%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">cons/c</a></span><span class="hspace"> </span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=symbols.html%23%2528def._%2528%2528quote._%7E23%7E25kernel%2529._symbol%7E3f%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">symbol?</a></span><span class="hspace"> </span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=strings.html%23%2528def._%2528%2528quote._%7E23%7E25kernel%2529._string%7E3f%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">string?</a></span><span class="RktPn">)</span><span class="RktPn">)</span></td></tr></table></blockquote></div><div class="SIntrapara">Returns the single binding associated with <span class="RktVar">id</span> in the a-list <span class="RktVar">binds</span>
if there is exactly one binding. Otherwise raises <span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=exns.html%23%2528def._%2528%2528lib._racket%252Fprivate%252Fbase..rkt%2529._exn%7E3afail%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">exn:fail</a></span>.</div></p></div><div class="SIntrapara"><p><div class="SIntrapara"><blockquote class="SVInsetFlow"><table cellspacing="0" cellpadding="0" class="boxed RBoxed"><tr><td><blockquote class="SubFlow"><div class="RBackgroundLabel SIEHidden"><div class="RBackgroundLabelInner"><p>procedure</p></div></div><p class="RForeground"><span class="RktPn">(</span><a name="(def._((lib._web-server/http/bindings..rkt)._extract-bindings))"></a><span title="Provided from: web-server/http/bindings | Package: web-server-lib"><span class="RktSym"><a href="#%28def._%28%28lib._web-server%2Fhttp%2Fbindings..rkt%29._extract-bindings%29%29" class="RktValDef RktValLink" data-pltdoc="x">extract-bindings</a></span></span><span class="hspace"> </span><span class="RktVar">id</span><span class="hspace"> </span><span class="RktVar">binds</span><span class="RktPn">)</span><span class="hspace"> </span>→<span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=data-structure-contracts.html%23%2528def._%2528%2528lib._racket%252Fcontract%252Fprivate%252Fmisc..rkt%2529._listof%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">listof</a></span><span class="hspace"> </span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=strings.html%23%2528def._%2528%2528quote._%7E23%7E25kernel%2529._string%7E3f%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">string?</a></span><span class="RktPn">)</span></p></blockquote></td></tr><tr><td><span class="hspace"> </span><span class="RktVar">id</span><span class="hspace"> </span>:<span class="hspace"> </span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=symbols.html%23%2528def._%2528%2528quote._%7E23%7E25kernel%2529._symbol%7E3f%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">symbol?</a></span></td></tr><tr><td><span class="hspace"> </span><span class="RktVar">binds</span><span class="hspace"> </span>:<span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=data-structure-contracts.html%23%2528def._%2528%2528lib._racket%252Fcontract%252Fprivate%252Fmisc..rkt%2529._listof%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">listof</a></span><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=data-structure-contracts.html%23%2528def._%2528%2528lib._racket%252Fcontract%252Fprivate%252Fmisc..rkt%2529._cons%252Fc%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">cons/c</a></span><span class="hspace"> </span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=symbols.html%23%2528def._%2528%2528quote._%7E23%7E25kernel%2529._symbol%7E3f%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">symbol?</a></span><span class="hspace"> </span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=strings.html%23%2528def._%2528%2528quote._%7E23%7E25kernel%2529._string%7E3f%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">string?</a></span><span class="RktPn">)</span><span class="RktPn">)</span></td></tr></table></blockquote></div><div class="SIntrapara">Returns a list of all the bindings of <span class="RktVar">id</span> in the a-list <span class="RktVar">binds</span>.</div></p></div><div class="SIntrapara"><p><div class="SIntrapara"><blockquote class="SVInsetFlow"><table cellspacing="0" cellpadding="0" class="boxed RBoxed"><tr><td><blockquote class="SubFlow"><div class="RBackgroundLabel SIEHidden"><div class="RBackgroundLabelInner"><p>procedure</p></div></div><p class="RForeground"><span class="RktPn">(</span><a name="(def._((lib._web-server/http/bindings..rkt)._exists-binding~3f))"></a><span title="Provided from: web-server/http/bindings | Package: web-server-lib"><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=continue&rel=index.html%23%2528def._%2528%2528lib._web-server%252Fservlet..rkt%2529._exists-binding%7E3f%2529%2529&version=6.1" class="RktValDef Sq RktValLink" data-pltdoc="x">exists-binding?</a></span></span><span class="hspace"> </span><span class="RktVar">id</span><span class="hspace"> </span><span class="RktVar">binds</span><span class="RktPn">)</span><span class="hspace"> </span>→<span class="hspace"> </span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=booleans.html%23%2528def._%2528%2528quote._%7E23%7E25kernel%2529._boolean%7E3f%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">boolean?</a></span></p></blockquote></td></tr><tr><td><span class="hspace"> </span><span class="RktVar">id</span><span class="hspace"> </span>:<span class="hspace"> </span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=symbols.html%23%2528def._%2528%2528quote._%7E23%7E25kernel%2529._symbol%7E3f%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">symbol?</a></span></td></tr><tr><td><span class="hspace"> </span><span class="RktVar">binds</span><span class="hspace"> </span>:<span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=data-structure-contracts.html%23%2528def._%2528%2528lib._racket%252Fcontract%252Fprivate%252Fmisc..rkt%2529._listof%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">listof</a></span><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=data-structure-contracts.html%23%2528def._%2528%2528lib._racket%252Fcontract%252Fprivate%252Fmisc..rkt%2529._cons%252Fc%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">cons/c</a></span><span class="hspace"> </span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=symbols.html%23%2528def._%2528%2528quote._%7E23%7E25kernel%2529._symbol%7E3f%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">symbol?</a></span><span class="hspace"> </span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=strings.html%23%2528def._%2528%2528quote._%7E23%7E25kernel%2529._string%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">string</a></span><span class="RktPn">)</span><span class="RktPn">)</span></td></tr></table></blockquote></div><div class="SIntrapara">Returns <span class="RktVal">#t</span> if <span class="RktVar">binds</span> contains a binding for <span class="RktVar">id</span>.
Otherwise, <span class="RktVal">#f</span>.</div></p></div><div class="SIntrapara"><p><div class="SIntrapara">Here is an example typical of what you will find in many applications:
</div><div class="SIntrapara"><blockquote class="SCodeFlow"><table cellspacing="0" cellpadding="0" class="RktBlk"><tr><td><span class="RktPn">(</span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=define.html%23%2528form._%2528%2528lib._racket%252Fprivate%252Fbase..rkt%2529._define%2529%2529&version=6.1" class="RktStxLink Sq" data-pltdoc="x">define</a></span><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym">get-number</span><span class="hspace"> </span><span class="RktSym">req</span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=generic-numbers.html%23%2528def._%2528%2528quote._%7E23%7E25kernel%2529._string-%7E3enumber%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">string->number</a></span></td></tr><tr><td><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=continue&rel=index.html%23%2528def._%2528%2528lib._web-server%252Fservlet..rkt%2529._extract-binding%252Fsingle%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">extract-binding/single</a></span></td></tr><tr><td><span class="hspace"> </span><span class="RktVal">'</span><span class="RktVal">number</span></td></tr><tr><td><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=continue&rel=index.html%23%2528def._%2528%2528lib._web-server%252Fservlet..rkt%2529._request-bindings%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">request-bindings</a></span><span class="hspace"> </span><span class="RktSym">req</span><span class="RktPn">)</span><span class="RktPn">)</span><span class="RktPn">)</span><span class="RktPn">)</span></td></tr></table></blockquote></div></p></div></p><h4 x-source-module="(lib "web-server/scribblings/web-server.scrbl")" x-part-tag=""response-structs"">4.3<tt> </tt><a name="(part._response-structs)"></a><a name="(mod-path._web-server/http/response-structs)"></a>Responses</h4><p><div class="SIntrapara"><table cellspacing="0" cellpadding="0" class="defmodule"><tr><td align="left" colspan="2"><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=require.html%23%2528form._%2528%2528lib._racket%252Fprivate%252Fbase..rkt%2529._require%2529%2529&version=6.1" class="RktStxLink Sq" data-pltdoc="x">require</a></span><span class="stt"> </span><a href="#%28mod-path._web-server%2Fhttp%2Fresponse-structs%29" class="RktModLink" data-pltdoc="x"><span class="RktSym">web-server/http/response-structs</span></a><span class="RktPn">)</span></td></tr><tr><td align="left"> </td><td align="right"><span class="RpackageSpec"><span class="Smaller"> package:</span> <span class="stt">web-server-lib</span></span></td></tr></table></div><div class="SIntrapara"><p><div class="SIntrapara"><blockquote class="SVInsetFlow"><table cellspacing="0" cellpadding="0" class="boxed RBoxed"><tr><td><blockquote class="SubFlow"><div class="RBackgroundLabel SIEHidden"><div class="RBackgroundLabelInner"><p>struct</p></div></div><p class="RForeground"><span class="RktPn">(</span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=define-struct.html%23%2528form._%2528%2528lib._racket%252Fprivate%252Fbase..rkt%2529._struct%2529%2529&version=6.1" class="RktStxLink Sq" data-pltdoc="x">struct</a></span><span class="stt"> </span><a name="(def._((lib._web-server/http/response-structs..rkt)._response-output))"></a><a name="(def._((lib._web-server/http/response-structs..rkt)._response-headers))"></a><a name="(def._((lib._web-server/http/response-structs..rkt)._response-mime))"></a><a name="(def._((lib._web-server/http/response-structs..rkt)._response-seconds))"></a><a name="(def._((lib._web-server/http/response-structs..rkt)._response-message))"></a><a name="(def._((lib._web-server/http/response-structs..rkt)._response-code))"></a><a name="(def._((lib._web-server/http/response-structs..rkt)._response~3f))"></a><a name="(def._((lib._web-server/http/response-structs..rkt)._struct~3aresponse))"></a><a name="(def._((lib._web-server/http/response-structs..rkt)._response))"></a><span title="Provided from: web-server/http/response-structs | Package: web-server-lib"><span class="RktSym"><a href="#%28def._%28%28lib._web-server%2Fhttp%2Fresponse-structs..rkt%29._response%29%29" class="RktValDef RktValLink" data-pltdoc="x">response</a></span></span><span class="stt"> </span><span class="RktPn">(</span><span class="RktSym">code</span><span class="stt"> </span><span class="RktSym">message</span><span class="stt"> </span><span class="RktSym">seconds</span><span class="stt"> </span><span class="RktSym">mime</span><span class="stt"> </span><span class="RktSym">headers</span><span class="stt"> </span><span class="RktSym">output</span><span class="RktPn">)</span><span class="RktPn">)</span></p></blockquote></td></tr><tr><td><span class="hspace"> </span><span class="RktSym">code</span><span class="hspace"> </span>:<span class="hspace"> </span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=number-types.html%23%2528def._%2528%2528quote._%7E23%7E25kernel%2529._number%7E3f%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">number?</a></span></td></tr><tr><td><span class="hspace"> </span><span class="RktSym">message</span><span class="hspace"> </span>:<span class="hspace"> </span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=bytestrings.html%23%2528def._%2528%2528quote._%7E23%7E25kernel%2529._bytes%7E3f%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">bytes?</a></span></td></tr><tr><td><span class="hspace"> </span><span class="RktSym">seconds</span><span class="hspace"> </span>:<span class="hspace"> </span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=number-types.html%23%2528def._%2528%2528quote._%7E23%7E25kernel%2529._number%7E3f%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">number?</a></span></td></tr><tr><td><span class="hspace"> </span><span class="RktSym">mime</span><span class="hspace"> </span>:<span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=data-structure-contracts.html%23%2528def._%2528%2528lib._racket%252Fcontract%252Fbase..rkt%2529._or%252Fc%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">or/c</a></span><span class="hspace"> </span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=data-structure-contracts.html%23%2528def._%2528%2528lib._racket%252Fcontract%252Fprivate%252Fmisc..rkt%2529._false%252Fc%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">false/c</a></span><span class="hspace"> </span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=bytestrings.html%23%2528def._%2528%2528quote._%7E23%7E25kernel%2529._bytes%7E3f%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">bytes?</a></span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace"> </span><span class="RktSym">headers</span><span class="hspace"> </span>:<span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=data-structure-contracts.html%23%2528def._%2528%2528lib._racket%252Fcontract%252Fprivate%252Fmisc..rkt%2529._listof%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">listof</a></span><span class="hspace"> </span><span class="RktSym"><a href="#%28def._%28%28lib._web-server%2Fhttp%2Frequest-structs..rkt%29._header~3f%29%29" class="RktValLink" data-pltdoc="x">header?</a></span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace"> </span><span class="RktSym">output</span><span class="hspace"> </span>:<span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=port-ops.html%23%2528def._%2528%2528quote._%7E23%7E25kernel%2529._output-port%7E3f%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">output-port?</a></span><span class="hspace"> </span><span class="RktPn">. </span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=function-contracts.html%23%2528form._%2528%2528lib._racket%252Fcontract%252Fbase..rkt%2529._-%7E3e%2529%2529&version=6.1" class="RktStxLink Sq" data-pltdoc="x"><span class="nobreak">-></span></a></span><span class="RktPn"> .</span><span class="hspace"> </span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=void.html%23%2528def._%2528%2528quote._%7E23%7E25kernel%2529._void%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">void</a></span><span class="RktPn">)</span></td></tr></table></blockquote></div><div class="SIntrapara">An HTTP response where <span class="RktSym">output</span> produces the body by writing to
the output port. <span class="RktSym">code</span> is the response code, <span class="RktSym">message</span>
the message, <span class="RktSym">seconds</span> the generation time, <span class="RktSym">mime</span> the
MIME type of the file, and <span class="RktSym">headers</span> are the headers.</div></p></div><div class="SIntrapara">If <span class="RktSym">headers</span> does not include <span class="RktInBG"><span class="hspace"></span><span class="RktIn">Date</span><span class="hspace"></span></span>,
<span class="RktInBG"><span class="hspace"></span><span class="RktIn">Last-Modified</span><span class="hspace"></span></span>, or <span class="RktInBG"><span class="hspace"></span><span class="RktIn">Server</span><span class="hspace"></span></span> headers, then the server
will automatically add them, where <span class="RktInBG"><span class="hspace"></span><span class="RktIn">Date</span><span class="hspace"></span></span> is based on
<span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=time.html%23%2528def._%2528%2528quote._%7E23%7E25kernel%2529._current-seconds%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">current-seconds</a></span>, <span class="RktInBG"><span class="hspace"></span><span class="RktIn">Last-Modified</span><span class="hspace"></span></span> is based on
<span class="RktSym">seconds</span>, and <span class="RktInBG"><span class="hspace"></span><span class="RktIn">Server</span><span class="hspace"></span></span> is <span class="RktInBG"><span class="hspace"></span><span class="RktIn">Racket</span><span class="hspace"></span></span>.</div><div class="SIntrapara">If <span class="RktSym">headers</span> does not include <span class="RktInBG"><span class="hspace"></span><span class="RktIn">Content-Type</span><span class="hspace"></span></span> and
<span class="RktSym">mime</span> is not <span class="RktVal">#f</span>, then <span class="RktSym">mime</span> is added as a
<span class="RktInBG"><span class="hspace"></span><span class="RktIn">Content-Type</span><span class="hspace"></span></span> header.</div><div class="SIntrapara">The server will always replace your <span class="RktInBG"><span class="hspace"></span><span class="RktIn">Connection</span><span class="hspace"></span></span> header if it
needs to ensure the connection will be closed. (Typically with an
HTTP/1.0 client.)</div><div class="SIntrapara"><p><div class="SIntrapara">Examples:
</div><div class="SIntrapara"><blockquote class="SCodeFlow"><table cellspacing="0" cellpadding="0" class="RktBlk"><tr><td><span class="RktPn">(</span><span class="RktSym"><a href="#%28def._%28%28lib._web-server%2Fhttp%2Fresponse-structs..rkt%29._response%29%29" class="RktValLink" data-pltdoc="x">response</a></span></td></tr><tr><td><span class="hspace"> </span><span class="RktVal">301</span><span class="hspace"> </span><span class="RktVal">#"OK"</span></td></tr><tr><td><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=time.html%23%2528def._%2528%2528quote._%7E23%7E25kernel%2529._current-seconds%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">current-seconds</a></span><span class="RktPn">)</span><span class="hspace"> </span><span class="RktSym"><a href="#%28def._%28%28lib._web-server%2Fhttp%2Fresponse-structs..rkt%29._.T.E.X.T%2F.H.T.M.L-.M.I.M.E-.T.Y.P.E%29%29" class="RktValLink" data-pltdoc="x">TEXT/HTML-MIME-TYPE</a></span></td></tr><tr><td><span class="hspace"> </span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=pairs.html%23%2528def._%2528%2528lib._racket%252Flist..rkt%2529._empty%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">empty</a></span></td></tr><tr><td><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=lambda.html%23%2528form._%2528%2528lib._racket%252Fprivate%252Fbase..rkt%2529._%7Ece%7Ebb%2529%2529&version=6.1" class="RktStxLink Sq" data-pltdoc="x">λ</a></span><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym">op</span><span class="RktPn">)</span><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=Byte_and_String_Output.html%23%2528def._%2528%2528quote._%7E23%7E25kernel%2529._write-bytes%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">write-bytes</a></span><span class="hspace"> </span><span class="RktVal">#"<html><body>Hello, World!</body></html>"</span><span class="hspace"> </span><span class="RktSym">op</span><span class="RktPn">)</span><span class="RktPn">)</span><span class="RktPn">)</span></td></tr><tr><td><span class="RktPn">(</span><span class="RktSym"><a href="#%28def._%28%28lib._web-server%2Fhttp%2Fresponse-structs..rkt%29._response%29%29" class="RktValLink" data-pltdoc="x">response</a></span></td></tr><tr><td><span class="hspace"> </span><span class="RktVal">301</span><span class="hspace"> </span><span class="RktVal">#"Moved Permanently"</span></td></tr><tr><td><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=time.html%23%2528def._%2528%2528quote._%7E23%7E25kernel%2529._current-seconds%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">current-seconds</a></span><span class="RktPn">)</span><span class="hspace"> </span><span class="RktSym"><a href="#%28def._%28%28lib._web-server%2Fhttp%2Fresponse-structs..rkt%29._.T.E.X.T%2F.H.T.M.L-.M.I.M.E-.T.Y.P.E%29%29" class="RktValLink" data-pltdoc="x">TEXT/HTML-MIME-TYPE</a></span></td></tr><tr><td><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=pairs.html%23%2528def._%2528%2528quote._%7E23%7E25kernel%2529._list%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">list</a></span><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="#%28def._%28%28lib._web-server%2Fhttp%2Frequest-structs..rkt%29._make-header%29%29" class="RktValLink" data-pltdoc="x">make-header</a></span><span class="hspace"> </span><span class="RktVal">#"Location"</span></td></tr><tr><td><span class="hspace"> </span><span class="RktVal">#"http://racket-lang.org/download"</span><span class="RktPn">)</span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=lambda.html%23%2528form._%2528%2528lib._racket%252Fprivate%252Fbase..rkt%2529._%7Ece%7Ebb%2529%2529&version=6.1" class="RktStxLink Sq" data-pltdoc="x">λ</a></span><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym">op</span><span class="RktPn">)</span><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=Byte_and_String_Output.html%23%2528def._%2528%2528quote._%7E23%7E25kernel%2529._write-bytes%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">write-bytes</a></span><span class="hspace"> </span><span class="RktVal">#"Moved"</span><span class="hspace"> </span><span class="RktSym">op</span><span class="RktPn">)</span><span class="RktPn">)</span><span class="RktPn">)</span></td></tr><tr><td><span class="RktPn">(</span><span class="RktSym"><a href="#%28def._%28%28lib._web-server%2Fhttp%2Fresponse-structs..rkt%29._response%29%29" class="RktValLink" data-pltdoc="x">response</a></span></td></tr><tr><td><span class="hspace"> </span><span class="RktVal">304</span><span class="hspace"> </span><span class="RktVal">#"Not Modified"</span></td></tr><tr><td><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=time.html%23%2528def._%2528%2528quote._%7E23%7E25kernel%2529._current-seconds%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">current-seconds</a></span><span class="RktPn">)</span><span class="hspace"> </span><span class="RktVal">#f</span></td></tr><tr><td><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=pairs.html%23%2528def._%2528%2528quote._%7E23%7E25kernel%2529._list%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">list</a></span><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="#%28def._%28%28lib._web-server%2Fhttp%2Frequest-structs..rkt%29._make-header%29%29" class="RktValLink" data-pltdoc="x">make-header</a></span><span class="hspace"> </span><span class="RktVal">#"Location"</span></td></tr><tr><td><span class="hspace"> </span><span class="RktVal">#"http://racket-lang.org/download"</span><span class="RktPn">)</span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace"> </span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=void.html%23%2528def._%2528%2528quote._%7E23%7E25kernel%2529._void%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">void</a></span><span class="RktPn">)</span></td></tr></table></blockquote></div></p></div><div class="SIntrapara"><p><div class="SIntrapara"><blockquote class="SVInsetFlow"><table cellspacing="0" cellpadding="0" class="boxed RBoxed"><tr><td><blockquote class="SubFlow"><div class="RBackgroundLabel SIEHidden"><div class="RBackgroundLabelInner"><p>procedure</p></div></div><table cellspacing="0" cellpadding="0" class="prototype RForeground"><tr><td><span class="RktPn">(</span><a name="(def._((lib._web-server/http/response-structs..rkt)._response/full))"></a><span title="Provided from: web-server/http/response-structs | Package: web-server-lib"><span class="RktSym"><a href="#%28def._%28%28lib._web-server%2Fhttp%2Fresponse-structs..rkt%29._response%2Ffull%29%29" class="RktValDef RktValLink" data-pltdoc="x">response/full</a></span></span></td><td><span class="hspace"> </span></td><td><span class="RktVar">code</span></td><td><span class="hspace"> </span></td><td><span class="hspace"> </span></td><td><span class="hspace"> </span></td><td><span class="hspace"> </span></td></tr><tr><td><span class="hspace"> </span></td><td><span class="hspace"> </span></td><td><span class="RktVar">message</span></td><td><span class="hspace"> </span></td><td><span class="hspace"> </span></td><td><span class="hspace"> </span></td><td><span class="hspace"> </span></td></tr><tr><td><span class="hspace"> </span></td><td><span class="hspace"> </span></td><td><span class="RktVar">seconds</span></td><td><span class="hspace"> </span></td><td><span class="hspace"> </span></td><td><span class="hspace"> </span></td><td><span class="hspace"> </span></td></tr><tr><td><span class="hspace"> </span></td><td><span class="hspace"> </span></td><td><span class="RktVar">mime</span></td><td><span class="hspace"> </span></td><td><span class="hspace"> </span></td><td><span class="hspace"> </span></td><td><span class="hspace"> </span></td></tr><tr><td><span class="hspace"> </span></td><td><span class="hspace"> </span></td><td><span class="RktVar">headers</span></td><td><span class="hspace"> </span></td><td><span class="hspace"> </span></td><td><span class="hspace"> </span></td><td><span class="hspace"> </span></td></tr><tr><td><span class="hspace"> </span></td><td><span class="hspace"> </span></td><td><span class="RktVar">body</span><span class="RktPn">)</span></td><td><span class="hspace"> </span></td><td>→</td><td><span class="hspace"> </span></td><td><span class="RktSym"><a href="#%28def._%28%28lib._web-server%2Fhttp%2Fresponse-structs..rkt%29._response~3f%29%29" class="RktValLink" data-pltdoc="x">response?</a></span></td></tr></table></blockquote></td></tr><tr><td><span class="hspace"> </span><span class="RktVar">code</span><span class="hspace"> </span>:<span class="hspace"> </span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=number-types.html%23%2528def._%2528%2528quote._%7E23%7E25kernel%2529._number%7E3f%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">number?</a></span></td></tr><tr><td><span class="hspace"> </span><span class="RktVar">message</span><span class="hspace"> </span>:<span class="hspace"> </span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=bytestrings.html%23%2528def._%2528%2528quote._%7E23%7E25kernel%2529._bytes%7E3f%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">bytes?</a></span></td></tr><tr><td><span class="hspace"> </span><span class="RktVar">seconds</span><span class="hspace"> </span>:<span class="hspace"> </span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=number-types.html%23%2528def._%2528%2528quote._%7E23%7E25kernel%2529._number%7E3f%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">number?</a></span></td></tr><tr><td><span class="hspace"> </span><span class="RktVar">mime</span><span class="hspace"> </span>:<span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=data-structure-contracts.html%23%2528def._%2528%2528lib._racket%252Fcontract%252Fbase..rkt%2529._or%252Fc%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">or/c</a></span><span class="hspace"> </span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=data-structure-contracts.html%23%2528def._%2528%2528lib._racket%252Fcontract%252Fprivate%252Fmisc..rkt%2529._false%252Fc%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">false/c</a></span><span class="hspace"> </span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=bytestrings.html%23%2528def._%2528%2528quote._%7E23%7E25kernel%2529._bytes%7E3f%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">bytes?</a></span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace"> </span><span class="RktVar">headers</span><span class="hspace"> </span>:<span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=data-structure-contracts.html%23%2528def._%2528%2528lib._racket%252Fcontract%252Fprivate%252Fmisc..rkt%2529._listof%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">listof</a></span><span class="hspace"> </span><span class="RktSym"><a href="#%28def._%28%28lib._web-server%2Fhttp%2Frequest-structs..rkt%29._header~3f%29%29" class="RktValLink" data-pltdoc="x">header?</a></span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace"> </span><span class="RktVar">body</span><span class="hspace"> </span>:<span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=data-structure-contracts.html%23%2528def._%2528%2528lib._racket%252Fcontract%252Fprivate%252Fmisc..rkt%2529._listof%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">listof</a></span><span class="hspace"> </span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=bytestrings.html%23%2528def._%2528%2528quote._%7E23%7E25kernel%2529._bytes%7E3f%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">bytes?</a></span><span class="RktPn">)</span></td></tr></table></blockquote></div><div class="SIntrapara">A constructor for responses where <span class="RktVar">body</span> is the response body.</div></p></div><div class="SIntrapara"><p><div class="SIntrapara">Example:
</div><div class="SIntrapara"><blockquote class="SCodeFlow"><table cellspacing="0" cellpadding="0" class="RktBlk"><tr><td><span class="RktPn">(</span><span class="RktSym"><a href="#%28def._%28%28lib._web-server%2Fhttp%2Fresponse-structs..rkt%29._response%2Ffull%29%29" class="RktValLink" data-pltdoc="x">response/full</a></span></td></tr><tr><td><span class="hspace"> </span><span class="RktVal">301</span><span class="hspace"> </span><span class="RktVal">#"Moved Permanently"</span></td></tr><tr><td><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=time.html%23%2528def._%2528%2528quote._%7E23%7E25kernel%2529._current-seconds%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">current-seconds</a></span><span class="RktPn">)</span><span class="hspace"> </span><span class="RktSym"><a href="#%28def._%28%28lib._web-server%2Fhttp%2Fresponse-structs..rkt%29._.T.E.X.T%2F.H.T.M.L-.M.I.M.E-.T.Y.P.E%29%29" class="RktValLink" data-pltdoc="x">TEXT/HTML-MIME-TYPE</a></span></td></tr><tr><td><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=pairs.html%23%2528def._%2528%2528quote._%7E23%7E25kernel%2529._list%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">list</a></span><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="#%28def._%28%28lib._web-server%2Fhttp%2Frequest-structs..rkt%29._make-header%29%29" class="RktValLink" data-pltdoc="x">make-header</a></span><span class="hspace"> </span><span class="RktVal">#"Location"</span></td></tr><tr><td><span class="hspace"> </span><span class="RktVal">#"http://racket-lang.org/download"</span><span class="RktPn">)</span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=pairs.html%23%2528def._%2528%2528quote._%7E23%7E25kernel%2529._list%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">list</a></span><span class="hspace"> </span><span class="RktVal">#"<html><body><p>"</span></td></tr><tr><td><span class="hspace"> </span><span class="RktVal">#"Please go to <a href=\""</span></td></tr><tr><td><span class="hspace"> </span><span class="RktVal">#"http://racket-lang.org/download"</span></td></tr><tr><td><span class="hspace"> </span><span class="RktVal">#"\">here</a> instead."</span></td></tr><tr><td><span class="hspace"> </span><span class="RktVal">#"</p></body></html>"</span><span class="RktPn">)</span><span class="RktPn">)</span></td></tr></table></blockquote></div></p></div><div class="SIntrapara"><p><div class="SIntrapara"><blockquote class="SVInsetFlow"><table cellspacing="0" cellpadding="0" class="boxed RBoxed"><tr><td><blockquote class="SubFlow"><div class="RBackgroundLabel SIEHidden"><div class="RBackgroundLabelInner"><p>procedure</p></div></div><table cellspacing="0" cellpadding="0" class="prototype RForeground"><tr><td><span class="RktPn">(</span><a name="(def._((lib._web-server/http/response-structs..rkt)._response/output))"></a><span title="Provided from: web-server/http/response-structs | Package: web-server-lib"><span class="RktSym"><a href="#%28def._%28%28lib._web-server%2Fhttp%2Fresponse-structs..rkt%29._response%2Foutput%29%29" class="RktValDef RktValLink" data-pltdoc="x">response/output</a></span></span></td><td><span class="hspace"> </span></td><td><span class="RktVar">output</span></td><td><span class="hspace"> </span></td><td><span class="hspace"> </span></td><td><span class="hspace"> </span></td><td><span class="hspace"> </span></td></tr><tr><td><span class="hspace"> </span></td><td><span class="hspace"> </span>[</td><td><span class="RktPn">#:code</span><span class="hspace"> </span><span class="RktVar">code</span></td><td><span class="hspace"> </span></td><td><span class="hspace"> </span></td><td><span class="hspace"> </span></td><td><span class="hspace"> </span></td></tr><tr><td><span class="hspace"> </span></td><td><span class="hspace"> </span></td><td><span class="RktPn">#:message</span><span class="hspace"> </span><span class="RktVar">message</span></td><td><span class="hspace"> </span></td><td><span class="hspace"> </span></td><td><span class="hspace"> </span></td><td><span class="hspace"> </span></td></tr><tr><td><span class="hspace"> </span></td><td><span class="hspace"> </span></td><td><span class="RktPn">#:seconds</span><span class="hspace"> </span><span class="RktVar">seconds</span></td><td><span class="hspace"> </span></td><td><span class="hspace"> </span></td><td><span class="hspace"> </span></td><td><span class="hspace"> </span></td></tr><tr><td><span class="hspace"> </span></td><td><span class="hspace"> </span></td><td><span class="RktPn">#:mime-type</span><span class="hspace"> </span><span class="RktVar">mime-type</span></td><td><span class="hspace"> </span></td><td><span class="hspace"> </span></td><td><span class="hspace"> </span></td><td><span class="hspace"> </span></td></tr><tr><td><span class="hspace"> </span></td><td><span class="hspace"> </span></td><td><span class="RktPn">#:headers</span><span class="hspace"> </span><span class="RktVar">headers</span></td><td><span class="hspace"> </span></td><td><span class="hspace"> </span></td><td><span class="hspace"> </span></td><td><span class="hspace"> </span></td></tr><tr><td><span class="hspace"> </span></td><td><span class="hspace"> </span></td><td><span class="RktPn">#:cookies</span><span class="hspace"> </span><span class="RktVar">cookies</span>]<span class="RktPn">)</span></td><td><span class="hspace"> </span></td><td>→</td><td><span class="hspace"> </span></td><td><span class="RktSym"><a href="#%28def._%28%28lib._web-server%2Fhttp%2Fresponse-structs..rkt%29._response~3f%29%29" class="RktValLink" data-pltdoc="x">response?</a></span></td></tr></table></blockquote></td></tr><tr><td><span class="hspace"> </span><span class="RktVar">output</span><span class="hspace"> </span>:<span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=function-contracts.html%23%2528form._%2528%2528lib._racket%252Fcontract%252Fbase..rkt%2529._-%7E3e%2529%2529&version=6.1" class="RktStxLink Sq" data-pltdoc="x"><span class="nobreak">-></span></a></span><span class="hspace"> </span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=port-ops.html%23%2528def._%2528%2528quote._%7E23%7E25kernel%2529._output-port%7E3f%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">output-port?</a></span><span class="hspace"> </span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=void.html%23%2528def._%2528%2528quote._%7E23%7E25kernel%2529._void%7E3f%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">void?</a></span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace"> </span><span class="RktVar">code</span><span class="hspace"> </span>:<span class="hspace"> </span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=number-types.html%23%2528def._%2528%2528quote._%7E23%7E25kernel%2529._number%7E3f%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">number?</a></span><span class="hspace"> </span>=<span class="hspace"> </span><span class="RktVal">200</span></td></tr><tr><td><span class="hspace"> </span><span class="RktVar">message</span><span class="hspace"> </span>:<span class="hspace"> </span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=bytestrings.html%23%2528def._%2528%2528quote._%7E23%7E25kernel%2529._bytes%7E3f%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">bytes?</a></span><span class="hspace"> </span>=<span class="hspace"> </span><span class="RktVal">#"Okay"</span></td></tr><tr><td><span class="hspace"> </span><span class="RktVar">seconds</span><span class="hspace"> </span>:<span class="hspace"> </span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=number-types.html%23%2528def._%2528%2528quote._%7E23%7E25kernel%2529._number%7E3f%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">number?</a></span><span class="hspace"> </span>=<span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=time.html%23%2528def._%2528%2528quote._%7E23%7E25kernel%2529._current-seconds%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">current-seconds</a></span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace"> </span><span class="RktVar">mime-type</span><span class="hspace"> </span>:<span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=data-structure-contracts.html%23%2528def._%2528%2528lib._racket%252Fcontract%252Fbase..rkt%2529._or%252Fc%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">or/c</a></span><span class="hspace"> </span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=bytestrings.html%23%2528def._%2528%2528quote._%7E23%7E25kernel%2529._bytes%7E3f%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">bytes?</a></span><span class="hspace"> </span><span class="RktVal">#f</span><span class="RktPn">)</span><span class="hspace"> </span>=<span class="hspace"> </span><span class="RktSym"><a href="#%28def._%28%28lib._web-server%2Fhttp%2Fresponse-structs..rkt%29._.T.E.X.T%2F.H.T.M.L-.M.I.M.E-.T.Y.P.E%29%29" class="RktValLink" data-pltdoc="x">TEXT/HTML-MIME-TYPE</a></span></td></tr><tr><td><span class="hspace"> </span><span class="RktVar">headers</span><span class="hspace"> </span>:<span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=data-structure-contracts.html%23%2528def._%2528%2528lib._racket%252Fcontract%252Fprivate%252Fmisc..rkt%2529._listof%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">listof</a></span><span class="hspace"> </span><span class="RktSym"><a href="#%28def._%28%28lib._web-server%2Fhttp%2Frequest-structs..rkt%29._header~3f%29%29" class="RktValLink" data-pltdoc="x">header?</a></span><span class="RktPn">)</span><span class="hspace"> </span>=<span class="hspace"> </span><span class="RktVal">'</span><span class="RktVal">(</span><span class="RktVal">)</span></td></tr><tr><td><span class="hspace"> </span><span class="RktVar">cookies</span><span class="hspace"> </span>:<span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=data-structure-contracts.html%23%2528def._%2528%2528lib._racket%252Fcontract%252Fprivate%252Fmisc..rkt%2529._listof%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">listof</a></span><span class="hspace"> </span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=net&rel=cookie.html%23%2528def._%2528%2528lib._net%252Fcookie..rkt%2529._cookie%7E3f%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">cookie?</a></span><span class="RktPn">)</span><span class="hspace"> </span>=<span class="hspace"> </span><span class="RktVal">'</span><span class="RktVal">(</span><span class="RktVal">)</span></td></tr></table></blockquote></div><div class="SIntrapara">Equivalent to
</div><div class="SIntrapara"><blockquote class="SCodeFlow"><p><span class="RktPn">(</span><span class="RktSym"><a href="#%28def._%28%28lib._web-server%2Fhttp%2Fresponse-structs..rkt%29._response%29%29" class="RktValLink" data-pltdoc="x">response</a></span><span class="hspace"> </span><span class="RktVar">code</span><span class="hspace"> </span><span class="RktVar">message</span><span class="hspace"> </span><span class="RktVar">seconds</span><span class="hspace"> </span><span class="RktVar">mime-type</span><span class="hspace"> </span><span class="RktVar">headers</span><span class="hspace"> </span><span class="RktVar">output</span><span class="RktPn">)</span></p></blockquote></div></p></div><div class="SIntrapara"><p><div class="SIntrapara"><blockquote class="SVInsetFlow"><table cellspacing="0" cellpadding="0" class="boxed RBoxed"><tr><td><blockquote class="SubFlow"><div class="RBackgroundLabel SIEHidden"><div class="RBackgroundLabelInner"><p>value</p></div></div><p class="RForeground"><a name="(def._((lib._web-server/http/response-structs..rkt)._.T.E.X.T/.H.T.M.L-.M.I.M.E-.T.Y.P.E))"></a><span title="Provided from: web-server/http/response-structs | Package: web-server-lib"><span class="RktSym"><a href="#%28def._%28%28lib._web-server%2Fhttp%2Fresponse-structs..rkt%29._.T.E.X.T%2F.H.T.M.L-.M.I.M.E-.T.Y.P.E%29%29" class="RktValDef RktValLink" data-pltdoc="x">TEXT/HTML-MIME-TYPE</a></span></span><span class="hspace"> </span>:<span class="hspace"> </span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=bytestrings.html%23%2528def._%2528%2528quote._%7E23%7E25kernel%2529._bytes%7E3f%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">bytes?</a></span></p></blockquote></td></tr></table></blockquote></div><div class="SIntrapara">Equivalent to <span class="RktVal">#"text/html; charset=utf-8"</span>.</div></p></div><div class="SIntrapara"><span style="font-weight: bold">Warning: </span>If you include a Content-Length header in a response that is inaccurate, there <span style="font-weight: bold">will be an error</span> in
transmission that the server <span style="font-weight: bold">will not catch</span>.</div></p><h4 x-source-module="(lib "web-server/scribblings/web-server.scrbl")" x-part-tag=""cookie"">4.4<tt> </tt><a name="(part._cookie)"></a><a name="(mod-path._web-server/http/cookie)"></a>Placing Cookies</h4><p><div class="SIntrapara"><table cellspacing="0" cellpadding="0" class="defmodule"><tr><td align="left" colspan="2"><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=require.html%23%2528form._%2528%2528lib._racket%252Fprivate%252Fbase..rkt%2529._require%2529%2529&version=6.1" class="RktStxLink Sq" data-pltdoc="x">require</a></span><span class="stt"> </span><a href="#%28mod-path._web-server%2Fhttp%2Fcookie%29" class="RktModLink" data-pltdoc="x"><span class="RktSym">web-server/http/cookie</span></a><span class="RktPn">)</span></td></tr><tr><td align="left"> </td><td align="right"><span class="RpackageSpec"><span class="Smaller"> package:</span> <span class="stt">web-server-lib</span></span></td></tr></table></div><div class="SIntrapara">This module provides functions to create cookies and responses that set them.</div><div class="SIntrapara"><p><div class="SIntrapara"><blockquote class="SVInsetFlow"><table cellspacing="0" cellpadding="0" class="boxed RBoxed"><tr><td><blockquote class="SubFlow"><div class="RBackgroundLabel SIEHidden"><div class="RBackgroundLabelInner"><p>procedure</p></div></div><table cellspacing="0" cellpadding="0" class="prototype RForeground"><tr><td><span class="RktPn">(</span><a name="(def._((lib._web-server/http/cookie..rkt)._make-cookie))"></a><span title="Provided from: web-server/http/cookie | Package: web-server-lib"><span class="RktSym"><a href="#%28def._%28%28lib._web-server%2Fhttp%2Fcookie..rkt%29._make-cookie%29%29" class="RktValDef RktValLink" data-pltdoc="x">make-cookie</a></span></span></td><td><span class="hspace"> </span></td><td><span class="RktVar">name</span></td><td><span class="hspace"> </span></td><td><span class="hspace"> </span></td><td><span class="hspace"> </span></td><td><span class="hspace"> </span></td></tr><tr><td><span class="hspace"> </span></td><td><span class="hspace"> </span></td><td><span class="RktVar">value</span></td><td><span class="hspace"> </span></td><td><span class="hspace"> </span></td><td><span class="hspace"> </span></td><td><span class="hspace"> </span></td></tr><tr><td><span class="hspace"> </span></td><td><span class="hspace"> </span>[</td><td><span class="RktPn">#:comment</span><span class="hspace"> </span><span class="RktVar">comment</span></td><td><span class="hspace"> </span></td><td><span class="hspace"> </span></td><td><span class="hspace"> </span></td><td><span class="hspace"> </span></td></tr><tr><td><span class="hspace"> </span></td><td><span class="hspace"> </span></td><td><span class="RktPn">#:domain</span><span class="hspace"> </span><span class="RktVar">domain</span></td><td><span class="hspace"> </span></td><td><span class="hspace"> </span></td><td><span class="hspace"> </span></td><td><span class="hspace"> </span></td></tr><tr><td><span class="hspace"> </span></td><td><span class="hspace"> </span></td><td><span class="RktPn">#:max-age</span><span class="hspace"> </span><span class="RktVar">max-age</span></td><td><span class="hspace"> </span></td><td><span class="hspace"> </span></td><td><span class="hspace"> </span></td><td><span class="hspace"> </span></td></tr><tr><td><span class="hspace"> </span></td><td><span class="hspace"> </span></td><td><span class="RktPn">#:path</span><span class="hspace"> </span><span class="RktVar">path</span></td><td><span class="hspace"> </span></td><td><span class="hspace"> </span></td><td><span class="hspace"> </span></td><td><span class="hspace"> </span></td></tr><tr><td><span class="hspace"> </span></td><td><span class="hspace"> </span></td><td><span class="RktPn">#:expires</span><span class="hspace"> </span><span class="RktVar">expires</span></td><td><span class="hspace"> </span></td><td><span class="hspace"> </span></td><td><span class="hspace"> </span></td><td><span class="hspace"> </span></td></tr><tr><td><span class="hspace"> </span></td><td><span class="hspace"> </span></td><td><span class="RktPn">#:secure?</span><span class="hspace"> </span><span class="RktVar">secure?</span>]<span class="RktPn">)</span></td><td><span class="hspace"> </span></td><td>→</td><td><span class="hspace"> </span></td><td><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=net&rel=cookie.html%23%2528def._%2528%2528lib._net%252Fcookie..rkt%2529._cookie%7E3f%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">cookie?</a></span></td></tr></table></blockquote></td></tr><tr><td><span class="hspace"> </span><span class="RktVar">name</span><span class="hspace"> </span>:<span class="hspace"> </span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=net&rel=cookie.html%23%2528def._%2528%2528lib._net%252Fcookie..rkt%2529._cookie-name%7E3f%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">cookie-name?</a></span></td></tr><tr><td><span class="hspace"> </span><span class="RktVar">value</span><span class="hspace"> </span>:<span class="hspace"> </span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=net&rel=cookie.html%23%2528def._%2528%2528lib._net%252Fcookie..rkt%2529._cookie-value%7E3f%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">cookie-value?</a></span></td></tr><tr><td><span class="hspace"> </span><span class="RktVar">comment</span><span class="hspace"> </span>:<span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=data-structure-contracts.html%23%2528def._%2528%2528lib._racket%252Fcontract%252Fbase..rkt%2529._or%252Fc%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">or/c</a></span><span class="hspace"> </span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=data-structure-contracts.html%23%2528def._%2528%2528lib._racket%252Fcontract%252Fprivate%252Fmisc..rkt%2529._false%252Fc%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">false/c</a></span><span class="hspace"> </span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=strings.html%23%2528def._%2528%2528quote._%7E23%7E25kernel%2529._string%7E3f%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">string?</a></span><span class="RktPn">)</span><span class="hspace"> </span>=<span class="hspace"> </span><span class="RktVal">#f</span></td></tr><tr><td><span class="hspace"> </span><span class="RktVar">domain</span><span class="hspace"> </span>:<span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=data-structure-contracts.html%23%2528def._%2528%2528lib._racket%252Fcontract%252Fbase..rkt%2529._or%252Fc%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">or/c</a></span><span class="hspace"> </span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=data-structure-contracts.html%23%2528def._%2528%2528lib._racket%252Fcontract%252Fprivate%252Fmisc..rkt%2529._false%252Fc%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">false/c</a></span><span class="hspace"> </span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=net&rel=cookie.html%23%2528def._%2528%2528lib._net%252Fcookie..rkt%2529._valid-domain%7E3f%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">valid-domain?</a></span><span class="RktPn">)</span><span class="hspace"> </span>=<span class="hspace"> </span><span class="RktVal">#f</span></td></tr><tr><td><span class="hspace"> </span><span class="RktVar">max-age</span><span class="hspace"> </span>:<span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=data-structure-contracts.html%23%2528def._%2528%2528lib._racket%252Fcontract%252Fbase..rkt%2529._or%252Fc%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">or/c</a></span><span class="hspace"> </span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=data-structure-contracts.html%23%2528def._%2528%2528lib._racket%252Fcontract%252Fprivate%252Fmisc..rkt%2529._false%252Fc%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">false/c</a></span><span class="hspace"> </span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=number-types.html%23%2528def._%2528%2528quote._%7E23%7E25kernel%2529._exact-nonnegative-integer%7E3f%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">exact-nonnegative-integer?</a></span><span class="RktPn">)</span><span class="hspace"> </span>=<span class="hspace"> </span><span class="RktVal">#f</span></td></tr><tr><td><span class="hspace"> </span><span class="RktVar">path</span><span class="hspace"> </span>:<span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=data-structure-contracts.html%23%2528def._%2528%2528lib._racket%252Fcontract%252Fbase..rkt%2529._or%252Fc%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">or/c</a></span><span class="hspace"> </span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=data-structure-contracts.html%23%2528def._%2528%2528lib._racket%252Fcontract%252Fprivate%252Fmisc..rkt%2529._false%252Fc%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">false/c</a></span><span class="hspace"> </span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=strings.html%23%2528def._%2528%2528quote._%7E23%7E25kernel%2529._string%7E3f%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">string?</a></span><span class="RktPn">)</span><span class="hspace"> </span>=<span class="hspace"> </span><span class="RktVal">#f</span></td></tr><tr><td><span class="hspace"> </span><span class="RktVar">expires</span><span class="hspace"> </span>:<span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=data-structure-contracts.html%23%2528def._%2528%2528lib._racket%252Fcontract%252Fbase..rkt%2529._or%252Fc%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">or/c</a></span><span class="hspace"> </span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=data-structure-contracts.html%23%2528def._%2528%2528lib._racket%252Fcontract%252Fprivate%252Fmisc..rkt%2529._false%252Fc%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">false/c</a></span><span class="hspace"> </span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=strings.html%23%2528def._%2528%2528quote._%7E23%7E25kernel%2529._string%7E3f%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">string?</a></span><span class="RktPn">)</span><span class="hspace"> </span>=<span class="hspace"> </span><span class="RktVal">#f</span></td></tr><tr><td><span class="hspace"> </span><span class="RktVar">secure?</span><span class="hspace"> </span>:<span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=data-structure-contracts.html%23%2528def._%2528%2528lib._racket%252Fcontract%252Fbase..rkt%2529._or%252Fc%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">or/c</a></span><span class="hspace"> </span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=data-structure-contracts.html%23%2528def._%2528%2528lib._racket%252Fcontract%252Fprivate%252Fmisc..rkt%2529._false%252Fc%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">false/c</a></span><span class="hspace"> </span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=booleans.html%23%2528def._%2528%2528quote._%7E23%7E25kernel%2529._boolean%7E3f%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">boolean?</a></span><span class="RktPn">)</span><span class="hspace"> </span>=<span class="hspace"> </span><span class="RktVal">#f</span></td></tr></table></blockquote></div><div class="SIntrapara">Constructs a cookie with the appropriate fields.</div></p></div><div class="SIntrapara"><p><div class="SIntrapara"><blockquote class="SVInsetFlow"><table cellspacing="0" cellpadding="0" class="boxed RBoxed"><tr><td><blockquote class="SubFlow"><div class="RBackgroundLabel SIEHidden"><div class="RBackgroundLabelInner"><p>procedure</p></div></div><p class="RForeground"><span class="RktPn">(</span><a name="(def._((lib._web-server/http/cookie..rkt)._cookie-~3eheader))"></a><span title="Provided from: web-server/http/cookie | Package: web-server-lib"><span class="RktSym"><a href="#%28def._%28%28lib._web-server%2Fhttp%2Fcookie..rkt%29._cookie-~3eheader%29%29" class="RktValDef RktValLink" data-pltdoc="x">cookie->header</a></span></span><span class="hspace"> </span><span class="RktVar">c</span><span class="RktPn">)</span><span class="hspace"> </span>→<span class="hspace"> </span><span class="RktSym"><a href="#%28def._%28%28lib._web-server%2Fhttp%2Frequest-structs..rkt%29._header~3f%29%29" class="RktValLink" data-pltdoc="x">header?</a></span></p></blockquote></td></tr><tr><td><span class="hspace"> </span><span class="RktVar">c</span><span class="hspace"> </span>:<span class="hspace"> </span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=net&rel=cookie.html%23%2528def._%2528%2528lib._net%252Fcookie..rkt%2529._cookie%7E3f%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">cookie?</a></span></td></tr></table></blockquote></div><div class="SIntrapara">Constructs a header that sets the cookie.</div></p></div><div class="SIntrapara"><p><div class="SIntrapara">Examples:
</div><div class="SIntrapara"><blockquote class="SCodeFlow"><table cellspacing="0" cellpadding="0" class="RktBlk"><tr><td><span class="RktPn">(</span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=define.html%23%2528form._%2528%2528lib._racket%252Fprivate%252Fbase..rkt%2529._define%2529%2529&version=6.1" class="RktStxLink Sq" data-pltdoc="x">define</a></span><span class="hspace"> </span><span class="RktSym">time-cookie</span></td></tr><tr><td><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="#%28def._%28%28lib._web-server%2Fhttp%2Fcookie..rkt%29._make-cookie%29%29" class="RktValLink" data-pltdoc="x">make-cookie</a></span><span class="hspace"> </span><span class="RktVal">"time"</span><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=generic-numbers.html%23%2528def._%2528%2528quote._%7E23%7E25kernel%2529._number-%7E3estring%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">number->string</a></span><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=time.html%23%2528def._%2528%2528quote._%7E23%7E25kernel%2529._current-seconds%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">current-seconds</a></span><span class="RktPn">)</span><span class="RktPn">)</span><span class="RktPn">)</span><span class="RktPn">)</span></td></tr><tr><td><span class="RktPn">(</span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=define.html%23%2528form._%2528%2528lib._racket%252Fprivate%252Fbase..rkt%2529._define%2529%2529&version=6.1" class="RktStxLink Sq" data-pltdoc="x">define</a></span><span class="hspace"> </span><span class="RktSym">id-cookie</span></td></tr><tr><td><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="#%28def._%28%28lib._web-server%2Fhttp%2Fcookie..rkt%29._make-cookie%29%29" class="RktValLink" data-pltdoc="x">make-cookie</a></span><span class="hspace"> </span><span class="RktVal">"id"</span><span class="hspace"> </span><span class="RktVal">"joseph"</span><span class="hspace"> </span><span class="RktPn">#:secure?</span><span class="hspace"> </span><span class="RktVal">#t</span><span class="RktPn">)</span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace"> </span></td></tr><tr><td><span class="RktPn">(</span><span class="RktSym"><a href="#%28def._%28%28lib._web-server%2Fhttp%2Fredirect..rkt%29._redirect-to%29%29" class="RktValLink" data-pltdoc="x">redirect-to</a></span></td></tr><tr><td><span class="hspace"> </span><span class="RktVal">"http://localhost/logged-in"</span></td></tr><tr><td><span class="hspace"> </span><span class="RktSym"><a href="#%28def._%28%28lib._web-server%2Fhttp%2Fredirect..rkt%29._see-other%29%29" class="RktValLink" data-pltdoc="x">see-other</a></span></td></tr><tr><td><span class="hspace"> </span><span class="RktPn">#:headers</span></td></tr><tr><td><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=pairs.html%23%2528def._%2528%2528lib._racket%252Fprivate%252Fmap..rkt%2529._map%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">map</a></span><span class="hspace"> </span><span class="RktSym"><a href="#%28def._%28%28lib._web-server%2Fhttp%2Fcookie..rkt%29._cookie-~3eheader%29%29" class="RktValLink" data-pltdoc="x">cookie->header</a></span></td></tr><tr><td><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=pairs.html%23%2528def._%2528%2528quote._%7E23%7E25kernel%2529._list%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">list</a></span><span class="hspace"> </span><span class="RktSym">time-cookie</span><span class="hspace"> </span><span class="RktSym">id-cookie</span><span class="RktPn">)</span><span class="RktPn">)</span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace"> </span></td></tr><tr><td><span class="RktPn">(</span><span class="RktSym"><a href="servlet.html#%28def._%28%28lib._web-server%2Fservlet%2Fweb..rkt%29._send%2Fsuspend%29%29" class="RktValLink" data-pltdoc="x">send/suspend</a></span></td></tr><tr><td><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=lambda.html%23%2528form._%2528%2528lib._racket%252Fprivate%252Fbase..rkt%2529._lambda%2529%2529&version=6.1" class="RktStxLink Sq" data-pltdoc="x">lambda</a></span><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym">k-url</span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="#%28def._%28%28lib._web-server%2Fhttp%2Fxexpr..rkt%29._response%2Fxexpr%29%29" class="RktValLink" data-pltdoc="x">response/xexpr</a></span></td></tr><tr><td><span class="hspace"> </span><span class="RktPn">#:cookies</span><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=pairs.html%23%2528def._%2528%2528quote._%7E23%7E25kernel%2529._list%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">list</a></span><span class="hspace"> </span><span class="RktSym">time-cookie</span><span class="hspace"> </span><span class="RktSym">id-cookie</span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace"> </span><span class="RktVal">`</span><span class="RktVal">(</span><span class="RktVal">html</span><span class="hspace"> </span><span class="RktVal">(</span><span class="RktVal">head</span><span class="hspace"> </span><span class="RktVal">(</span><span class="RktVal">title</span><span class="hspace"> </span><span class="RktVal">"Cookie Example"</span><span class="RktVal">)</span><span class="RktVal">)</span></td></tr><tr><td><span class="hspace"> </span><span class="RktVal">(</span><span class="RktVal">body</span><span class="hspace"> </span><span class="RktVal">(</span><span class="RktVal">h1</span><span class="hspace"> </span><span class="RktVal">"You're cookie'd!"</span><span class="RktVal">)</span><span class="RktVal">)</span><span class="RktVal">)</span><span class="RktPn">)</span><span class="RktPn">)</span><span class="RktPn">)</span></td></tr></table></blockquote></div></p></div></p><h4 x-source-module="(lib "web-server/scribblings/web-server.scrbl")" x-part-tag=""id-cookie"">4.5<tt> </tt><a name="(part._id-cookie)"></a><a name="(mod-path._web-server/http/id-cookie)"></a>Authenticated Cookies</h4><p><div class="SIntrapara"><table cellspacing="0" cellpadding="0" class="defmodule"><tr><td align="left" colspan="2"><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=require.html%23%2528form._%2528%2528lib._racket%252Fprivate%252Fbase..rkt%2529._require%2529%2529&version=6.1" class="RktStxLink Sq" data-pltdoc="x">require</a></span><span class="stt"> </span><a href="#%28mod-path._web-server%2Fhttp%2Fid-cookie%29" class="RktModLink" data-pltdoc="x"><span class="RktSym">web-server/http/id-cookie</span></a><span class="RktPn">)</span></td></tr><tr><td align="left"> </td><td align="right"><span class="RpackageSpec"><span class="Smaller"> package:</span> <span class="stt">web-server-lib</span></span></td></tr></table></div><div class="SIntrapara">Cookies are useful for storing information of user’s browsers and
particularly useful for storing identifying information for
authentication, sessions, etc. However, there are inherent
difficulties when using cookies as authenticators, because cookie data
is fully controlled by the user, and thus cannot be trusted.</div><div class="SIntrapara">This module provides functions for creating and verifying
authenticated cookies that are intrinsically timestamped. It is based
on the algorithm proposed by the
<a href="http://cookies.lcs.mit.edu/">MIT Cookie Eaters</a>: if you store
the data <span class="RktVar">data</span> at thime <span class="RktVar">authored-seconds</span>, then the
user will receive <span class="RktInBG"><span class="hspace"></span><span class="RktIn">digest&authored-seconds&data</span><span class="hspace"></span></span>, where
<span class="RktVar">digest</span> is an HMAC-SHA1 digest of <span class="RktVar">authored-seconds</span>
and <span class="RktVar">data</span>, using an arbitrary secret key. When you receive a
cookie, it will reverify this digest and check that the cookie’s
<span class="RktVar">authored-seconds</span> is not after a timeout period, and only
then return the cookie data to the program.</div><div class="SIntrapara">The interface represents the secret key as a byte string. The best way
to generate this is by using random bytes from something like OpenSSL
or
<span class="stt">/dev/random</span>. <a href="http://www.madboa.com/geek/openssl/#random-generate">This
FAQ</a> lists a few options. A convenient purely Racket-based option is
available (<span class="RktSym"><a href="#%28def._%28%28lib._web-server%2Fhttp%2Fid-cookie..rkt%29._make-secret-salt%2Ffile%29%29" class="RktValLink" data-pltdoc="x">make-secret-salt/file</a></span>), but it will not have as
good entropy, if you care about that sort of thing.</div><div class="SIntrapara"><p><div class="SIntrapara"><blockquote class="SVInsetFlow"><table cellspacing="0" cellpadding="0" class="boxed RBoxed"><tr><td><blockquote class="SubFlow"><div class="RBackgroundLabel SIEHidden"><div class="RBackgroundLabelInner"><p>procedure</p></div></div><table cellspacing="0" cellpadding="0" class="prototype RForeground"><tr><td><span class="RktPn">(</span><a name="(def._((lib._web-server/http/id-cookie..rkt)._make-id-cookie))"></a><span title="Provided from: web-server/http/id-cookie | Package: web-server-lib"><span class="RktSym"><a href="#%28def._%28%28lib._web-server%2Fhttp%2Fid-cookie..rkt%29._make-id-cookie%29%29" class="RktValDef RktValLink" data-pltdoc="x">make-id-cookie</a></span></span></td><td><span class="hspace"> </span></td><td><span class="RktVar">name</span></td><td><span class="hspace"> </span></td><td><span class="hspace"> </span></td><td><span class="hspace"> </span></td><td><span class="hspace"> </span></td></tr><tr><td><span class="hspace"> </span></td><td><span class="hspace"> </span></td><td><span class="RktVar">secret-salt</span></td><td><span class="hspace"> </span></td><td><span class="hspace"> </span></td><td><span class="hspace"> </span></td><td><span class="hspace"> </span></td></tr><tr><td><span class="hspace"> </span></td><td><span class="hspace"> </span></td><td><span class="RktVar">value</span></td><td><span class="hspace"> </span></td><td><span class="hspace"> </span></td><td><span class="hspace"> </span></td><td><span class="hspace"> </span></td></tr><tr><td><span class="hspace"> </span></td><td><span class="hspace"> </span>[</td><td><span class="RktPn">#:path</span><span class="hspace"> </span><span class="RktVar">path</span>]<span class="RktPn">)</span></td><td><span class="hspace"> </span></td><td>→</td><td><span class="hspace"> </span></td><td><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=net&rel=cookie.html%23%2528def._%2528%2528lib._net%252Fcookie..rkt%2529._cookie%7E3f%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">cookie?</a></span></td></tr></table></blockquote></td></tr><tr><td><span class="hspace"> </span><span class="RktVar">name</span><span class="hspace"> </span>:<span class="hspace"> </span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=net&rel=cookie.html%23%2528def._%2528%2528lib._net%252Fcookie..rkt%2529._cookie-name%7E3f%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">cookie-name?</a></span></td></tr><tr><td><span class="hspace"> </span><span class="RktVar">secret-salt</span><span class="hspace"> </span>:<span class="hspace"> </span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=bytestrings.html%23%2528def._%2528%2528quote._%7E23%7E25kernel%2529._bytes%7E3f%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">bytes?</a></span></td></tr><tr><td><span class="hspace"> </span><span class="RktVar">value</span><span class="hspace"> </span>:<span class="hspace"> </span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=net&rel=cookie.html%23%2528def._%2528%2528lib._net%252Fcookie..rkt%2529._cookie-value%7E3f%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">cookie-value?</a></span></td></tr><tr><td><span class="hspace"> </span><span class="RktVar">path</span><span class="hspace"> </span>:<span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=data-structure-contracts.html%23%2528def._%2528%2528lib._racket%252Fcontract%252Fbase..rkt%2529._or%252Fc%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">or/c</a></span><span class="hspace"> </span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=data-structure-contracts.html%23%2528def._%2528%2528lib._racket%252Fcontract%252Fprivate%252Fmisc..rkt%2529._false%252Fc%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">false/c</a></span><span class="hspace"> </span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=strings.html%23%2528def._%2528%2528quote._%7E23%7E25kernel%2529._string%7E3f%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">string?</a></span><span class="RktPn">)</span><span class="hspace"> </span>=<span class="hspace"> </span><span class="RktVal">#f</span></td></tr></table></blockquote></div><div class="SIntrapara">Generates an authenticated cookie named <span class="RktVar">name</span> containing <span class="RktVar">value</span>, signed with <span class="RktVar">secret-salt</span>.</div></p></div><div class="SIntrapara"><p><div class="SIntrapara"><blockquote class="SVInsetFlow"><table cellspacing="0" cellpadding="0" class="boxed RBoxed"><tr><td><blockquote class="SubFlow"><div class="RBackgroundLabel SIEHidden"><div class="RBackgroundLabelInner"><p>procedure</p></div></div><table cellspacing="0" cellpadding="0" class="prototype RForeground"><tr><td><span class="RktPn">(</span><a name="(def._((lib._web-server/http/id-cookie..rkt)._request-id-cookie))"></a><span title="Provided from: web-server/http/id-cookie | Package: web-server-lib"><span class="RktSym"><a href="#%28def._%28%28lib._web-server%2Fhttp%2Fid-cookie..rkt%29._request-id-cookie%29%29" class="RktValDef RktValLink" data-pltdoc="x">request-id-cookie</a></span></span></td><td><span class="hspace"> </span></td><td><span class="RktVar">name</span></td><td><span class="hspace"> </span></td></tr><tr><td><span class="hspace"> </span></td><td><span class="hspace"> </span></td><td><span class="RktVar">secret-salt</span></td><td><span class="hspace"> </span></td></tr><tr><td><span class="hspace"> </span></td><td><span class="hspace"> </span></td><td><span class="RktVar">request</span></td><td><span class="hspace"> </span></td></tr><tr><td><span class="hspace"> </span></td><td><span class="hspace"> </span></td><td><span class="RktPn">#:timeout</span><span class="hspace"> </span><span class="RktVar">timeout</span><span class="RktPn">)</span></td><td><span class="hspace"> </span></td></tr></table></blockquote></td></tr><tr><td><span class="hspace"> </span>→<span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=data-structure-contracts.html%23%2528def._%2528%2528lib._racket%252Fcontract%252Fbase..rkt%2529._or%252Fc%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">or/c</a></span><span class="hspace"> </span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=data-structure-contracts.html%23%2528def._%2528%2528lib._racket%252Fcontract%252Fprivate%252Fmisc..rkt%2529._false%252Fc%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">false/c</a></span><span class="hspace"> </span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=net&rel=cookie.html%23%2528def._%2528%2528lib._net%252Fcookie..rkt%2529._cookie-value%7E3f%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">cookie-value?</a></span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace"> </span><span class="RktVar">name</span><span class="hspace"> </span>:<span class="hspace"> </span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=net&rel=cookie.html%23%2528def._%2528%2528lib._net%252Fcookie..rkt%2529._cookie-name%7E3f%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">cookie-name?</a></span></td></tr><tr><td><span class="hspace"> </span><span class="RktVar">secret-salt</span><span class="hspace"> </span>:<span class="hspace"> </span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=bytestrings.html%23%2528def._%2528%2528quote._%7E23%7E25kernel%2529._bytes%7E3f%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">bytes?</a></span></td></tr><tr><td><span class="hspace"> </span><span class="RktVar">request</span><span class="hspace"> </span>:<span class="hspace"> </span><span class="RktSym"><a href="#%28def._%28%28lib._web-server%2Fhttp%2Frequest-structs..rkt%29._request~3f%29%29" class="RktValLink" data-pltdoc="x">request?</a></span></td></tr><tr><td><span class="hspace"> </span><span class="RktVar">timeout</span><span class="hspace"> </span>:<span class="hspace"> </span><span class="RktVal">+inf.0</span></td></tr></table></blockquote></div><div class="SIntrapara">Extracts the first authenticated cookie named <span class="RktVar">name</span> that was previously signed with <span class="RktVar">secret-salt</span> before <span class="RktVar">timeout</span> from <span class="RktVar">request</span>. If no valid cookie is available, returns <span class="RktVal">#f</span>.</div></p></div><div class="SIntrapara"><p><div class="SIntrapara"><blockquote class="SVInsetFlow"><table cellspacing="0" cellpadding="0" class="boxed RBoxed"><tr><td><blockquote class="SubFlow"><div class="RBackgroundLabel SIEHidden"><div class="RBackgroundLabelInner"><p>procedure</p></div></div><p class="RForeground"><span class="RktPn">(</span><a name="(def._((lib._web-server/http/id-cookie..rkt)._logout-id-cookie))"></a><span title="Provided from: web-server/http/id-cookie | Package: web-server-lib"><span class="RktSym"><a href="#%28def._%28%28lib._web-server%2Fhttp%2Fid-cookie..rkt%29._logout-id-cookie%29%29" class="RktValDef RktValLink" data-pltdoc="x">logout-id-cookie</a></span></span><span class="hspace"> </span><span class="RktVar">name</span><span class="hspace"> </span>[<span class="RktPn">#:path</span><span class="hspace"> </span><span class="RktVar">path</span>]<span class="RktPn">)</span><span class="hspace"> </span>→<span class="hspace"> </span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=net&rel=cookie.html%23%2528def._%2528%2528lib._net%252Fcookie..rkt%2529._cookie%7E3f%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">cookie?</a></span></p></blockquote></td></tr><tr><td><span class="hspace"> </span><span class="RktVar">name</span><span class="hspace"> </span>:<span class="hspace"> </span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=net&rel=cookie.html%23%2528def._%2528%2528lib._net%252Fcookie..rkt%2529._cookie-name%7E3f%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">cookie-name?</a></span></td></tr><tr><td><span class="hspace"> </span><span class="RktVar">path</span><span class="hspace"> </span>:<span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=data-structure-contracts.html%23%2528def._%2528%2528lib._racket%252Fcontract%252Fbase..rkt%2529._or%252Fc%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">or/c</a></span><span class="hspace"> </span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=data-structure-contracts.html%23%2528def._%2528%2528lib._racket%252Fcontract%252Fprivate%252Fmisc..rkt%2529._false%252Fc%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">false/c</a></span><span class="hspace"> </span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=strings.html%23%2528def._%2528%2528quote._%7E23%7E25kernel%2529._string%7E3f%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">string?</a></span><span class="RktPn">)</span><span class="hspace"> </span>=<span class="hspace"> </span><span class="RktVal">#f</span></td></tr></table></blockquote></div><div class="SIntrapara">Generates a cookie named <span class="RktVar">name</span> that is not validly authenticated.</div></p></div><div class="SIntrapara">This will cause non-malicious browsers to overwrite a previously set
cookie. If you use authenticated cookies for login information, you
could send this to cause a "logout". However, malicious browsers do
not need to respect such an overwrite. Therefore, this is not an
effective way to implement timeouts or protect users on
public (i.e. possibly compromised) computers. The only way to securely
logout on the compromised computer is to have server-side state
keeping track of which cookies (sessions, etc.) are invalid. Depending
on your application, it may be better to track live sessions or dead
sessions, or never set cookies to begin with and just use
continuations, which you can revoke with <span class="RktSym"><a href="servlet.html#%28def._%28%28lib._web-server%2Fservlet%2Fweb..rkt%29._send%2Ffinish%29%29" class="RktValLink" data-pltdoc="x">send/finish</a></span>.</div><div class="SIntrapara"><p><div class="SIntrapara"><blockquote class="SVInsetFlow"><table cellspacing="0" cellpadding="0" class="boxed RBoxed"><tr><td><blockquote class="SubFlow"><div class="RBackgroundLabel SIEHidden"><div class="RBackgroundLabelInner"><p>procedure</p></div></div><p class="RForeground"><span class="RktPn">(</span><a name="(def._((lib._web-server/http/id-cookie..rkt)._make-secret-salt/file))"></a><span title="Provided from: web-server/http/id-cookie | Package: web-server-lib"><span class="RktSym"><a href="#%28def._%28%28lib._web-server%2Fhttp%2Fid-cookie..rkt%29._make-secret-salt%2Ffile%29%29" class="RktValDef RktValLink" data-pltdoc="x">make-secret-salt/file</a></span></span><span class="hspace"> </span><span class="RktVar">secret-salt-path</span><span class="RktPn">)</span><span class="hspace"> </span>→<span class="hspace"> </span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=bytestrings.html%23%2528def._%2528%2528quote._%7E23%7E25kernel%2529._bytes%7E3f%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">bytes?</a></span></p></blockquote></td></tr><tr><td><span class="hspace"> </span><span class="RktVar">secret-salt-path</span><span class="hspace"> </span>:<span class="hspace"> </span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=Manipulating_Paths.html%23%2528def._%2528%2528lib._racket%252Fprivate%252Fmisc..rkt%2529._path-string%7E3f%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">path-string?</a></span></td></tr></table></blockquote></div><div class="SIntrapara">Extracts the bytes from <span class="RktVar">secret-salt-path</span>. If
<span class="RktVar">secret-salt-path</span> does not exist, then it is created and
initialized with 128 random bytes.</div></p></div></p><h4 x-source-module="(lib "web-server/scribblings/web-server.scrbl")" x-part-tag=""cookie-parse"">4.6<tt> </tt><a name="(part._cookie-parse)"></a><a name="(mod-path._web-server/http/cookie-parse)"></a>Extracting Cookies</h4><p><div class="SIntrapara"><table cellspacing="0" cellpadding="0" class="defmodule"><tr><td align="left" colspan="2"><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=require.html%23%2528form._%2528%2528lib._racket%252Fprivate%252Fbase..rkt%2529._require%2529%2529&version=6.1" class="RktStxLink Sq" data-pltdoc="x">require</a></span><span class="stt"> </span><a href="#%28mod-path._web-server%2Fhttp%2Fcookie-parse%29" class="RktModLink" data-pltdoc="x"><span class="RktSym">web-server/http/cookie-parse</span></a><span class="RktPn">)</span></td></tr><tr><td align="left"> </td><td align="right"><span class="RpackageSpec"><span class="Smaller"> package:</span> <span class="stt">web-server-lib</span></span></td></tr></table></div><div class="SIntrapara"><p><div class="SIntrapara"><blockquote class="SVInsetFlow"><table cellspacing="0" cellpadding="0" class="boxed RBoxed"><tr><td><blockquote class="SubFlow"><div class="RBackgroundLabel SIEHidden"><div class="RBackgroundLabelInner"><p>struct</p></div></div><table cellspacing="0" cellpadding="0" class="RForeground"><tr><td><span class="RktPn">(</span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=define-struct.html%23%2528form._%2528%2528lib._racket%252Fprivate%252Fbase..rkt%2529._struct%2529%2529&version=6.1" class="RktStxLink Sq" data-pltdoc="x">struct</a></span></td><td><span class="hspace"> </span></td><td><a name="(def._((lib._web-server/http/cookie-parse..rkt)._client-cookie-path))"></a><a name="(def._((lib._web-server/http/cookie-parse..rkt)._client-cookie-domain))"></a><a name="(def._((lib._web-server/http/cookie-parse..rkt)._client-cookie-value))"></a><a name="(def._((lib._web-server/http/cookie-parse..rkt)._client-cookie-name))"></a><a name="(def._((lib._web-server/http/cookie-parse..rkt)._make-client-cookie))"></a><a name="(def._((lib._web-server/http/cookie-parse..rkt)._client-cookie~3f))"></a><a name="(def._((lib._web-server/http/cookie-parse..rkt)._struct~3aclient-cookie))"></a><a name="(def._((lib._web-server/http/cookie-parse..rkt)._client-cookie))"></a><span title="Provided from: web-server/http/cookie-parse | Package: web-server-lib"><span class="RktSym"><a href="#%28def._%28%28lib._web-server%2Fhttp%2Fcookie-parse..rkt%29._client-cookie%29%29" class="RktValDef RktValLink" data-pltdoc="x">client-cookie</a></span></span><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym">name</span><span class="stt"> </span><span class="RktSym">value</span><span class="stt"> </span><span class="RktSym">domain</span><span class="stt"> </span><span class="RktSym">path</span><span class="RktPn">)</span></td></tr></table></blockquote></td></tr><tr><td><span class="hspace"> </span><span class="RktPn">#:extra-constructor-name</span><span class="hspace"> </span><span class="RktSym"><a href="#%28def._%28%28lib._web-server%2Fhttp%2Fcookie-parse..rkt%29._make-client-cookie%29%29" class="RktValLink" data-pltdoc="x">make-client-cookie</a></span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace"> </span><span class="RktSym">name</span><span class="hspace"> </span>:<span class="hspace"> </span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=strings.html%23%2528def._%2528%2528quote._%7E23%7E25kernel%2529._string%7E3f%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">string?</a></span></td></tr><tr><td><span class="hspace"> </span><span class="RktSym">value</span><span class="hspace"> </span>:<span class="hspace"> </span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=strings.html%23%2528def._%2528%2528quote._%7E23%7E25kernel%2529._string%7E3f%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">string?</a></span></td></tr><tr><td><span class="hspace"> </span><span class="RktSym">domain</span><span class="hspace"> </span>:<span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=data-structure-contracts.html%23%2528def._%2528%2528lib._racket%252Fcontract%252Fbase..rkt%2529._or%252Fc%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">or/c</a></span><span class="hspace"> </span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=data-structure-contracts.html%23%2528def._%2528%2528lib._racket%252Fcontract%252Fprivate%252Fmisc..rkt%2529._false%252Fc%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">false/c</a></span><span class="hspace"> </span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=net&rel=cookie.html%23%2528def._%2528%2528lib._net%252Fcookie..rkt%2529._valid-domain%7E3f%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">valid-domain?</a></span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace"> </span><span class="RktSym">path</span><span class="hspace"> </span>:<span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=data-structure-contracts.html%23%2528def._%2528%2528lib._racket%252Fcontract%252Fbase..rkt%2529._or%252Fc%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">or/c</a></span><span class="hspace"> </span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=data-structure-contracts.html%23%2528def._%2528%2528lib._racket%252Fcontract%252Fprivate%252Fmisc..rkt%2529._false%252Fc%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">false/c</a></span><span class="hspace"> </span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=strings.html%23%2528def._%2528%2528quote._%7E23%7E25kernel%2529._string%7E3f%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">string?</a></span><span class="RktPn">)</span></td></tr></table></blockquote></div><div class="SIntrapara">While server cookies are represented with <span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=net&rel=cookie.html%23%2528def._%2528%2528lib._net%252Fcookie..rkt%2529._cookie%7E3f%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">cookie?</a></span>s, cookies
that come from the client are represented with a
<span class="RktSym"><a href="#%28def._%28%28lib._web-server%2Fhttp%2Fcookie-parse..rkt%29._client-cookie%29%29" class="RktValLink" data-pltdoc="x">client-cookie</a></span> structure.</div></p></div><div class="SIntrapara"><p><div class="SIntrapara"><blockquote class="SVInsetFlow"><table cellspacing="0" cellpadding="0" class="boxed RBoxed"><tr><td><blockquote class="SubFlow"><div class="RBackgroundLabel SIEHidden"><div class="RBackgroundLabelInner"><p>procedure</p></div></div><p class="RForeground"><span class="RktPn">(</span><a name="(def._((lib._web-server/http/cookie-parse..rkt)._request-cookies))"></a><span title="Provided from: web-server/http/cookie-parse | Package: web-server-lib"><span class="RktSym"><a href="#%28def._%28%28lib._web-server%2Fhttp%2Fcookie-parse..rkt%29._request-cookies%29%29" class="RktValDef RktValLink" data-pltdoc="x">request-cookies</a></span></span><span class="hspace"> </span><span class="RktVar">req</span><span class="RktPn">)</span><span class="hspace"> </span>→<span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=data-structure-contracts.html%23%2528def._%2528%2528lib._racket%252Fcontract%252Fprivate%252Fmisc..rkt%2529._listof%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">listof</a></span><span class="hspace"> </span><span class="RktSym"><a href="#%28def._%28%28lib._web-server%2Fhttp%2Fcookie-parse..rkt%29._client-cookie~3f%29%29" class="RktValLink" data-pltdoc="x">client-cookie?</a></span><span class="RktPn">)</span></p></blockquote></td></tr><tr><td><span class="hspace"> </span><span class="RktVar">req</span><span class="hspace"> </span>:<span class="hspace"> </span><span class="RktSym"><a href="#%28def._%28%28lib._web-server%2Fhttp%2Frequest-structs..rkt%29._request~3f%29%29" class="RktValLink" data-pltdoc="x">request?</a></span></td></tr></table></blockquote></div><div class="SIntrapara">Extracts the cookies from <span class="RktVar">req</span>’s headers.</div></p></div><div class="SIntrapara"><p><div class="SIntrapara">Examples:
</div><div class="SIntrapara"><blockquote class="SCodeFlow"><table cellspacing="0" cellpadding="0" class="RktBlk"><tr><td><span class="RktPn">(</span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=define.html%23%2528form._%2528%2528lib._racket%252Fprivate%252Fbase..rkt%2529._define%2529%2529&version=6.1" class="RktStxLink Sq" data-pltdoc="x">define</a></span><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym">start</span><span class="hspace"> </span><span class="RktSym">req</span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=define.html%23%2528form._%2528%2528lib._racket%252Fprivate%252Fbase..rkt%2529._define%2529%2529&version=6.1" class="RktStxLink Sq" data-pltdoc="x">define</a></span><span class="hspace"> </span><span class="RktSym">cookies</span><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="#%28def._%28%28lib._web-server%2Fhttp%2Fcookie-parse..rkt%29._request-cookies%29%29" class="RktValLink" data-pltdoc="x">request-cookies</a></span><span class="hspace"> </span><span class="RktSym">req</span><span class="RktPn">)</span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=define.html%23%2528form._%2528%2528lib._racket%252Fprivate%252Fbase..rkt%2529._define%2529%2529&version=6.1" class="RktStxLink Sq" data-pltdoc="x">define</a></span><span class="hspace"> </span><span class="RktSym">id-cookie</span></td></tr><tr><td><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=pairs.html%23%2528def._%2528%2528lib._racket%252Fprivate%252Flist..rkt%2529._findf%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">findf</a></span><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=lambda.html%23%2528form._%2528%2528lib._racket%252Fprivate%252Fbase..rkt%2529._lambda%2529%2529&version=6.1" class="RktStxLink Sq" data-pltdoc="x">lambda</a></span><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym">c</span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=strings.html%23%2528def._%2528%2528quote._%7E23%7E25kernel%2529._string%7E3d%7E3f%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">string=?</a></span><span class="hspace"> </span><span class="RktVal">"id"</span><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="#%28def._%28%28lib._web-server%2Fhttp%2Fcookie-parse..rkt%29._client-cookie-name%29%29" class="RktValLink" data-pltdoc="x">client-cookie-name</a></span><span class="hspace"> </span><span class="RktSym">c</span><span class="RktPn">)</span><span class="RktPn">)</span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace"> </span><span class="RktSym">cookies</span><span class="RktPn">)</span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=if.html%23%2528form._%2528%2528quote._%7E23%7E25kernel%2529._if%2529%2529&version=6.1" class="RktStxLink Sq" data-pltdoc="x">if</a></span><span class="hspace"> </span><span class="RktSym">id-cookie</span></td></tr><tr><td><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym">hello</span><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="#%28def._%28%28lib._web-server%2Fhttp%2Fcookie-parse..rkt%29._client-cookie-value%29%29" class="RktValLink" data-pltdoc="x">client-cookie-value</a></span><span class="hspace"> </span><span class="RktSym">id-cookie</span><span class="RktPn">)</span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="#%28def._%28%28lib._web-server%2Fhttp%2Fredirect..rkt%29._redirect-to%29%29" class="RktValLink" data-pltdoc="x">redirect-to</a></span></td></tr><tr><td><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=net&rel=url.html%23%2528def._%2528%2528lib._net%252Furl..rkt%2529._url-%7E3estring%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">url->string</a></span><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="#%28def._%28%28lib._web-server%2Fhttp%2Frequest-structs..rkt%29._request-uri%29%29" class="RktValLink" data-pltdoc="x">request-uri</a></span><span class="hspace"> </span><span class="RktSym">req</span><span class="RktPn">)</span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace"> </span><span class="RktSym"><a href="#%28def._%28%28lib._web-server%2Fhttp%2Fredirect..rkt%29._see-other%29%29" class="RktValLink" data-pltdoc="x">see-other</a></span></td></tr><tr><td><span class="hspace"> </span><span class="RktPn">#:headers</span></td></tr><tr><td><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=pairs.html%23%2528def._%2528%2528quote._%7E23%7E25kernel%2529._list%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">list</a></span></td></tr><tr><td><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="#%28def._%28%28lib._web-server%2Fhttp%2Fcookie..rkt%29._cookie-~3eheader%29%29" class="RktValLink" data-pltdoc="x">cookie->header</a></span><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="#%28def._%28%28lib._web-server%2Fhttp%2Fcookie..rkt%29._make-cookie%29%29" class="RktValLink" data-pltdoc="x">make-cookie</a></span><span class="hspace"> </span><span class="RktVal">"id"</span><span class="hspace"> </span><span class="RktVal">"joseph"</span><span class="RktPn">)</span><span class="RktPn">)</span><span class="RktPn">)</span><span class="RktPn">)</span><span class="RktPn">)</span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace"> </span></td></tr><tr><td><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=define.html%23%2528form._%2528%2528lib._racket%252Fprivate%252Fbase..rkt%2529._define%2529%2529&version=6.1" class="RktStxLink Sq" data-pltdoc="x">define</a></span><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym">hello</span><span class="hspace"> </span><span class="RktSym">who</span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="#%28def._%28%28lib._web-server%2Fhttp%2Fxexpr..rkt%29._response%2Fxexpr%29%29" class="RktValLink" data-pltdoc="x">response/xexpr</a></span></td></tr><tr><td><span class="hspace"> </span><span class="RktVal">`</span><span class="RktVal">(</span><span class="RktVal">html</span><span class="hspace"> </span><span class="RktVal">(</span><span class="RktVal">head</span><span class="hspace"> </span><span class="RktVal">(</span><span class="RktVal">title</span><span class="hspace"> </span><span class="RktVal">"Hello!"</span><span class="RktVal">)</span><span class="RktVal">)</span></td></tr><tr><td><span class="hspace"> </span><span class="RktVal">(</span><span class="RktVal">body</span></td></tr><tr><td><span class="hspace"> </span><span class="RktVal">(</span><span class="RktVal">h1</span><span class="hspace"> </span><span class="RktVal">"Hello "</span></td></tr><tr><td><span class="hspace"> </span><span class="RktRdr">,</span><span class="RktSym">who</span><span class="RktVal">)</span><span class="RktVal">)</span><span class="RktVal">)</span><span class="RktPn">)</span><span class="RktPn">)</span></td></tr></table></blockquote></div></p></div></p><h4 x-source-module="(lib "web-server/scribblings/web-server.scrbl")" x-part-tag=""redirect"">4.7<tt> </tt><a name="(part._redirect)"></a><a name="(mod-path._web-server/http/redirect)"></a>Redirect</h4><p><div class="SIntrapara"><table cellspacing="0" cellpadding="0" class="defmodule"><tr><td align="left" colspan="2"><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=require.html%23%2528form._%2528%2528lib._racket%252Fprivate%252Fbase..rkt%2529._require%2529%2529&version=6.1" class="RktStxLink Sq" data-pltdoc="x">require</a></span><span class="stt"> </span><a href="#%28mod-path._web-server%2Fhttp%2Fredirect%29" class="RktModLink" data-pltdoc="x"><span class="RktSym">web-server/http/redirect</span></a><span class="RktPn">)</span></td></tr><tr><td align="left"> </td><td align="right"><span class="RpackageSpec"><span class="Smaller"> package:</span> <span class="stt">web-server-lib</span></span></td></tr></table></div><div class="SIntrapara"><p><div class="SIntrapara"><blockquote class="SVInsetFlow"><table cellspacing="0" cellpadding="0" class="boxed RBoxed"><tr><td><blockquote class="SubFlow"><div class="RBackgroundLabel SIEHidden"><div class="RBackgroundLabelInner"><p>procedure</p></div></div><table cellspacing="0" cellpadding="0" class="prototype RForeground"><tr><td><span class="RktPn">(</span><a name="(def._((lib._web-server/http/redirect..rkt)._redirect-to))"></a><span title="Provided from: web-server/http/redirect | Package: web-server-lib"><span class="RktSym"><a href="#%28def._%28%28lib._web-server%2Fhttp%2Fredirect..rkt%29._redirect-to%29%29" class="RktValDef RktValLink" data-pltdoc="x">redirect-to</a></span></span></td><td><span class="hspace"> </span></td><td><span class="RktVar">uri</span></td><td><span class="hspace"> </span></td><td><span class="hspace"> </span></td><td><span class="hspace"> </span></td><td><span class="hspace"> </span></td></tr><tr><td><span class="hspace"> </span></td><td><span class="hspace"> </span>[</td><td><span class="RktVar">perm/temp</span></td><td><span class="hspace"> </span></td><td><span class="hspace"> </span></td><td><span class="hspace"> </span></td><td><span class="hspace"> </span></td></tr><tr><td><span class="hspace"> </span></td><td><span class="hspace"> </span></td><td><span class="RktPn">#:headers</span><span class="hspace"> </span><span class="RktVar">headers</span>]<span class="RktPn">)</span></td><td><span class="hspace"> </span></td><td>→</td><td><span class="hspace"> </span></td><td><span class="RktSym"><a href="#%28def._%28%28lib._web-server%2Fhttp%2Fresponse-structs..rkt%29._response~3f%29%29" class="RktValLink" data-pltdoc="x">response?</a></span></td></tr></table></blockquote></td></tr><tr><td><span class="hspace"> </span><span class="RktVar">uri</span><span class="hspace"> </span>:<span class="hspace"> </span><span class="RktSym">non-empty-string/c</span></td></tr><tr><td><span class="hspace"> </span><span class="RktVar">perm/temp</span><span class="hspace"> </span>:<span class="hspace"> </span><span class="RktSym"><a href="#%28def._%28%28lib._web-server%2Fhttp%2Fredirect..rkt%29._redirection-status~3f%29%29" class="RktValLink" data-pltdoc="x">redirection-status?</a></span><span class="hspace"> </span>=<span class="hspace"> </span><span class="RktSym"><a href="#%28def._%28%28lib._web-server%2Fhttp%2Fredirect..rkt%29._temporarily%29%29" class="RktValLink" data-pltdoc="x">temporarily</a></span></td></tr><tr><td><span class="hspace"> </span><span class="RktVar">headers</span><span class="hspace"> </span>:<span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=data-structure-contracts.html%23%2528def._%2528%2528lib._racket%252Fcontract%252Fprivate%252Fmisc..rkt%2529._listof%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">listof</a></span><span class="hspace"> </span><span class="RktSym"><a href="#%28def._%28%28lib._web-server%2Fhttp%2Frequest-structs..rkt%29._header~3f%29%29" class="RktValLink" data-pltdoc="x">header?</a></span><span class="RktPn">)</span><span class="hspace"> </span>=<span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=pairs.html%23%2528def._%2528%2528quote._%7E23%7E25kernel%2529._list%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">list</a></span><span class="RktPn">)</span></td></tr></table></blockquote></div><div class="SIntrapara">Generates an HTTP response that redirects the browser to <span class="RktVar">uri</span>,
while including the <span class="RktVar">headers</span> in the response.</div></p></div><div class="SIntrapara">Example:
<span class="RktPn">(</span><span class="RktSym"><a href="#%28def._%28%28lib._web-server%2Fhttp%2Fredirect..rkt%29._redirect-to%29%29" class="RktValLink" data-pltdoc="x">redirect-to</a></span><span class="stt"> </span><span class="RktVal">"http://www.add-three-numbers.com"</span><span class="stt"> </span><span class="RktSym"><a href="#%28def._%28%28lib._web-server%2Fhttp%2Fredirect..rkt%29._permanently%29%29" class="RktValLink" data-pltdoc="x">permanently</a></span><span class="RktPn">)</span></div><div class="SIntrapara"><p><div class="SIntrapara"><blockquote class="SVInsetFlow"><table cellspacing="0" cellpadding="0" class="boxed RBoxed"><tr><td><blockquote class="SubFlow"><div class="RBackgroundLabel SIEHidden"><div class="RBackgroundLabelInner"><p>procedure</p></div></div><p class="RForeground"><span class="RktPn">(</span><a name="(def._((lib._web-server/http/redirect..rkt)._redirection-status~3f))"></a><span title="Provided from: web-server/http/redirect | Package: web-server-lib"><span class="RktSym"><a href="#%28def._%28%28lib._web-server%2Fhttp%2Fredirect..rkt%29._redirection-status~3f%29%29" class="RktValDef RktValLink" data-pltdoc="x">redirection-status?</a></span></span><span class="hspace"> </span><span class="RktVar">v</span><span class="RktPn">)</span><span class="hspace"> </span>→<span class="hspace"> </span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=booleans.html%23%2528def._%2528%2528quote._%7E23%7E25kernel%2529._boolean%7E3f%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">boolean?</a></span></p></blockquote></td></tr><tr><td><span class="hspace"> </span><span class="RktVar">v</span><span class="hspace"> </span>:<span class="hspace"> </span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=data-structure-contracts.html%23%2528def._%2528%2528lib._racket%252Fcontract%252Fprivate%252Fmisc..rkt%2529._any%252Fc%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">any/c</a></span></td></tr></table></blockquote></div><div class="SIntrapara">Determines if <span class="RktVar">v</span> is one of the following values.</div></p></div><div class="SIntrapara"><p><div class="SIntrapara"><blockquote class="SVInsetFlow"><table cellspacing="0" cellpadding="0" class="boxed RBoxed"><tr><td><blockquote class="SubFlow"><div class="RBackgroundLabel SIEHidden"><div class="RBackgroundLabelInner"><p>value</p></div></div><p class="RForeground"><a name="(def._((lib._web-server/http/redirect..rkt)._permanently))"></a><span title="Provided from: web-server/http/redirect | Package: web-server-lib"><span class="RktSym"><a href="#%28def._%28%28lib._web-server%2Fhttp%2Fredirect..rkt%29._permanently%29%29" class="RktValDef RktValLink" data-pltdoc="x">permanently</a></span></span><span class="hspace"> </span>:<span class="hspace"> </span><span class="RktSym"><a href="#%28def._%28%28lib._web-server%2Fhttp%2Fredirect..rkt%29._redirection-status~3f%29%29" class="RktValLink" data-pltdoc="x">redirection-status?</a></span></p></blockquote></td></tr></table></blockquote></div><div class="SIntrapara">A <span class="RktSym"><a href="#%28def._%28%28lib._web-server%2Fhttp%2Fredirect..rkt%29._redirection-status~3f%29%29" class="RktValLink" data-pltdoc="x">redirection-status?</a></span> for permanent redirections.</div></p></div><div class="SIntrapara"><p><div class="SIntrapara"><blockquote class="SVInsetFlow"><table cellspacing="0" cellpadding="0" class="boxed RBoxed"><tr><td><blockquote class="SubFlow"><div class="RBackgroundLabel SIEHidden"><div class="RBackgroundLabelInner"><p>value</p></div></div><p class="RForeground"><a name="(def._((lib._web-server/http/redirect..rkt)._temporarily))"></a><span title="Provided from: web-server/http/redirect | Package: web-server-lib"><span class="RktSym"><a href="#%28def._%28%28lib._web-server%2Fhttp%2Fredirect..rkt%29._temporarily%29%29" class="RktValDef RktValLink" data-pltdoc="x">temporarily</a></span></span><span class="hspace"> </span>:<span class="hspace"> </span><span class="RktSym"><a href="#%28def._%28%28lib._web-server%2Fhttp%2Fredirect..rkt%29._redirection-status~3f%29%29" class="RktValLink" data-pltdoc="x">redirection-status?</a></span></p></blockquote></td></tr></table></blockquote></div><div class="SIntrapara">A <span class="RktSym"><a href="#%28def._%28%28lib._web-server%2Fhttp%2Fredirect..rkt%29._redirection-status~3f%29%29" class="RktValLink" data-pltdoc="x">redirection-status?</a></span> for temporary redirections.</div></p></div><div class="SIntrapara"><p><div class="SIntrapara"><blockquote class="SVInsetFlow"><table cellspacing="0" cellpadding="0" class="boxed RBoxed"><tr><td><blockquote class="SubFlow"><div class="RBackgroundLabel SIEHidden"><div class="RBackgroundLabelInner"><p>value</p></div></div><p class="RForeground"><a name="(def._((lib._web-server/http/redirect..rkt)._see-other))"></a><span title="Provided from: web-server/http/redirect | Package: web-server-lib"><span class="RktSym"><a href="#%28def._%28%28lib._web-server%2Fhttp%2Fredirect..rkt%29._see-other%29%29" class="RktValDef RktValLink" data-pltdoc="x">see-other</a></span></span><span class="hspace"> </span>:<span class="hspace"> </span><span class="RktSym"><a href="#%28def._%28%28lib._web-server%2Fhttp%2Fredirect..rkt%29._redirection-status~3f%29%29" class="RktValLink" data-pltdoc="x">redirection-status?</a></span></p></blockquote></td></tr></table></blockquote></div><div class="SIntrapara">A <span class="RktSym"><a href="#%28def._%28%28lib._web-server%2Fhttp%2Fredirect..rkt%29._redirection-status~3f%29%29" class="RktValLink" data-pltdoc="x">redirection-status?</a></span> for "see-other" redirections.</div></p></div></p><h4 x-source-module="(lib "web-server/scribblings/web-server.scrbl")" x-part-tag=""basic-auth"">4.8<tt> </tt><a name="(part._basic-auth)"></a><a name="(mod-path._web-server/http/basic-auth)"></a>Basic Authentication</h4><p><div class="SIntrapara"><table cellspacing="0" cellpadding="0" class="defmodule"><tr><td align="left" colspan="2"><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=require.html%23%2528form._%2528%2528lib._racket%252Fprivate%252Fbase..rkt%2529._require%2529%2529&version=6.1" class="RktStxLink Sq" data-pltdoc="x">require</a></span><span class="stt"> </span><a href="#%28mod-path._web-server%2Fhttp%2Fbasic-auth%29" class="RktModLink" data-pltdoc="x"><span class="RktSym">web-server/http/basic-auth</span></a><span class="RktPn">)</span></td></tr><tr><td align="left"> </td><td align="right"><span class="RpackageSpec"><span class="Smaller"> package:</span> <span class="stt">web-server-lib</span></span></td></tr></table></div><div class="SIntrapara">An implementation of HTTP Basic Authentication.</div><div class="SIntrapara"><p><div class="SIntrapara"><blockquote class="SVInsetFlow"><table cellspacing="0" cellpadding="0" class="boxed RBoxed"><tr><td><blockquote class="SubFlow"><div class="RBackgroundLabel SIEHidden"><div class="RBackgroundLabelInner"><p>procedure</p></div></div><p class="RForeground"><span class="RktPn">(</span><a name="(def._((lib._web-server/http/basic-auth..rkt)._make-basic-auth-header))"></a><span title="Provided from: web-server/http/basic-auth | Package: web-server-lib"><span class="RktSym"><a href="#%28def._%28%28lib._web-server%2Fhttp%2Fbasic-auth..rkt%29._make-basic-auth-header%29%29" class="RktValDef RktValLink" data-pltdoc="x">make-basic-auth-header</a></span></span><span class="hspace"> </span><span class="RktVar">realm</span><span class="RktPn">)</span><span class="hspace"> </span>→<span class="hspace"> </span><span class="RktSym"><a href="#%28def._%28%28lib._web-server%2Fhttp%2Frequest-structs..rkt%29._header~3f%29%29" class="RktValLink" data-pltdoc="x">header?</a></span></p></blockquote></td></tr><tr><td><span class="hspace"> </span><span class="RktVar">realm</span><span class="hspace"> </span>:<span class="hspace"> </span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=strings.html%23%2528def._%2528%2528quote._%7E23%7E25kernel%2529._string%7E3f%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">string?</a></span></td></tr></table></blockquote></div><div class="SIntrapara">Returns a header that instructs the Web browser to request a username and password from the client using
Basic authentication with <span class="RktVar">realm</span> as the realm.</div></p></div><div class="SIntrapara"><p><div class="SIntrapara"><blockquote class="SVInsetFlow"><table cellspacing="0" cellpadding="0" class="boxed RBoxed"><tr><td><blockquote class="SubFlow"><div class="RBackgroundLabel SIEHidden"><div class="RBackgroundLabelInner"><p>procedure</p></div></div><p class="RForeground"><span class="RktPn">(</span><a name="(def._((lib._web-server/http/basic-auth..rkt)._request-~3ebasic-credentials))"></a><span title="Provided from: web-server/http/basic-auth | Package: web-server-lib"><span class="RktSym"><a href="#%28def._%28%28lib._web-server%2Fhttp%2Fbasic-auth..rkt%29._request-~3ebasic-credentials%29%29" class="RktValDef RktValLink" data-pltdoc="x">request->basic-credentials</a></span></span><span class="hspace"> </span><span class="RktVar">req</span><span class="RktPn">)</span></p></blockquote></td></tr><tr><td><span class="hspace"> </span>→<span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=data-structure-contracts.html%23%2528def._%2528%2528lib._racket%252Fcontract%252Fbase..rkt%2529._or%252Fc%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">or/c</a></span><span class="hspace"> </span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=data-structure-contracts.html%23%2528def._%2528%2528lib._racket%252Fcontract%252Fprivate%252Fmisc..rkt%2529._false%252Fc%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">false/c</a></span><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=data-structure-contracts.html%23%2528def._%2528%2528lib._racket%252Fcontract%252Fprivate%252Fmisc..rkt%2529._cons%252Fc%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">cons/c</a></span><span class="hspace"> </span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=bytestrings.html%23%2528def._%2528%2528quote._%7E23%7E25kernel%2529._bytes%7E3f%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">bytes?</a></span><span class="hspace"> </span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=bytestrings.html%23%2528def._%2528%2528quote._%7E23%7E25kernel%2529._bytes%7E3f%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">bytes?</a></span><span class="RktPn">)</span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace"> </span><span class="RktVar">req</span><span class="hspace"> </span>:<span class="hspace"> </span><span class="RktSym"><a href="#%28def._%28%28lib._web-server%2Fhttp%2Frequest-structs..rkt%29._request~3f%29%29" class="RktValLink" data-pltdoc="x">request?</a></span></td></tr></table></blockquote></div><div class="SIntrapara">Returns a pair of the username and password from the authentication
header in <span class="RktVar">req</span> if they are present, or <span class="RktVal">#f</span>.</div></p></div><div class="SIntrapara"><p><div class="SIntrapara">Example:
</div><div class="SIntrapara"><blockquote class="SCodeFlow"><table cellspacing="0" cellpadding="0" class="RktBlk"><tr><td><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=guide&rel=Module_Syntax.html%23%2528part._hash-lang%2529&version=6.1" class="RktModLink Sq" data-pltdoc="x"><span class="RktMod">#lang</span></a><span class="hspace"> </span><a href="run.html#%28mod-path._web-server%2Finsta%29" class="RktModLink" data-pltdoc="x"><span class="RktSym">web-server/insta</span></a></td></tr><tr><td><span class="hspace"> </span></td></tr><tr><td><span class="RktPn">(</span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=define.html%23%2528form._%2528%2528lib._racket%252Fprivate%252Fbase..rkt%2529._define%2529%2529&version=6.1" class="RktStxLink Sq" data-pltdoc="x">define</a></span><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym">start</span><span class="hspace"> </span><span class="RktSym">req</span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=match.html%23%2528form._%2528%2528lib._racket%252Fmatch..rkt%2529._match%2529%2529&version=6.1" class="RktStxLink Sq" data-pltdoc="x">match</a></span><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="#%28def._%28%28lib._web-server%2Fhttp%2Fbasic-auth..rkt%29._request-~3ebasic-credentials%29%29" class="RktValLink" data-pltdoc="x">request->basic-credentials</a></span><span class="hspace"> </span><span class="RktSym">req</span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace"> </span><span class="RktPn">[</span><span class="RktPn">(</span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=pairs.html%23%2528def._%2528%2528quote._%7E23%7E25kernel%2529._cons%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">cons</a></span><span class="hspace"> </span><span class="RktSym">user</span><span class="hspace"> </span><span class="RktSym">pass</span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="#%28def._%28%28lib._web-server%2Fhttp%2Fxexpr..rkt%29._response%2Fxexpr%29%29" class="RktValLink" data-pltdoc="x">response/xexpr</a></span></td></tr><tr><td><span class="hspace"> </span><span class="RktVal">`</span><span class="RktVal">(</span><span class="RktVal">html</span><span class="hspace"> </span><span class="RktVal">(</span><span class="RktVal">head</span><span class="hspace"> </span><span class="RktVal">(</span><span class="RktVal">title</span><span class="hspace"> </span><span class="RktVal">"Basic Auth Test"</span><span class="RktVal">)</span><span class="RktVal">)</span></td></tr><tr><td><span class="hspace"> </span><span class="RktVal">(</span><span class="RktVal">body</span><span class="hspace"> </span><span class="RktVal">(</span><span class="RktVal">h1</span><span class="hspace"> </span><span class="RktVal">"User: "</span><span class="hspace"> </span><span class="RktRdr">,</span><span class="RktPn">(</span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=bytestrings.html%23%2528def._%2528%2528quote._%7E23%7E25kernel%2529._bytes-%7E3estring%252Futf-8%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">bytes->string/utf-8</a></span><span class="hspace"> </span><span class="RktSym">user</span><span class="RktPn">)</span><span class="RktVal">)</span></td></tr><tr><td><span class="hspace"> </span><span class="RktVal">(</span><span class="RktVal">h1</span><span class="hspace"> </span><span class="RktVal">"Pass: "</span><span class="hspace"> </span><span class="RktRdr">,</span><span class="RktPn">(</span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=bytestrings.html%23%2528def._%2528%2528quote._%7E23%7E25kernel%2529._bytes-%7E3estring%252Futf-8%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">bytes->string/utf-8</a></span><span class="hspace"> </span><span class="RktSym">pass</span><span class="RktPn">)</span><span class="RktVal">)</span><span class="RktVal">)</span><span class="RktVal">)</span><span class="RktPn">)</span><span class="RktPn">]</span></td></tr><tr><td><span class="hspace"> </span><span class="RktPn">[</span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=if.html%23%2528form._%2528%2528lib._racket%252Fprivate%252Fletstx-scheme..rkt%2529._else%2529%2529&version=6.1" class="RktStxLink Sq" data-pltdoc="x">else</a></span></td></tr><tr><td><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="#%28def._%28%28lib._web-server%2Fhttp%2Fresponse-structs..rkt%29._response%29%29" class="RktValLink" data-pltdoc="x">response</a></span></td></tr><tr><td><span class="hspace"> </span><span class="RktVal">401</span><span class="hspace"> </span><span class="RktVal">#"Unauthorized"</span><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=time.html%23%2528def._%2528%2528quote._%7E23%7E25kernel%2529._current-seconds%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">current-seconds</a></span><span class="RktPn">)</span><span class="hspace"> </span><span class="RktSym"><a href="#%28def._%28%28lib._web-server%2Fhttp%2Fresponse-structs..rkt%29._.T.E.X.T%2F.H.T.M.L-.M.I.M.E-.T.Y.P.E%29%29" class="RktValLink" data-pltdoc="x">TEXT/HTML-MIME-TYPE</a></span></td></tr><tr><td><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=pairs.html%23%2528def._%2528%2528quote._%7E23%7E25kernel%2529._list%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">list</a></span></td></tr><tr><td><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="#%28def._%28%28lib._web-server%2Fhttp%2Fbasic-auth..rkt%29._make-basic-auth-header%29%29" class="RktValLink" data-pltdoc="x">make-basic-auth-header</a></span></td></tr><tr><td><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=Writing.html%23%2528def._%2528%2528quote._%7E23%7E25kernel%2529._format%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">format</a></span><span class="hspace"> </span><span class="RktVal">"Basic Auth Test: ~a"</span><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=symbols.html%23%2528def._%2528%2528quote._%7E23%7E25kernel%2529._gensym%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">gensym</a></span><span class="RktPn">)</span><span class="RktPn">)</span><span class="RktPn">)</span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace"> </span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=void.html%23%2528def._%2528%2528quote._%7E23%7E25kernel%2529._void%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">void</a></span><span class="RktPn">)</span><span class="RktPn">]</span><span class="RktPn">)</span><span class="RktPn">)</span></td></tr></table></blockquote></div></p></div></p><h4 x-source-module="(lib "web-server/scribblings/web-server.scrbl")" x-part-tag=""digest-auth"">4.9<tt> </tt><a name="(part._digest-auth)"></a><a name="(mod-path._web-server/http/digest-auth)"></a>Digest Authentication</h4><p><div class="SIntrapara"><table cellspacing="0" cellpadding="0" class="defmodule"><tr><td align="left" colspan="2"><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=require.html%23%2528form._%2528%2528lib._racket%252Fprivate%252Fbase..rkt%2529._require%2529%2529&version=6.1" class="RktStxLink Sq" data-pltdoc="x">require</a></span><span class="stt"> </span><a href="#%28mod-path._web-server%2Fhttp%2Fdigest-auth%29" class="RktModLink" data-pltdoc="x"><span class="RktSym">web-server/http/digest-auth</span></a><span class="RktPn">)</span></td></tr><tr><td align="left"> </td><td align="right"><span class="RpackageSpec"><span class="Smaller"> package:</span> <span class="stt">web-server-lib</span></span></td></tr></table></div><div class="SIntrapara">An implementation of HTTP Digest Authentication.</div><div class="SIntrapara"><p><div class="SIntrapara"><blockquote class="SVInsetFlow"><table cellspacing="0" cellpadding="0" class="boxed RBoxed"><tr><td><blockquote class="SubFlow"><div class="RBackgroundLabel SIEHidden"><div class="RBackgroundLabelInner"><p>procedure</p></div></div><table cellspacing="0" cellpadding="0" class="prototype RForeground"><tr><td><span class="RktPn">(</span><a name="(def._((lib._web-server/http/digest-auth..rkt)._make-digest-auth-header))"></a><span title="Provided from: web-server/http/digest-auth | Package: web-server-lib"><span class="RktSym"><a href="#%28def._%28%28lib._web-server%2Fhttp%2Fdigest-auth..rkt%29._make-digest-auth-header%29%29" class="RktValDef RktValLink" data-pltdoc="x">make-digest-auth-header</a></span></span></td><td><span class="hspace"> </span></td><td><span class="RktVar">realm</span></td><td><span class="hspace"> </span></td><td><span class="hspace"> </span></td><td><span class="hspace"> </span></td><td><span class="hspace"> </span></td></tr><tr><td><span class="hspace"> </span></td><td><span class="hspace"> </span></td><td><span class="RktVar">private-key</span></td><td><span class="hspace"> </span></td><td><span class="hspace"> </span></td><td><span class="hspace"> </span></td><td><span class="hspace"> </span></td></tr><tr><td><span class="hspace"> </span></td><td><span class="hspace"> </span></td><td><span class="RktVar">opaque</span><span class="RktPn">)</span></td><td><span class="hspace"> </span></td><td>→</td><td><span class="hspace"> </span></td><td><span class="RktSym"><a href="#%28def._%28%28lib._web-server%2Fhttp%2Frequest-structs..rkt%29._header~3f%29%29" class="RktValLink" data-pltdoc="x">header?</a></span></td></tr></table></blockquote></td></tr><tr><td><span class="hspace"> </span><span class="RktVar">realm</span><span class="hspace"> </span>:<span class="hspace"> </span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=strings.html%23%2528def._%2528%2528quote._%7E23%7E25kernel%2529._string%7E3f%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">string?</a></span></td></tr><tr><td><span class="hspace"> </span><span class="RktVar">private-key</span><span class="hspace"> </span>:<span class="hspace"> </span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=strings.html%23%2528def._%2528%2528quote._%7E23%7E25kernel%2529._string%7E3f%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">string?</a></span></td></tr><tr><td><span class="hspace"> </span><span class="RktVar">opaque</span><span class="hspace"> </span>:<span class="hspace"> </span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=strings.html%23%2528def._%2528%2528quote._%7E23%7E25kernel%2529._string%7E3f%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">string?</a></span></td></tr></table></blockquote></div><div class="SIntrapara">Returns a header that instructs the Web browser to request a username and password from the client
using Digest authentication with <span class="RktVar">realm</span> as the realm, <span class="RktVar">private-key</span> as the server’s
contribution to the nonce, and <span class="RktVar">opaque</span> as the opaque data passed through the client.</div></p></div><div class="SIntrapara"><p><div class="SIntrapara"><blockquote class="SVInsetFlow"><table cellspacing="0" cellpadding="0" class="boxed RBoxed"><tr><td><blockquote class="SubFlow"><div class="RBackgroundLabel SIEHidden"><div class="RBackgroundLabelInner"><p>procedure</p></div></div><p class="RForeground"><span class="RktPn">(</span><a name="(def._((lib._web-server/http/digest-auth..rkt)._request-~3edigest-credentials))"></a><span title="Provided from: web-server/http/digest-auth | Package: web-server-lib"><span class="RktSym"><a href="#%28def._%28%28lib._web-server%2Fhttp%2Fdigest-auth..rkt%29._request-~3edigest-credentials%29%29" class="RktValDef RktValLink" data-pltdoc="x">request->digest-credentials</a></span></span><span class="hspace"> </span><span class="RktVar">req</span><span class="RktPn">)</span></p></blockquote></td></tr><tr><td><span class="hspace"> </span>→<span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=data-structure-contracts.html%23%2528def._%2528%2528lib._racket%252Fcontract%252Fbase..rkt%2529._or%252Fc%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">or/c</a></span><span class="hspace"> </span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=data-structure-contracts.html%23%2528def._%2528%2528lib._racket%252Fcontract%252Fprivate%252Fmisc..rkt%2529._false%252Fc%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">false/c</a></span><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=data-structure-contracts.html%23%2528def._%2528%2528lib._racket%252Fcontract%252Fprivate%252Fmisc..rkt%2529._listof%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">listof</a></span><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=data-structure-contracts.html%23%2528def._%2528%2528lib._racket%252Fcontract%252Fprivate%252Fmisc..rkt%2529._cons%252Fc%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">cons/c</a></span><span class="hspace"> </span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=symbols.html%23%2528def._%2528%2528quote._%7E23%7E25kernel%2529._symbol%7E3f%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">symbol?</a></span><span class="hspace"> </span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=strings.html%23%2528def._%2528%2528quote._%7E23%7E25kernel%2529._string%7E3f%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">string?</a></span><span class="RktPn">)</span><span class="RktPn">)</span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace"> </span><span class="RktVar">req</span><span class="hspace"> </span>:<span class="hspace"> </span><span class="RktSym"><a href="#%28def._%28%28lib._web-server%2Fhttp%2Frequest-structs..rkt%29._request~3f%29%29" class="RktValLink" data-pltdoc="x">request?</a></span></td></tr></table></blockquote></div><div class="SIntrapara">Returns the Digest credentials from <span class="RktVar">req</span> (if they appear) as an association list.</div></p></div><div class="SIntrapara"><p><div class="SIntrapara"><blockquote class="SVInsetFlow"><table cellspacing="0" cellpadding="0" class="boxed RBoxed"><tr><td><blockquote class="SubFlow"><div class="RBackgroundLabel SIEHidden"><div class="RBackgroundLabelInner"><p>value</p></div></div><p class="RForeground"><a name="(def._((lib._web-server/http/digest-auth..rkt)._username*realm-~3epassword/c))"></a><span title="Provided from: web-server/http/digest-auth | Package: web-server-lib"><span class="RktSym"><a href="#%28def._%28%28lib._web-server%2Fhttp%2Fdigest-auth..rkt%29._username%2Arealm-~3epassword%2Fc%29%29" class="RktValDef RktValLink" data-pltdoc="x">username*realm->password/c</a></span></span><span class="hspace"> </span>:<span class="hspace"> </span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=contract-utilities.html%23%2528def._%2528%2528lib._racket%252Fcontract%252Fprivate%252Fmisc..rkt%2529._contract%7E3f%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">contract?</a></span></p></blockquote></td></tr></table></blockquote></div><div class="SIntrapara">Used to look up the password for a user is a realm.</div></p></div><div class="SIntrapara">Equivalent to <span class="RktPn">(</span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=function-contracts.html%23%2528form._%2528%2528lib._racket%252Fcontract%252Fbase..rkt%2529._-%7E3e%2529%2529&version=6.1" class="RktStxLink Sq" data-pltdoc="x"><span class="nobreak">-></span></a></span><span class="stt"> </span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=strings.html%23%2528def._%2528%2528quote._%7E23%7E25kernel%2529._string%7E3f%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">string?</a></span><span class="stt"> </span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=strings.html%23%2528def._%2528%2528quote._%7E23%7E25kernel%2529._string%7E3f%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">string?</a></span><span class="stt"> </span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=strings.html%23%2528def._%2528%2528quote._%7E23%7E25kernel%2529._string%7E3f%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">string?</a></span><span class="RktPn">)</span>.</div><div class="SIntrapara"><p><div class="SIntrapara"><blockquote class="SVInsetFlow"><table cellspacing="0" cellpadding="0" class="boxed RBoxed"><tr><td><blockquote class="SubFlow"><div class="RBackgroundLabel SIEHidden"><div class="RBackgroundLabelInner"><p>value</p></div></div><p class="RForeground"><a name="(def._((lib._web-server/http/digest-auth..rkt)._username*realm-~3edigest-.H.A1/c))"></a><span title="Provided from: web-server/http/digest-auth | Package: web-server-lib"><span class="RktSym"><a href="#%28def._%28%28lib._web-server%2Fhttp%2Fdigest-auth..rkt%29._username%2Arealm-~3edigest-.H.A1%2Fc%29%29" class="RktValDef RktValLink" data-pltdoc="x">username*realm->digest-HA1/c</a></span></span><span class="hspace"> </span>:<span class="hspace"> </span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=contract-utilities.html%23%2528def._%2528%2528lib._racket%252Fcontract%252Fprivate%252Fmisc..rkt%2529._contract%7E3f%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">contract?</a></span></p></blockquote></td></tr></table></blockquote></div><div class="SIntrapara">Used to compute the user’s secret hash.</div></p></div><div class="SIntrapara">Equivalent to <span class="RktPn">(</span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=function-contracts.html%23%2528form._%2528%2528lib._racket%252Fcontract%252Fbase..rkt%2529._-%7E3e%2529%2529&version=6.1" class="RktStxLink Sq" data-pltdoc="x"><span class="nobreak">-></span></a></span><span class="stt"> </span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=strings.html%23%2528def._%2528%2528quote._%7E23%7E25kernel%2529._string%7E3f%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">string?</a></span><span class="stt"> </span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=strings.html%23%2528def._%2528%2528quote._%7E23%7E25kernel%2529._string%7E3f%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">string?</a></span><span class="stt"> </span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=bytestrings.html%23%2528def._%2528%2528quote._%7E23%7E25kernel%2529._bytes%7E3f%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">bytes?</a></span><span class="RktPn">)</span>.</div><div class="SIntrapara"><p><div class="SIntrapara"><blockquote class="SVInsetFlow"><table cellspacing="0" cellpadding="0" class="boxed RBoxed"><tr><td><blockquote class="SubFlow"><div class="RBackgroundLabel SIEHidden"><div class="RBackgroundLabelInner"><p>procedure</p></div></div><p class="RForeground"><span class="RktPn">(</span><a name="(def._((lib._web-server/http/digest-auth..rkt)._password-~3edigest-.H.A1))"></a><span title="Provided from: web-server/http/digest-auth | Package: web-server-lib"><span class="RktSym"><a href="#%28def._%28%28lib._web-server%2Fhttp%2Fdigest-auth..rkt%29._password-~3edigest-.H.A1%29%29" class="RktValDef RktValLink" data-pltdoc="x">password->digest-HA1</a></span></span><span class="hspace"> </span><span class="RktVar">lookup-password</span><span class="RktPn">)</span></p></blockquote></td></tr><tr><td><span class="hspace"> </span>→<span class="hspace"> </span><span class="RktSym"><a href="#%28def._%28%28lib._web-server%2Fhttp%2Fdigest-auth..rkt%29._username%2Arealm-~3edigest-.H.A1%2Fc%29%29" class="RktValLink" data-pltdoc="x">username*realm->digest-HA1/c</a></span></td></tr><tr><td><span class="hspace"> </span><span class="RktVar">lookup-password</span><span class="hspace"> </span>:<span class="hspace"> </span><span class="RktSym"><a href="#%28def._%28%28lib._web-server%2Fhttp%2Fdigest-auth..rkt%29._username%2Arealm-~3epassword%2Fc%29%29" class="RktValLink" data-pltdoc="x">username*realm->password/c</a></span></td></tr></table></blockquote></div><div class="SIntrapara">Uses <span class="RktVar">lookup-password</span> to find the password, then computes the
secret hash of it.</div></p></div><div class="SIntrapara"><p><div class="SIntrapara"><blockquote class="SVInsetFlow"><table cellspacing="0" cellpadding="0" class="boxed RBoxed"><tr><td><blockquote class="SubFlow"><div class="RBackgroundLabel SIEHidden"><div class="RBackgroundLabelInner"><p>procedure</p></div></div><p class="RForeground"><span class="RktPn">(</span><a name="(def._((lib._web-server/http/digest-auth..rkt)._make-check-digest-credentials))"></a><span title="Provided from: web-server/http/digest-auth | Package: web-server-lib"><span class="RktSym"><a href="#%28def._%28%28lib._web-server%2Fhttp%2Fdigest-auth..rkt%29._make-check-digest-credentials%29%29" class="RktValDef RktValLink" data-pltdoc="x">make-check-digest-credentials</a></span></span><span class="hspace"> </span><span class="RktVar">lookup-HA1</span><span class="RktPn">)</span></p></blockquote></td></tr><tr><td><span class="hspace"> </span>→<span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=strings.html%23%2528def._%2528%2528quote._%7E23%7E25kernel%2529._string%7E3f%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">string?</a></span><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=data-structure-contracts.html%23%2528def._%2528%2528lib._racket%252Fcontract%252Fprivate%252Fmisc..rkt%2529._listof%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">listof</a></span><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=data-structure-contracts.html%23%2528def._%2528%2528lib._racket%252Fcontract%252Fprivate%252Fmisc..rkt%2529._cons%252Fc%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">cons/c</a></span><span class="hspace"> </span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=symbols.html%23%2528def._%2528%2528quote._%7E23%7E25kernel%2529._symbol%7E3f%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">symbol?</a></span><span class="hspace"> </span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=strings.html%23%2528def._%2528%2528quote._%7E23%7E25kernel%2529._string%7E3f%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">string?</a></span><span class="RktPn">)</span><span class="RktPn">)</span><span class="hspace"> </span><span class="RktPn">. </span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=function-contracts.html%23%2528form._%2528%2528lib._racket%252Fcontract%252Fbase..rkt%2529._-%7E3e%2529%2529&version=6.1" class="RktStxLink Sq" data-pltdoc="x"><span class="nobreak">-></span></a></span><span class="RktPn"> .</span><span class="hspace"> </span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=booleans.html%23%2528def._%2528%2528quote._%7E23%7E25kernel%2529._boolean%7E3f%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">boolean?</a></span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace"> </span><span class="RktVar">lookup-HA1</span><span class="hspace"> </span>:<span class="hspace"> </span><span class="RktSym"><a href="#%28def._%28%28lib._web-server%2Fhttp%2Fdigest-auth..rkt%29._username%2Arealm-~3edigest-.H.A1%2Fc%29%29" class="RktValLink" data-pltdoc="x">username*realm->digest-HA1/c</a></span></td></tr></table></blockquote></div><div class="SIntrapara">Constructs a function that checks whether particular Digest credentials
(the second argument of the returned function) are correct given the
HTTP method provided as the first argument and the secret hash computed
by <span class="RktVar">lookup-HA1</span>.</div></p></div><div class="SIntrapara">This is will result in an exception if the Digest credentials are
missing portions.</div><div class="SIntrapara"><p><div class="SIntrapara">Example:
</div><div class="SIntrapara"><blockquote class="SCodeFlow"><table cellspacing="0" cellpadding="0" class="RktBlk"><tr><td><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=guide&rel=Module_Syntax.html%23%2528part._hash-lang%2529&version=6.1" class="RktModLink Sq" data-pltdoc="x"><span class="RktMod">#lang</span></a><span class="hspace"> </span><a href="run.html#%28mod-path._web-server%2Finsta%29" class="RktModLink" data-pltdoc="x"><span class="RktSym">web-server/insta</span></a></td></tr><tr><td><span class="RktPn">(</span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=require.html%23%2528form._%2528%2528lib._racket%252Fprivate%252Fbase..rkt%2529._require%2529%2529&version=6.1" class="RktStxLink Sq" data-pltdoc="x">require</a></span><span class="hspace"> </span><span class="RktSym">racket/pretty</span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace"> </span></td></tr><tr><td><span class="RktPn">(</span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=define.html%23%2528form._%2528%2528lib._racket%252Fprivate%252Fbase..rkt%2529._define%2529%2529&version=6.1" class="RktStxLink Sq" data-pltdoc="x">define</a></span><span class="hspace"> </span><span class="RktSym">private-key</span><span class="hspace"> </span><span class="RktVal">"private-key"</span><span class="RktPn">)</span></td></tr><tr><td><span class="RktPn">(</span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=define.html%23%2528form._%2528%2528lib._racket%252Fprivate%252Fbase..rkt%2529._define%2529%2529&version=6.1" class="RktStxLink Sq" data-pltdoc="x">define</a></span><span class="hspace"> </span><span class="RktSym">opaque</span><span class="hspace"> </span><span class="RktVal">"opaque"</span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace"> </span></td></tr><tr><td><span class="RktPn">(</span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=define.html%23%2528form._%2528%2528lib._racket%252Fprivate%252Fbase..rkt%2529._define%2529%2529&version=6.1" class="RktStxLink Sq" data-pltdoc="x">define</a></span><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym">start</span><span class="hspace"> </span><span class="RktSym">req</span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=match.html%23%2528form._%2528%2528lib._racket%252Fmatch..rkt%2529._match%2529%2529&version=6.1" class="RktStxLink Sq" data-pltdoc="x">match</a></span><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="#%28def._%28%28lib._web-server%2Fhttp%2Fdigest-auth..rkt%29._request-~3edigest-credentials%29%29" class="RktValLink" data-pltdoc="x">request->digest-credentials</a></span><span class="hspace"> </span><span class="RktSym">req</span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace"> </span><span class="RktPn">[</span><span class="RktVal">#f</span></td></tr><tr><td><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="#%28def._%28%28lib._web-server%2Fhttp%2Fresponse-structs..rkt%29._response%29%29" class="RktValLink" data-pltdoc="x">response</a></span></td></tr><tr><td><span class="hspace"> </span><span class="RktVal">401</span><span class="hspace"> </span><span class="RktVal">#"Unauthorized"</span><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=time.html%23%2528def._%2528%2528quote._%7E23%7E25kernel%2529._current-seconds%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">current-seconds</a></span><span class="RktPn">)</span><span class="hspace"> </span><span class="RktSym"><a href="#%28def._%28%28lib._web-server%2Fhttp%2Fresponse-structs..rkt%29._.T.E.X.T%2F.H.T.M.L-.M.I.M.E-.T.Y.P.E%29%29" class="RktValLink" data-pltdoc="x">TEXT/HTML-MIME-TYPE</a></span></td></tr><tr><td><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=pairs.html%23%2528def._%2528%2528quote._%7E23%7E25kernel%2529._list%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">list</a></span><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="#%28def._%28%28lib._web-server%2Fhttp%2Fdigest-auth..rkt%29._make-digest-auth-header%29%29" class="RktValLink" data-pltdoc="x">make-digest-auth-header</a></span></td></tr><tr><td><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=Writing.html%23%2528def._%2528%2528quote._%7E23%7E25kernel%2529._format%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">format</a></span><span class="hspace"> </span><span class="RktVal">"Digest Auth Test: ~a"</span><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=symbols.html%23%2528def._%2528%2528quote._%7E23%7E25kernel%2529._gensym%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">gensym</a></span><span class="RktPn">)</span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace"> </span><span class="RktSym">private-key</span><span class="hspace"> </span><span class="RktSym">opaque</span><span class="RktPn">)</span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace"> </span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=void.html%23%2528def._%2528%2528quote._%7E23%7E25kernel%2529._void%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">void</a></span><span class="RktPn">)</span><span class="RktPn">]</span></td></tr><tr><td><span class="hspace"> </span><span class="RktPn">[</span><span class="RktSym">alist</span></td></tr><tr><td><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=define.html%23%2528form._%2528%2528lib._racket%252Fprivate%252Fbase..rkt%2529._define%2529%2529&version=6.1" class="RktStxLink Sq" data-pltdoc="x">define</a></span><span class="hspace"> </span><span class="RktSym">check</span></td></tr><tr><td><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="#%28def._%28%28lib._web-server%2Fhttp%2Fdigest-auth..rkt%29._make-check-digest-credentials%29%29" class="RktValLink" data-pltdoc="x">make-check-digest-credentials</a></span></td></tr><tr><td><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="#%28def._%28%28lib._web-server%2Fhttp%2Fdigest-auth..rkt%29._password-~3edigest-.H.A1%29%29" class="RktValLink" data-pltdoc="x">password->digest-HA1</a></span><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=lambda.html%23%2528form._%2528%2528lib._racket%252Fprivate%252Fbase..rkt%2529._lambda%2529%2529&version=6.1" class="RktStxLink Sq" data-pltdoc="x">lambda</a></span><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym">username</span><span class="hspace"> </span><span class="RktSym">realm</span><span class="RktPn">)</span><span class="hspace"> </span><span class="RktVal">"pass"</span><span class="RktPn">)</span><span class="RktPn">)</span><span class="RktPn">)</span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=define.html%23%2528form._%2528%2528lib._racket%252Fprivate%252Fbase..rkt%2529._define%2529%2529&version=6.1" class="RktStxLink Sq" data-pltdoc="x">define</a></span><span class="hspace"> </span><span class="RktSym">pass?</span></td></tr><tr><td><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym">check</span><span class="hspace"> </span><span class="RktVal">"GET"</span><span class="hspace"> </span><span class="RktSym">alist</span><span class="RktPn">)</span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="#%28def._%28%28lib._web-server%2Fhttp%2Fxexpr..rkt%29._response%2Fxexpr%29%29" class="RktValLink" data-pltdoc="x">response/xexpr</a></span></td></tr><tr><td><span class="hspace"> </span><span class="RktVal">`</span><span class="RktVal">(</span><span class="RktVal">html</span><span class="hspace"> </span><span class="RktVal">(</span><span class="RktVal">head</span><span class="hspace"> </span><span class="RktVal">(</span><span class="RktVal">title</span><span class="hspace"> </span><span class="RktVal">"Digest Auth Test"</span><span class="RktVal">)</span><span class="RktVal">)</span></td></tr><tr><td><span class="hspace"> </span><span class="RktVal">(</span><span class="RktVal">body</span></td></tr><tr><td><span class="hspace"> </span><span class="RktVal">(</span><span class="RktVal">h1</span><span class="hspace"> </span><span class="RktRdr">,</span><span class="RktPn">(</span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=if.html%23%2528form._%2528%2528quote._%7E23%7E25kernel%2529._if%2529%2529&version=6.1" class="RktStxLink Sq" data-pltdoc="x">if</a></span><span class="hspace"> </span><span class="RktSym">pass?</span><span class="hspace"> </span><span class="RktVal">"Pass!"</span><span class="hspace"> </span><span class="RktVal">"No Pass!"</span><span class="RktPn">)</span><span class="RktVal">)</span></td></tr><tr><td><span class="hspace"> </span><span class="RktVal">(</span><span class="RktVal">pre</span><span class="hspace"> </span><span class="RktRdr">,</span><span class="RktPn">(</span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=pretty-print.html%23%2528def._%2528%2528lib._racket%252Fpretty..rkt%2529._pretty-format%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">pretty-format</a></span><span class="hspace"> </span><span class="RktSym">alist</span><span class="RktPn">)</span><span class="RktVal">)</span><span class="RktVal">)</span><span class="RktVal">)</span><span class="RktPn">)</span><span class="RktPn">]</span><span class="RktPn">)</span><span class="RktPn">)</span></td></tr></table></blockquote></div></p></div></p><h4 x-source-module="(lib "web-server/scribblings/web-server.scrbl")" x-part-tag=""xexpr"">4.10<tt> </tt><a name="(part._xexpr)"></a><a name="(mod-path._web-server/http/xexpr)"></a>X-expression Support</h4><p><table cellspacing="0" cellpadding="0" class="defmodule"><tr><td align="left"><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=require.html%23%2528form._%2528%2528lib._racket%252Fprivate%252Fbase..rkt%2529._require%2529%2529&version=6.1" class="RktStxLink Sq" data-pltdoc="x">require</a></span><span class="stt"> </span><a href="#%28mod-path._web-server%2Fhttp%2Fxexpr%29" class="RktModLink" data-pltdoc="x"><span class="RktSym">web-server/http/xexpr</span></a><span class="RktPn">)</span></td><td align="right"><span class="RpackageSpec"><span class="Smaller"> package:</span> <span class="stt">web-server-lib</span></span></td></tr></table></p><p><div class="SIntrapara"><blockquote class="SVInsetFlow"><table cellspacing="0" cellpadding="0" class="boxed RBoxed"><tr><td><blockquote class="SubFlow"><div class="RBackgroundLabel SIEHidden"><div class="RBackgroundLabelInner"><p>procedure</p></div></div><table cellspacing="0" cellpadding="0" class="prototype RForeground"><tr><td><span class="RktPn">(</span><a name="(def._((lib._web-server/http/xexpr..rkt)._response/xexpr))"></a><span title="Provided from: web-server/http/xexpr, web-server | Package: web-server-lib"><span class="RktSym"><a href="#%28def._%28%28lib._web-server%2Fhttp%2Fxexpr..rkt%29._response%2Fxexpr%29%29" class="RktValDef RktValLink" data-pltdoc="x">response/xexpr</a></span></span></td><td><span class="hspace"> </span></td><td><span class="RktVar">xexpr</span></td><td><span class="hspace"> </span></td><td><span class="hspace"> </span></td><td><span class="hspace"> </span></td><td><span class="hspace"> </span></td></tr><tr><td><span class="hspace"> </span></td><td><span class="hspace"> </span>[</td><td><span class="RktPn">#:code</span><span class="hspace"> </span><span class="RktVar">code</span></td><td><span class="hspace"> </span></td><td><span class="hspace"> </span></td><td><span class="hspace"> </span></td><td><span class="hspace"> </span></td></tr><tr><td><span class="hspace"> </span></td><td><span class="hspace"> </span></td><td><span class="RktPn">#:message</span><span class="hspace"> </span><span class="RktVar">message</span></td><td><span class="hspace"> </span></td><td><span class="hspace"> </span></td><td><span class="hspace"> </span></td><td><span class="hspace"> </span></td></tr><tr><td><span class="hspace"> </span></td><td><span class="hspace"> </span></td><td><span class="RktPn">#:seconds</span><span class="hspace"> </span><span class="RktVar">seconds</span></td><td><span class="hspace"> </span></td><td><span class="hspace"> </span></td><td><span class="hspace"> </span></td><td><span class="hspace"> </span></td></tr><tr><td><span class="hspace"> </span></td><td><span class="hspace"> </span></td><td><span class="RktPn">#:mime-type</span><span class="hspace"> </span><span class="RktVar">mime-type</span></td><td><span class="hspace"> </span></td><td><span class="hspace"> </span></td><td><span class="hspace"> </span></td><td><span class="hspace"> </span></td></tr><tr><td><span class="hspace"> </span></td><td><span class="hspace"> </span></td><td><span class="RktPn">#:headers</span><span class="hspace"> </span><span class="RktVar">headers</span></td><td><span class="hspace"> </span></td><td><span class="hspace"> </span></td><td><span class="hspace"> </span></td><td><span class="hspace"> </span></td></tr><tr><td><span class="hspace"> </span></td><td><span class="hspace"> </span></td><td><span class="RktPn">#:cookies</span><span class="hspace"> </span><span class="RktVar">cookies</span></td><td><span class="hspace"> </span></td><td><span class="hspace"> </span></td><td><span class="hspace"> </span></td><td><span class="hspace"> </span></td></tr><tr><td><span class="hspace"> </span></td><td><span class="hspace"> </span></td><td><span class="RktPn">#:preamble</span><span class="hspace"> </span><span class="RktVar">preamble</span>]<span class="RktPn">)</span></td><td><span class="hspace"> </span></td><td>→</td><td><span class="hspace"> </span></td><td><span class="RktSym"><a href="#%28def._%28%28lib._web-server%2Fhttp%2Fresponse-structs..rkt%29._response~3f%29%29" class="RktValLink" data-pltdoc="x">response?</a></span></td></tr></table></blockquote></td></tr><tr><td><span class="hspace"> </span><span class="RktVar">xexpr</span><span class="hspace"> </span>:<span class="hspace"> </span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=xml&rel=index.html%23%2528def._%2528%2528lib._xml%252Fprivate%252Fxexpr-core..rkt%2529._xexpr%252Fc%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">xexpr/c</a></span></td></tr><tr><td><span class="hspace"> </span><span class="RktVar">code</span><span class="hspace"> </span>:<span class="hspace"> </span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=number-types.html%23%2528def._%2528%2528quote._%7E23%7E25kernel%2529._number%7E3f%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">number?</a></span><span class="hspace"> </span>=<span class="hspace"> </span><span class="RktVal">200</span></td></tr><tr><td><span class="hspace"> </span><span class="RktVar">message</span><span class="hspace"> </span>:<span class="hspace"> </span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=bytestrings.html%23%2528def._%2528%2528quote._%7E23%7E25kernel%2529._bytes%7E3f%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">bytes?</a></span><span class="hspace"> </span>=<span class="hspace"> </span><span class="RktVal">#"Okay"</span></td></tr><tr><td><span class="hspace"> </span><span class="RktVar">seconds</span><span class="hspace"> </span>:<span class="hspace"> </span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=number-types.html%23%2528def._%2528%2528quote._%7E23%7E25kernel%2529._number%7E3f%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">number?</a></span><span class="hspace"> </span>=<span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=time.html%23%2528def._%2528%2528quote._%7E23%7E25kernel%2529._current-seconds%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">current-seconds</a></span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace"> </span><span class="RktVar">mime-type</span><span class="hspace"> </span>:<span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=data-structure-contracts.html%23%2528def._%2528%2528lib._racket%252Fcontract%252Fbase..rkt%2529._or%252Fc%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">or/c</a></span><span class="hspace"> </span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=data-structure-contracts.html%23%2528def._%2528%2528lib._racket%252Fcontract%252Fprivate%252Fmisc..rkt%2529._false%252Fc%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">false/c</a></span><span class="hspace"> </span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=bytestrings.html%23%2528def._%2528%2528quote._%7E23%7E25kernel%2529._bytes%7E3f%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">bytes?</a></span><span class="RktPn">)</span><span class="hspace"> </span>=<span class="hspace"> </span><span class="RktSym"><a href="#%28def._%28%28lib._web-server%2Fhttp%2Fresponse-structs..rkt%29._.T.E.X.T%2F.H.T.M.L-.M.I.M.E-.T.Y.P.E%29%29" class="RktValLink" data-pltdoc="x">TEXT/HTML-MIME-TYPE</a></span></td></tr><tr><td><span class="hspace"> </span><span class="RktVar">headers</span><span class="hspace"> </span>:<span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=data-structure-contracts.html%23%2528def._%2528%2528lib._racket%252Fcontract%252Fprivate%252Fmisc..rkt%2529._listof%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">listof</a></span><span class="hspace"> </span><span class="RktSym"><a href="#%28def._%28%28lib._web-server%2Fhttp%2Frequest-structs..rkt%29._header~3f%29%29" class="RktValLink" data-pltdoc="x">header?</a></span><span class="RktPn">)</span><span class="hspace"> </span>=<span class="hspace"> </span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=pairs.html%23%2528def._%2528%2528lib._racket%252Flist..rkt%2529._empty%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">empty</a></span></td></tr><tr><td><span class="hspace"> </span><span class="RktVar">cookies</span><span class="hspace"> </span>:<span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=data-structure-contracts.html%23%2528def._%2528%2528lib._racket%252Fcontract%252Fprivate%252Fmisc..rkt%2529._listof%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">listof</a></span><span class="hspace"> </span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=net&rel=cookie.html%23%2528def._%2528%2528lib._net%252Fcookie..rkt%2529._cookie%7E3f%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">cookie?</a></span><span class="RktPn">)</span><span class="hspace"> </span>=<span class="hspace"> </span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=pairs.html%23%2528def._%2528%2528lib._racket%252Flist..rkt%2529._empty%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">empty</a></span></td></tr><tr><td><span class="hspace"> </span><span class="RktVar">preamble</span><span class="hspace"> </span>:<span class="hspace"> </span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=bytestrings.html%23%2528def._%2528%2528quote._%7E23%7E25kernel%2529._bytes%7E3f%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">bytes?</a></span><span class="hspace"> </span>=<span class="hspace"> </span><span class="RktVal">#""</span></td></tr></table></blockquote></div><div class="SIntrapara">Equivalent to
</div><div class="SIntrapara"><blockquote class="SCodeFlow"><table cellspacing="0" cellpadding="0" class="RktBlk"><tr><td><span class="RktPn">(</span><span class="RktSym"><a href="#%28def._%28%28lib._web-server%2Fhttp%2Fresponse-structs..rkt%29._response%2Ffull%29%29" class="RktValLink" data-pltdoc="x">response/full</a></span></td></tr><tr><td><span class="hspace"> </span><span class="RktVar">code</span><span class="hspace"> </span><span class="RktVar">message</span><span class="hspace"> </span><span class="RktVar">seconds</span><span class="hspace"> </span><span class="RktVar">mime-type</span></td></tr><tr><td><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=pairs.html%23%2528def._%2528%2528quote._%7E23%7E25kernel%2529._append%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">append</a></span><span class="hspace"> </span><span class="RktVar">headers</span><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=pairs.html%23%2528def._%2528%2528lib._racket%252Fprivate%252Fmap..rkt%2529._map%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">map</a></span><span class="hspace"> </span><span class="RktSym"><a href="#%28def._%28%28lib._web-server%2Fhttp%2Fcookie..rkt%29._cookie-~3eheader%29%29" class="RktValLink" data-pltdoc="x">cookie->header</a></span><span class="hspace"> </span><span class="RktVar">cookies</span><span class="RktPn">)</span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=pairs.html%23%2528def._%2528%2528quote._%7E23%7E25kernel%2529._list%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">list</a></span><span class="hspace"> </span><span class="RktVar">preamble</span><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=bytestrings.html%23%2528def._%2528%2528quote._%7E23%7E25kernel%2529._string-%7E3ebytes%252Futf-8%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">string->bytes/utf-8</a></span><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=xml&rel=index.html%23%2528def._%2528%2528lib._xml%252Fmain..rkt%2529._xexpr-%7E3estring%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">xexpr->string</a></span><span class="hspace"> </span><span class="RktVar">xexpr</span><span class="RktPn">)</span><span class="RktPn">)</span><span class="RktPn">)</span><span class="RktPn">)</span></td></tr></table></blockquote></div></p><p>This is a viable function to pass to <span class="RktSym"><a href="servlet.html#%28def._%28%28lib._web-server%2Fservlet%2Fservlet-structs..rkt%29._set-any-~3eresponse%21%29%29" class="RktValLink" data-pltdoc="x">set-any->response!</a></span>.</p><div class="navsetbottom"><span class="navleft"><form class="searchform"><input class="searchbox" style="color: #888;" type="text" value="...search manuals..." title="Enter a search string to search the manuals" onkeypress="return DoSearchKey(event, this, "6.1", "../");" onfocus="this.style.color="black"; this.style.textAlign="left"; if (this.value == "...search manuals...") this.value="";" onblur="if (this.value.match(/^ *$/)) { this.style.color="#888"; this.style.textAlign="center"; this.value="...search manuals..."; }"/></form> <a href="../index.html" title="up to the documentation top" data-pltdoc="x" onclick="return GotoPLTRoot("6.1");">top</a></span><span class="navright"> <a href="stateless.html" title="backward to "3 Stateless Servlets"" data-pltdoc="x">← prev</a> <a href="index.html" title="up to "Web Applications in Racket"" data-pltdoc="x">up</a> <a href="dispatch.html" title="forward to "5 URL-Based Dispatch"" data-pltdoc="x">next →</a></span> </div></div></div><div id="contextindicator"> </div></body></html>
|