/usr/share/doc/racket/web-server-internal/dispatch.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 | <!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>2.1 General</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 Server:<span class="mywbr"> </span> HTTP Server</a></td></tr></table></div><div class="tocviewsublisttop" style="display: none;" id="tocview_0"><table cellspacing="0" cellpadding="0"><tr><td align="right">1 </td><td><a href="dispatch-server-unit.html" class="tocviewlink" data-pltdoc="x">Dispatching Server</a></td></tr><tr><td align="right">2 </td><td><a href="dispatchers.html" class="tocviewselflink" data-pltdoc="x">Dispatchers</a></td></tr><tr><td align="right">3 </td><td><a href="web-server.html" class="tocviewlink" data-pltdoc="x">Launching Servers</a></td></tr><tr><td align="right">4 </td><td><a href="Web_Servers.html" class="tocviewlink" data-pltdoc="x">Web Servers</a></td></tr><tr><td align="right">5 </td><td><a href="private.html" class="tocviewlink" data-pltdoc="x">Internal APIs</a></td></tr><tr><td align="right">6 </td><td><a href="Troubleshooting_and_Tips.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>2 </td><td><a href="dispatchers.html" class="tocviewlink" data-pltdoc="x">Dispatchers</a></td></tr></table><div class="tocviewsublistbottom" style="display: block;" id="tocview_1"><table cellspacing="0" cellpadding="0"><tr><td align="right">2.1 </td><td><a href="" class="tocviewselflink" data-pltdoc="x">General</a></td></tr><tr><td align="right">2.2 </td><td><a href="filesystem-map.html" class="tocviewlink" data-pltdoc="x">Mapping URLs to Paths</a></td></tr><tr><td align="right">2.3 </td><td><a href="dispatch-sequencer.html" class="tocviewlink" data-pltdoc="x">Sequencing</a></td></tr><tr><td align="right">2.4 </td><td><a href="dispatch-timeout.html" class="tocviewlink" data-pltdoc="x">Timeouts</a></td></tr><tr><td align="right">2.5 </td><td><a href="dispatch-lift.html" class="tocviewlink" data-pltdoc="x">Lifting Procedures</a></td></tr><tr><td align="right">2.6 </td><td><a href="dispatch-filter.html" class="tocviewlink" data-pltdoc="x">Filtering Requests</a></td></tr><tr><td align="right">2.7 </td><td><a href="dispatch-pathprocedure.html" class="tocviewlink" data-pltdoc="x">Procedure Invocation upon Request</a></td></tr><tr><td align="right">2.8 </td><td><a href="dispatch-log.html" class="tocviewlink" data-pltdoc="x">Logging</a></td></tr><tr><td align="right">2.9 </td><td><a href="dispatch-passwords.html" class="tocviewlink" data-pltdoc="x">Password Protection</a></td></tr><tr><td align="right">2.10 </td><td><a href="dispatch-host.html" class="tocviewlink" data-pltdoc="x">Virtual Hosts</a></td></tr><tr><td align="right">2.11 </td><td><a href="dispatch-files.html" class="tocviewlink" data-pltdoc="x">Serving Files</a></td></tr><tr><td align="right">2.12 </td><td><a href="dispatch-servlets.html" class="tocviewlink" data-pltdoc="x">Serving Servlets</a></td></tr><tr><td align="right">2.13 </td><td><a href="dispatch-stat.html" class="tocviewlink" data-pltdoc="x">Statistics</a></td></tr><tr><td align="right">2.14 </td><td><a href="limit.html" class="tocviewlink" data-pltdoc="x">Limiting Requests</a></td></tr></table></div></div></div><div class="tocsub"><div class="tocsubtitle">On this page:</div><table class="tocsublist" cellspacing="0"><tr><td><a href="#%28def._%28%28lib._web-server%2Fdispatchers%2Fdispatch..rkt%29._dispatcher%2Fc%29%29" class="tocsublink" data-pltdoc="x"><span class="RktSym"><span class="RktValLink">dispatcher/<span class="mywbr"> </span>c</span></span></a></td></tr><tr><td><a href="#%28def._%28%28lib._web-server%2Fdispatchers%2Fdispatch..rkt%29._dispatcher-interface-version%2Fc%29%29" class="tocsublink" data-pltdoc="x"><span class="RktSym"><span class="RktValLink">dispatcher-<wbr></wbr>interface-<wbr></wbr>version/<span class="mywbr"> </span>c</span></span></a></td></tr><tr><td><a href="#%28def._%28%28lib._web-server%2Fdispatchers%2Fdispatch..rkt%29._exn~3adispatcher%29%29" class="tocsublink" data-pltdoc="x"><span class="RktSym"><span class="RktValLink">exn:<span class="mywbr"> </span>dispatcher</span></span></a></td></tr><tr><td><a href="#%28def._%28%28lib._web-server%2Fdispatchers%2Fdispatch..rkt%29._next-dispatcher%29%29" class="tocsublink" data-pltdoc="x"><span class="RktSym"><span class="RktValLink">next-<wbr></wbr>dispatcher</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="dispatchers.html" title="backward to "2 Dispatchers"" data-pltdoc="x">← prev</a> <a href="dispatchers.html" title="up to "2 Dispatchers"" data-pltdoc="x">up</a> <a href="filesystem-map.html" title="forward to "2.2 Mapping URLs to Paths"" data-pltdoc="x">next →</a></span> </div><h4 x-source-module="(lib "web-server/scribblings/web-server-internal.scrbl")" x-part-tag=""dispatch"">2.1<tt> </tt><a name="(part._dispatch)"></a><a name="(mod-path._web-server/dispatchers/dispatch)"></a>General</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="" class="RktModLink" data-pltdoc="x"><span class="RktSym">web-server/dispatchers/dispatch</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 a few functions for dispatchers in general.</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/dispatchers/dispatch..rkt)._dispatcher/c))"></a><span title="Provided from: web-server/dispatchers/dispatch | Package: web-server-lib"><span class="RktSym"><a href="#%28def._%28%28lib._web-server%2Fdispatchers%2Fdispatch..rkt%29._dispatcher%2Fc%29%29" class="RktValDef RktValLink" data-pltdoc="x">dispatcher/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">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="connection-manager.html#%28def._%28%28lib._web-server%2Fprivate%2Fconnection-manager..rkt%29._connection~3f%29%29" class="RktValLink" data-pltdoc="x">connection?</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=web-server&rel=http.html%23%2528def._%2528%2528lib._web-server%252Fhttp%252Frequest-structs..rkt%2529._request%7E3f%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">request?</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=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>.</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/dispatchers/dispatch..rkt)._dispatcher-interface-version/c))"></a><span title="Provided from: web-server/dispatchers/dispatch | Package: web-server-lib"><span class="RktSym"><a href="#%28def._%28%28lib._web-server%2Fdispatchers%2Fdispatch..rkt%29._dispatcher-interface-version%2Fc%29%29" class="RktValDef RktValLink" data-pltdoc="x">dispatcher-interface-version/c</a></span></span><span class="hspace"> </span><span class="RktVar">any</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">any</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">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=data-structure-contracts.html%23%2528def._%2528%2528lib._racket%252Fcontract%252Fbase..rkt%2529._symbols%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">symbols</a></span><span class="stt"> </span><span class="RktVal">'</span><span class="RktVal">v1</span><span class="RktPn">)</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/dispatchers/dispatch..rkt)._make-exn~3adispatcher))"></a><a name="(def._((lib._web-server/dispatchers/dispatch..rkt)._exn~3adispatcher~3f))"></a><a name="(def._((lib._web-server/dispatchers/dispatch..rkt)._struct~3aexn~3adispatcher))"></a><a name="(def._((lib._web-server/dispatchers/dispatch..rkt)._exn~3adispatcher))"></a><span title="Provided from: web-server/dispatchers/dispatch | Package: web-server-lib"><span class="RktSym"><a href="#%28def._%28%28lib._web-server%2Fdispatchers%2Fdispatch..rkt%29._exn~3adispatcher%29%29" class="RktValDef RktValLink" data-pltdoc="x">exn:dispatcher</a></span></span><span class="hspace"> </span><span class="RktPn">(</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%2Fdispatchers%2Fdispatch..rkt%29._make-exn~3adispatcher%29%29" class="RktValLink" data-pltdoc="x">make-exn:dispatcher</a></span><span class="RktPn">)</span></td></tr></table></blockquote></div><div class="SIntrapara">An exception thrown to indicate that a dispatcher does not apply to a particular
request.</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/dispatchers/dispatch..rkt)._next-dispatcher))"></a><span title="Provided from: web-server/dispatchers/dispatch | Package: web-server-lib"><span class="RktSym"><a href="#%28def._%28%28lib._web-server%2Fdispatchers%2Fdispatch..rkt%29._next-dispatcher%29%29" class="RktValDef RktValLink" data-pltdoc="x">next-dispatcher</a></span></span><span class="RktPn"></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=void.html%23%2528def._%2528%2528quote._%7E23%7E25kernel%2529._void%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">void</a></span></p></blockquote></td></tr></table></blockquote></div><div class="SIntrapara">Raises a <span class="RktSym"><a href="#%28def._%28%28lib._web-server%2Fdispatchers%2Fdispatch..rkt%29._exn~3adispatcher%29%29" class="RktValLink" data-pltdoc="x">exn:dispatcher</a></span></div></p></div><div class="SIntrapara">As the <span class="RktSym"><a href="#%28def._%28%28lib._web-server%2Fdispatchers%2Fdispatch..rkt%29._dispatcher%2Fc%29%29" class="RktValLink" data-pltdoc="x">dispatcher/c</a></span> contract suggests, a dispatcher is a function that takes a connection
and request object and does something to them. Mostly likely it will generate
some response and output it on the connection, but it may do something
different. For example, it may apply some test to the request object, perhaps
checking for a valid source IP address, and error if the test is not passed, and call <span class="RktSym"><a href="#%28def._%28%28lib._web-server%2Fdispatchers%2Fdispatch..rkt%29._next-dispatcher%29%29" class="RktValLink" data-pltdoc="x">next-dispatcher</a></span>
otherwise.</div><div class="SIntrapara"><p><div class="SIntrapara">Consider the following example dispatcher, that captures the essence of URL rewriting:
</div><div class="SIntrapara"><blockquote class="SCodeFlow"><table cellspacing="0" cellpadding="0" class="RktBlk"><tr><td><span class="RktCmt">;</span><span class="RktCmt"> </span><span class="RktCmt">(url? -> url?) dispatcher/c -> dispatcher/c</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=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">rule</span><span class="hspace"> </span><span class="RktSym">inner</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._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">conn</span><span class="hspace"> </span><span class="RktSym">req</span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace"> </span><span class="RktCmt">;</span><span class="RktCmt"> </span><span class="RktCmt">Call the inner dispatcher...</span></td></tr><tr><td><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym">inner</span><span class="hspace"> </span><span class="RktSym">conn</span></td></tr><tr><td><span class="hspace"> </span><span class="RktCmt">;</span><span class="RktCmt"> </span><span class="RktCmt">with a new request object...</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=struct-copy.html%23%2528form._%2528%2528lib._racket%252Fprivate%252Fbase..rkt%2529._struct-copy%2529%2529&version=6.1" class="RktStxLink Sq" data-pltdoc="x">struct-copy</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=web-server&rel=http.html%23%2528def._%2528%2528lib._web-server%252Fhttp%252Frequest-structs..rkt%2529._request%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">request</a></span><span class="hspace"> </span><span class="RktSym">req</span></td></tr><tr><td><span class="hspace"> </span><span class="RktCmt">;</span><span class="RktCmt"> </span><span class="RktCmt">with a new URL!</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=web-server&rel=http.html%23%2528def._%2528%2528lib._web-server%252Fhttp%252Frequest-structs..rkt%2529._request-uri%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">request-uri</a></span><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym">rule</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=web-server&rel=http.html%23%2528def._%2528%2528lib._web-server%252Fhttp%252Frequest-structs..rkt%2529._request-uri%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">request-uri</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><span class="RktPn">)</span><span class="RktPn">)</span><span class="RktPn">)</span></td></tr></table></blockquote></div></p></div></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="dispatchers.html" title="backward to "2 Dispatchers"" data-pltdoc="x">← prev</a> <a href="dispatchers.html" title="up to "2 Dispatchers"" data-pltdoc="x">up</a> <a href="filesystem-map.html" title="forward to "2.2 Mapping URLs to Paths"" data-pltdoc="x">next →</a></span> </div></div></div><div id="contextindicator"> </div></body></html>
|