Sophie

Sophie

distrib > Fedora > 15 > i386 > by-pkgid > 4c19bf42876fb9e575c4d0c8587aebd9 > files > 11

ghc-wai-devel-0.4.2-1.fc15.i686.rpm

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>Network.Wai</title><link href="ocean.css" rel="stylesheet" type="text/css" title="Ocean" /><script src="haddock-util.js" type="text/javascript"></script><script type="text/javascript">//<![CDATA[
window.onload = function () {pageLoad();setSynopsis("mini_Network-Wai.html");};
//]]>
</script></head><body><div id="package-header"><ul class="links" id="page-menu"><li><a href="src/Network-Wai.html">Source</a></li><li><a href="index.html">Contents</a></li><li><a href="doc-index.html">Index</a></li></ul><p class="caption">wai-0.4.2: Web Application Interface.</p></div><div id="content"><div id="module-header"><p class="caption">Network.Wai</p></div><div id="table-of-contents"><p class="caption">Contents</p><ul><li><a href="#g:1">WAI interface
</a></li><li><a href="#g:2">Response body smart constructors
</a></li></ul></div><div id="description"><p class="caption">Description</p><div class="doc"><p>This module defines a generic web application interface. It is a common
protocol between web servers and web applications.
</p><p>The overriding design principles here are performance and generality . To
address performance, this library is built on top of the enumerator and
blaze-builder packages.  The advantages of enumerators over lazy IO have been
debated elsewhere and so will not be addressed here.  However, helper functions
like <code><a href="Network-Wai.html#v:responseLBS">responseLBS</a></code> allow you to continue using lazy IO if you so desire.
</p><p>Generality is achieved by removing many variables commonly found in similar
projects that are not universal to all servers. The goal is that the <code><a href="Network-Wai.html#t:Request">Request</a></code>
object contains only data which is meaningful in all circumstances.
</p><p>Please remember when using this package that, while your application may
compile without a hitch against many different servers, there are other
considerations to be taken when moving to a new backend. For example, if you
transfer from a CGI application to a FastCGI one, you might suddenly find you
have a memory leak. Conversely, a FastCGI application would be well served to
preload all templates from disk when first starting; this would kill the
performance of a CGI application.
</p><p>This package purposely provides very little functionality. You can find various
middlewares, backends and utilities on Hackage. Some of the most commonly used
include:
</p><dl><dt>warp</dt><dd> <a href="http://hackage.haskell.org/package/warp">http://hackage.haskell.org/package/warp</a>
</dd><dt>wai-extra</dt><dd> <a href="http://hackage.haskell.org/package/wai-extra">http://hackage.haskell.org/package/wai-extra</a>
</dd><dt>wai-test</dt><dd> <a href="http://hackage.haskell.org/package/wai-test">http://hackage.haskell.org/package/wai-test</a>
</dd></dl></div></div><div id="synopsis"><p id="control.syn" class="caption expander" onclick="toggleSection('syn')">Synopsis</p><ul id="section.syn" class="hide" onclick="toggleSection('syn')"><li class="src short"><span class="keyword">data</span>  <a href="#t:Request">Request</a>  = <a href="#v:Request">Request</a> {<ul class="subs"><li><a href="#v:requestMethod">requestMethod</a> :: <a href="/usr/share/doc/ghc/html/libraries/http-types-0.6.5/Network-HTTP-Types.html#t:Method">Method</a></li><li><a href="#v:httpVersion">httpVersion</a> :: <a href="/usr/share/doc/ghc/html/libraries/http-types-0.6.5/Network-HTTP-Types.html#t:HttpVersion">HttpVersion</a></li><li><a href="#v:rawPathInfo">rawPathInfo</a> :: <a href="/usr/share/doc/ghc/html/libraries/bytestring-0.9.1.10/Data-ByteString.html#t:ByteString">ByteString</a></li><li><a href="#v:rawQueryString">rawQueryString</a> :: <a href="/usr/share/doc/ghc/html/libraries/bytestring-0.9.1.10/Data-ByteString.html#t:ByteString">ByteString</a></li><li><a href="#v:serverName">serverName</a> :: <a href="/usr/share/doc/ghc/html/libraries/bytestring-0.9.1.10/Data-ByteString.html#t:ByteString">ByteString</a></li><li><a href="#v:serverPort">serverPort</a> :: <a href="/usr/share/doc/ghc/html/libraries/base-4.3.1.0/Data-Int.html#t:Int">Int</a></li><li><a href="#v:requestHeaders">requestHeaders</a> :: <a href="/usr/share/doc/ghc/html/libraries/http-types-0.6.5/Network-HTTP-Types.html#t:RequestHeaders">RequestHeaders</a></li><li><a href="#v:isSecure">isSecure</a> :: <a href="/usr/share/doc/ghc/html/libraries/base-4.3.1.0/Data-Bool.html#t:Bool">Bool</a></li><li><a href="#v:remoteHost">remoteHost</a> :: <a href="/usr/share/doc/ghc/html/libraries/network-2.3.0.2/Network-Socket-Internal.html#t:SockAddr">SockAddr</a></li><li><a href="#v:pathInfo">pathInfo</a> :: [<a href="/usr/share/doc/ghc/html/libraries/text-0.11.0.5/Data-Text-Internal.html#t:Text">Text</a>]</li><li><a href="#v:queryString">queryString</a> :: <a href="/usr/share/doc/ghc/html/libraries/http-types-0.6.5/Network-HTTP-Types.html#t:Query">Query</a></li></ul>}</li><li class="src short"><span class="keyword">data</span>  <a href="#t:Response">Response</a> <ul class="subs"><li>= <a href="#v:ResponseFile">ResponseFile</a> <a href="/usr/share/doc/ghc/html/libraries/http-types-0.6.5/Network-HTTP-Types.html#t:Status">Status</a> <a href="/usr/share/doc/ghc/html/libraries/http-types-0.6.5/Network-HTTP-Types.html#t:ResponseHeaders">ResponseHeaders</a> <a href="/usr/share/doc/ghc/html/libraries/base-4.3.1.0/System-IO.html#t:FilePath">FilePath</a> (<a href="/usr/share/doc/ghc/html/libraries/base-4.3.1.0/Data-Maybe.html#t:Maybe">Maybe</a> <a href="Network-Wai.html#t:FilePart">FilePart</a>)  </li><li>| <a href="#v:ResponseBuilder">ResponseBuilder</a> <a href="/usr/share/doc/ghc/html/libraries/http-types-0.6.5/Network-HTTP-Types.html#t:Status">Status</a> <a href="/usr/share/doc/ghc/html/libraries/http-types-0.6.5/Network-HTTP-Types.html#t:ResponseHeaders">ResponseHeaders</a> <a href="/usr/share/doc/ghc/html/libraries/blaze-builder-0.2.1.4/Blaze-ByteString-Builder-Internal-Types.html#t:Builder">Builder</a>  </li><li>| <a href="#v:ResponseEnumerator">ResponseEnumerator</a> (<span class="keyword">forall</span> a.  <a href="Network-Wai.html#t:ResponseEnumerator">ResponseEnumerator</a> a)  </li></ul></li><li class="src short"><span class="keyword">type</span> <a href="#t:ResponseEnumerator">ResponseEnumerator</a> a = (<a href="/usr/share/doc/ghc/html/libraries/http-types-0.6.5/Network-HTTP-Types.html#t:Status">Status</a> -&gt; <a href="/usr/share/doc/ghc/html/libraries/http-types-0.6.5/Network-HTTP-Types.html#t:ResponseHeaders">ResponseHeaders</a> -&gt; <a href="/usr/share/doc/ghc/html/libraries/enumerator-0.4.13.1/Data-Enumerator.html#t:Iteratee">Iteratee</a> <a href="/usr/share/doc/ghc/html/libraries/blaze-builder-0.2.1.4/Blaze-ByteString-Builder-Internal-Types.html#t:Builder">Builder</a> <a href="/usr/share/doc/ghc/html/libraries/base-4.3.1.0/System-IO.html#t:IO">IO</a> a) -&gt; <a href="/usr/share/doc/ghc/html/libraries/base-4.3.1.0/System-IO.html#t:IO">IO</a> a</li><li class="src short"><a href="#v:responseEnumerator">responseEnumerator</a> ::  <a href="Network-Wai.html#t:Response">Response</a> -&gt; <a href="Network-Wai.html#t:ResponseEnumerator">ResponseEnumerator</a> a</li><li class="src short"><span class="keyword">type</span> <a href="#t:Application">Application</a> = <a href="Network-Wai.html#t:Request">Request</a> -&gt; <a href="/usr/share/doc/ghc/html/libraries/enumerator-0.4.13.1/Data-Enumerator.html#t:Iteratee">Iteratee</a> <a href="/usr/share/doc/ghc/html/libraries/bytestring-0.9.1.10/Data-ByteString.html#t:ByteString">ByteString</a> <a href="/usr/share/doc/ghc/html/libraries/base-4.3.1.0/System-IO.html#t:IO">IO</a> <a href="Network-Wai.html#t:Response">Response</a></li><li class="src short"><span class="keyword">type</span> <a href="#t:Middleware">Middleware</a> = <a href="Network-Wai.html#t:Application">Application</a> -&gt; <a href="Network-Wai.html#t:Application">Application</a></li><li class="src short"><span class="keyword">data</span>  <a href="#t:FilePart">FilePart</a>  = <a href="#v:FilePart">FilePart</a> {<ul class="subs"><li><a href="#v:filePartOffset">filePartOffset</a> :: <a href="/usr/share/doc/ghc/html/libraries/base-4.3.1.0/Prelude.html#t:Integer">Integer</a></li><li><a href="#v:filePartByteCount">filePartByteCount</a> :: <a href="/usr/share/doc/ghc/html/libraries/base-4.3.1.0/Prelude.html#t:Integer">Integer</a></li></ul>}</li><li class="src short"><a href="#v:responseLBS">responseLBS</a> :: <a href="/usr/share/doc/ghc/html/libraries/http-types-0.6.5/Network-HTTP-Types.html#t:Status">Status</a> -&gt; <a href="/usr/share/doc/ghc/html/libraries/http-types-0.6.5/Network-HTTP-Types.html#t:ResponseHeaders">ResponseHeaders</a> -&gt; <a href="/usr/share/doc/ghc/html/libraries/bytestring-0.9.1.10/Data-ByteString-Lazy.html#t:ByteString">ByteString</a> -&gt; <a href="Network-Wai.html#t:Response">Response</a></li></ul></div><div id="interface"><h1 id="g:1">WAI interface
</h1><div class="top"><p class="src"><span class="keyword">data</span>  <a name="t:Request" class="def">Request</a>  <a href="src/Network-Wai.html#Request" class="link">Source</a></p><div class="doc"><p>Information on the request sent by the client. This abstracts away the
 details of the underlying implementation.
</p></div><div class="subs constructors"><p class="caption">Constructors</p><table><tr><td class="src"><a name="v:Request" class="def">Request</a></td><td class="doc empty">&nbsp;</td></tr><tr><td colspan="2"><div class="subs fields"><p class="caption">Fields</p><dl><dt class="src"><a name="v:requestMethod" class="def">requestMethod</a> :: <a href="/usr/share/doc/ghc/html/libraries/http-types-0.6.5/Network-HTTP-Types.html#t:Method">Method</a></dt><dd class="doc empty">&nbsp;</dd><dt class="src"><a name="v:httpVersion" class="def">httpVersion</a> :: <a href="/usr/share/doc/ghc/html/libraries/http-types-0.6.5/Network-HTTP-Types.html#t:HttpVersion">HttpVersion</a></dt><dd class="doc empty">&nbsp;</dd><dt class="src"><a name="v:rawPathInfo" class="def">rawPathInfo</a> :: <a href="/usr/share/doc/ghc/html/libraries/bytestring-0.9.1.10/Data-ByteString.html#t:ByteString">ByteString</a></dt><dd class="doc"><p>Extra path information sent by the client. The meaning varies slightly
 depending on backend; in a standalone server setting, this is most likely
 all information after the domain name. In a CGI application, this would be
 the information following the path to the CGI executable itself.
 Do not modify this raw value- modify pathInfo instead.
</p></dd><dt class="src"><a name="v:rawQueryString" class="def">rawQueryString</a> :: <a href="/usr/share/doc/ghc/html/libraries/bytestring-0.9.1.10/Data-ByteString.html#t:ByteString">ByteString</a></dt><dd class="doc"><p>If no query string was specified, this should be empty. This value
 <em>will</em> include the leading question mark.
 Do not modify this raw value- modify queryString instead.
</p></dd><dt class="src"><a name="v:serverName" class="def">serverName</a> :: <a href="/usr/share/doc/ghc/html/libraries/bytestring-0.9.1.10/Data-ByteString.html#t:ByteString">ByteString</a></dt><dd class="doc"><p>Generally the host requested by the user via the Host request header.
 Backends are free to provide alternative values as necessary. This value
 should not be used to construct URLs.
</p></dd><dt class="src"><a name="v:serverPort" class="def">serverPort</a> :: <a href="/usr/share/doc/ghc/html/libraries/base-4.3.1.0/Data-Int.html#t:Int">Int</a></dt><dd class="doc"><p>The listening port that the server received this request on. It is
 possible for a server to listen on a non-numeric port (i.e., Unix named
 socket), in which case this value will be arbitrary. Like <code><a href="Network-Wai.html#v:serverName">serverName</a></code>,
 this value should not be used in URL construction.
</p></dd><dt class="src"><a name="v:requestHeaders" class="def">requestHeaders</a> :: <a href="/usr/share/doc/ghc/html/libraries/http-types-0.6.5/Network-HTTP-Types.html#t:RequestHeaders">RequestHeaders</a></dt><dd class="doc empty">&nbsp;</dd><dt class="src"><a name="v:isSecure" class="def">isSecure</a> :: <a href="/usr/share/doc/ghc/html/libraries/base-4.3.1.0/Data-Bool.html#t:Bool">Bool</a></dt><dd class="doc"><p>Was this request made over an SSL connection?
</p></dd><dt class="src"><a name="v:remoteHost" class="def">remoteHost</a> :: <a href="/usr/share/doc/ghc/html/libraries/network-2.3.0.2/Network-Socket-Internal.html#t:SockAddr">SockAddr</a></dt><dd class="doc"><p>The client's host information.
</p></dd><dt class="src"><a name="v:pathInfo" class="def">pathInfo</a> :: [<a href="/usr/share/doc/ghc/html/libraries/text-0.11.0.5/Data-Text-Internal.html#t:Text">Text</a>]</dt><dd class="doc"><p>Path info in individual pieces- the url without a hostname/port and without a query string, split on forward slashes,
</p></dd><dt class="src"><a name="v:queryString" class="def">queryString</a> :: <a href="/usr/share/doc/ghc/html/libraries/http-types-0.6.5/Network-HTTP-Types.html#t:Query">Query</a></dt><dd class="doc"><p>Parsed query string information
</p></dd></dl><div class="clear"></div></div></td></tr></table></div><div class="subs instances"><p id="control.i:Request" class="caption collapser" onclick="toggleSection('i:Request')">Instances</p><div id="section.i:Request" class="show"><table><tr><td class="src"><a href="/usr/share/doc/ghc/html/libraries/base-4.3.1.0/Text-Show.html#t:Show">Show</a> <a href="Network-Wai.html#t:Request">Request</a></td><td class="doc empty">&nbsp;</td></tr><tr><td class="src"><a href="/usr/share/doc/ghc/html/libraries/base-4.3.1.0/Data-Typeable.html#t:Typeable">Typeable</a> <a href="Network-Wai.html#t:Request">Request</a></td><td class="doc empty">&nbsp;</td></tr></table></div></div></div><div class="top"><p class="src"><span class="keyword">data</span>  <a name="t:Response" class="def">Response</a>  <a href="src/Network-Wai.html#Response" class="link">Source</a></p><div class="subs constructors"><p class="caption">Constructors</p><table><tr><td class="src"><a name="v:ResponseFile" class="def">ResponseFile</a> <a href="/usr/share/doc/ghc/html/libraries/http-types-0.6.5/Network-HTTP-Types.html#t:Status">Status</a> <a href="/usr/share/doc/ghc/html/libraries/http-types-0.6.5/Network-HTTP-Types.html#t:ResponseHeaders">ResponseHeaders</a> <a href="/usr/share/doc/ghc/html/libraries/base-4.3.1.0/System-IO.html#t:FilePath">FilePath</a> (<a href="/usr/share/doc/ghc/html/libraries/base-4.3.1.0/Data-Maybe.html#t:Maybe">Maybe</a> <a href="Network-Wai.html#t:FilePart">FilePart</a>)</td><td class="doc empty">&nbsp;</td></tr><tr><td class="src"><a name="v:ResponseBuilder" class="def">ResponseBuilder</a> <a href="/usr/share/doc/ghc/html/libraries/http-types-0.6.5/Network-HTTP-Types.html#t:Status">Status</a> <a href="/usr/share/doc/ghc/html/libraries/http-types-0.6.5/Network-HTTP-Types.html#t:ResponseHeaders">ResponseHeaders</a> <a href="/usr/share/doc/ghc/html/libraries/blaze-builder-0.2.1.4/Blaze-ByteString-Builder-Internal-Types.html#t:Builder">Builder</a></td><td class="doc empty">&nbsp;</td></tr><tr><td class="src"><a name="v:ResponseEnumerator" class="def">ResponseEnumerator</a> (<span class="keyword">forall</span> a.  <a href="Network-Wai.html#t:ResponseEnumerator">ResponseEnumerator</a> a)</td><td class="doc empty">&nbsp;</td></tr></table></div><div class="subs instances"><p id="control.i:Response" class="caption collapser" onclick="toggleSection('i:Response')">Instances</p><div id="section.i:Response" class="show"><table><tr><td class="src"><a href="/usr/share/doc/ghc/html/libraries/base-4.3.1.0/Data-Typeable.html#t:Typeable">Typeable</a> <a href="Network-Wai.html#t:Response">Response</a></td><td class="doc empty">&nbsp;</td></tr></table></div></div></div><div class="top"><p class="src"><span class="keyword">type</span> <a name="t:ResponseEnumerator" class="def">ResponseEnumerator</a> a = (<a href="/usr/share/doc/ghc/html/libraries/http-types-0.6.5/Network-HTTP-Types.html#t:Status">Status</a> -&gt; <a href="/usr/share/doc/ghc/html/libraries/http-types-0.6.5/Network-HTTP-Types.html#t:ResponseHeaders">ResponseHeaders</a> -&gt; <a href="/usr/share/doc/ghc/html/libraries/enumerator-0.4.13.1/Data-Enumerator.html#t:Iteratee">Iteratee</a> <a href="/usr/share/doc/ghc/html/libraries/blaze-builder-0.2.1.4/Blaze-ByteString-Builder-Internal-Types.html#t:Builder">Builder</a> <a href="/usr/share/doc/ghc/html/libraries/base-4.3.1.0/System-IO.html#t:IO">IO</a> a) -&gt; <a href="/usr/share/doc/ghc/html/libraries/base-4.3.1.0/System-IO.html#t:IO">IO</a> a<a href="src/Network-Wai.html#ResponseEnumerator" class="link">Source</a></p></div><div class="top"><p class="src"><a name="v:responseEnumerator" class="def">responseEnumerator</a> ::  <a href="Network-Wai.html#t:Response">Response</a> -&gt; <a href="Network-Wai.html#t:ResponseEnumerator">ResponseEnumerator</a> a<a href="src/Network-Wai.html#responseEnumerator" class="link">Source</a></p></div><div class="top"><p class="src"><span class="keyword">type</span> <a name="t:Application" class="def">Application</a> = <a href="Network-Wai.html#t:Request">Request</a> -&gt; <a href="/usr/share/doc/ghc/html/libraries/enumerator-0.4.13.1/Data-Enumerator.html#t:Iteratee">Iteratee</a> <a href="/usr/share/doc/ghc/html/libraries/bytestring-0.9.1.10/Data-ByteString.html#t:ByteString">ByteString</a> <a href="/usr/share/doc/ghc/html/libraries/base-4.3.1.0/System-IO.html#t:IO">IO</a> <a href="Network-Wai.html#t:Response">Response</a><a href="src/Network-Wai.html#Application" class="link">Source</a></p></div><div class="top"><p class="src"><span class="keyword">type</span> <a name="t:Middleware" class="def">Middleware</a> = <a href="Network-Wai.html#t:Application">Application</a> -&gt; <a href="Network-Wai.html#t:Application">Application</a><a href="src/Network-Wai.html#Middleware" class="link">Source</a></p><div class="doc"><p>Middleware is a component that sits between the server and application. It
 can do such tasks as GZIP encoding or response caching. What follows is the
 general definition of middleware, though a middleware author should feel
 free to modify this.
</p><p>As an example of an alternate type for middleware, suppose you write a
 function to load up session information. The session information is simply a
 string map [(String, String)]. A logical type signatures for this middleware
 might be:
</p><pre> loadSession :: ([(String, String)] -&gt; Application) -&gt; Application</pre><p>Here, instead of taking a standard <code><a href="Network-Wai.html#t:Application">Application</a></code> as its first argument, the
 middleware takes a function which consumes the session information as well.
</p></div></div><div class="top"><p class="src"><span class="keyword">data</span>  <a name="t:FilePart" class="def">FilePart</a>  <a href="src/Network-Wai.html#FilePart" class="link">Source</a></p><div class="subs constructors"><p class="caption">Constructors</p><table><tr><td class="src"><a name="v:FilePart" class="def">FilePart</a></td><td class="doc empty">&nbsp;</td></tr><tr><td colspan="2"><div class="subs fields"><p class="caption">Fields</p><dl><dt class="src"><a name="v:filePartOffset" class="def">filePartOffset</a> :: <a href="/usr/share/doc/ghc/html/libraries/base-4.3.1.0/Prelude.html#t:Integer">Integer</a></dt><dd class="doc empty">&nbsp;</dd><dt class="src"><a name="v:filePartByteCount" class="def">filePartByteCount</a> :: <a href="/usr/share/doc/ghc/html/libraries/base-4.3.1.0/Prelude.html#t:Integer">Integer</a></dt><dd class="doc empty">&nbsp;</dd></dl><div class="clear"></div></div></td></tr></table></div><div class="subs instances"><p id="control.i:FilePart" class="caption collapser" onclick="toggleSection('i:FilePart')">Instances</p><div id="section.i:FilePart" class="show"><table><tr><td class="src"><a href="/usr/share/doc/ghc/html/libraries/base-4.3.1.0/Text-Show.html#t:Show">Show</a> <a href="Network-Wai.html#t:FilePart">FilePart</a></td><td class="doc empty">&nbsp;</td></tr></table></div></div></div><h1 id="g:2">Response body smart constructors
</h1><div class="top"><p class="src"><a name="v:responseLBS" class="def">responseLBS</a> :: <a href="/usr/share/doc/ghc/html/libraries/http-types-0.6.5/Network-HTTP-Types.html#t:Status">Status</a> -&gt; <a href="/usr/share/doc/ghc/html/libraries/http-types-0.6.5/Network-HTTP-Types.html#t:ResponseHeaders">ResponseHeaders</a> -&gt; <a href="/usr/share/doc/ghc/html/libraries/bytestring-0.9.1.10/Data-ByteString-Lazy.html#t:ByteString">ByteString</a> -&gt; <a href="Network-Wai.html#t:Response">Response</a><a href="src/Network-Wai.html#responseLBS" class="link">Source</a></p></div></div></div><div id="footer"><p>Produced by <a href="http://www.haskell.org/haddock/">Haddock</a> version 2.9.2</p></div></body></html>