H=5z      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyNone;KAn exception originating within the HTTP infrastructure or the web server. ?An exception thrown by operations which expect a connection to ? exist (as it always does within a handler), when none does. KAn exception thrown by operations which are given cookie names that do not - meet the appropriate syntax requirements. IAn exception thrown by operations which are given a header that does not 8 meet their requirement of being valid in a response. 1An exception thrown when output is closed, as by x, G when the response headers imply that there will be a certain amount  of data and there is not. GAn exception thrown by operations which produce output when output has  been closed, as by x. EAn exception thrown by operations which require the response headers  to still be modifiable. IAn exception thrown by operations which require the response headers not  to have been sent yet. Headers are classified by HTTP/*1.1 as request headers, response headers, ' entity headers, or general headers. Nonstandard headers General headers Entity headers 'Response headers :Request headers ;IA record used to configure an individual port listener and its socket as M part of the general server configuration. Consists of a host address and H port number to bind the socket to, and a flag indicating whether the ; listener should use the secure version of the protocol. ?HA record used to configure the server. Broken informally into the four I categories of logging, job-control, concurrency, and networking. For G logging, the configuration contains optional paths to files for the K access and error logs (if these are omitted, logging is not done). For J job-control, it contains a flag indicating whether to run as a daemon, . and optionally the names of a Unix user and/or group to switch to in the E process of daemonization. For concurrency, it contains a forking  primitive such as forkIO or z. Finally, for networking, it K contains a list of parameters for ports to listen on, each of which has % its own sub-configuration record. ENotice that checking the value of the Host: header, and implementing M virtual-host policies, is not done by direct-http but rather is up to the L user of the library; hence, there is no information in the configuration 6 about the hostnames to accept from the user-agent. +If the access logfile path is not Nothing, W opens this M logfile in append mode and uses it to log all accesses; otherwise, access  is not logged. *If the error logfile path is not Nothing, W opens this logfile C in append mode and uses it to log all errors; otherwise, if not M daemonizing, errors are logged to standard output; if daemonizing, errors  are not logged. If the daemonize flag is True, W closes the standard IO J streams and moves the process into the background, doing all the usual H Unix things to make it run as a daemon henceforth. This is optional E because it might be useful to turn it off for debugging purposes. *The forking primitive is typically either forkIO or z , and is  used by W0 both to create listener threads, and to create K connection threads. It is valid to use a custom primitive, such as one B that attempts to pool OS threads, but it must actually provide M concurrency - otherwise there will be a deadlock. There is no support for  single-threaded operation. 6Notice that we take the forking primitive in terms of {, even though  we actually lift it (with |). This is because H lifted-base, as of this writing and its version 0.1.1, only supports  forkIO and not z. HThe loop never returns, but will terminate the program with status 0 if G and when it ever has no child threads alive; child threads for this % purpose are those created through V, which means all 5 listener-socket and connection threads created by W , as well 1 as any threads created by client code through V, but not threads 4 created by client code through other mechanisms. AThe author of direct-http has made no effort to implement custom H thread-pooling forking primitives, but has attempted not to preclude K them. If anyone attempts to implement such a thing, feedback is hereby  solicited. HIThe class of monads within which the HTTP calls are valid. You may wish D to create your own monad implementing this class. Note that the  prerequisite is } { m, which is similar to  ~6 m, but with, among other things, more capability for  exception handling. IReturns the opaque U" object representing the state of  the HTTP server. I Should not be called directly by user code, except implementations of  H; exported so that , user monads can implement the interface. JEThe monad within which each single request from a client is handled. Note that there is an instance } { J , so that H exceptions can be thrown, caught, and otherwise manipulated with the % lifted primitives from lifted-base's . KFAn object representing a cookie (a small piece of information, mostly I metadata, stored by a user-agent on behalf of the server), either one D received as part of the request or one to be sent as part of the  response. UIAn opaque type representing the state of the HTTP server during a single  connection from a client. VIForks a thread to run the given action, using the forking primitive that & was passed in the configuration to W, and additionally I registers that thread with the main server thread, which has the sole M effect and purpose of causing the server to not exit until and unless the I child thread does. All of the listener-socket and connection threads 3 created by the server go through this function. WITakes a server parameters record and a handler, and concurrently accepts J requests from user agents, forking with the primitive specified by the G parameters and invoking the handler in the forked thread inside the  J monad for each request. GNote that although there is no mechanism to substitute another type of L monad for HTTP, you can enter your own monad within the handler, much as K you would enter your own monad within IO. You simply have to implement  the H class. ;Any exceptions not caught within the handler are caught by  W5, and cause the termination of that handler, but not ) of the connection or the accept loop. X#Logs a message using the web server'$s logging facility, prefixed with a  timestamp. Y7Queries the value from the user agent of the given HTTP/1.1 header. If F the header is to be provided after the content as specified by the 7 Trailer header, this is potentially time-consuming. Z?Returns an association list of name-value pairs of all the HTTP/ 1.1 request N or entity headers from the user agent. If some of these headers are to be J provided after the content as specified by the Trailer header, this is  potentially time-consuming. [ Returns a K; object for the given name, if the user agent provided one  in accordance with RFC 2109. \ Returns all K3 objects provided by the user agent in accordance  RFC 2109. ]A convenience method; as [$, but returns only the value of the  cookie rather than a K object. ^JReturn the remote address, which includes both host and port information. G They are provided in the aggregate like this because it is the most . internet-protocol-agnostic representation. HReturn the remote hostname, as determined by the web server. If it has E not yet been looked up, performs the lookup. This is potentially  time-consuming. _Return the request method. `Return the request URI. a)Return the server address and port, as a  . Useful . for implementing virtual-hosting policies. ?Return whether the connection is via the secure version of the @ protocol. Useful for implementing virtual-hosting policies. bHReturn the request content length, if this is knowable without actually K receiving the content - in particular, if the Content-Length header was & used. Otherwise, returns Nothing. c@Return the request content type, as provided by the user agent. dDReads up to a specified amount of data from the content of the HTTP I request, if any, and interprets it as binary data. If input has been D closed, returns an empty bytestring. If no input is immediately M available, blocks until there is some. If output has been closed, causes  an  exception. eDReads up to a specified amount of data from the content of the HTTP I request, if any, and interprets it as binary data. If input has been M closed, returns an empty bytestring. If insufficient input is available, L returns any input which is immediately available, or an empty bytestring K if there is none, never blocking. If output has been closed, causes an   exception. fGReads all remaining data from the content of the HTTP request, if any, F and interprets it as binary data. Blocks until all input has been L read. If input has been closed, returns an empty bytestring. If output  has been closed, causes an  exception. gEReturns whether the content of the HTTP request potentially has data 6 remaining, either in the buffer or yet to be read. hKSets the response status which will be sent with the response headers. If L the response headers have already been sent, or are no longer modifiable  (because of a call to v or similar), causes a   or  exception. iMReturns the response status which will be or has been sent with the response  headers. jISets the given response header to the given string value, overriding any F value which has previously been set. If the response headers have H already been sent, or are no longer modifiable (because of a call to  v or similar), causes a  or  % exception. If the header is not an  HTTP/A1.1 or extension response, entity, or general header, ie, is not ) valid as part of a response, causes a  exception. If a value is set for the   header, this overrides all % cookies set for this request with m. kCauses the given , response header not to be sent, overriding J any value which has previously been set. If the response headers have H already been sent, or are no longer modifiable (because of a call to  v or similar), causes a  or   exception. If  the header is not an HTTP/01.1 or extension response or entity header, ie, 0 is not valid as part of a response, causes a   exception. Does not prevent the  # header from being sent if cookies ' have been set for this request with m. lJReturns the value of the given header which will be or has been sent with 6 the response headers. If the header is not an HTTP/1.1 or extension F response, entity, or general header, ie, is not valid as part of a  response, causes a  exception. mGCauses the user agent to record the given cookie and send it back with J future loads of this page. Does not take effect instantly, but rather H when headers are sent. Cookies are set in accordance with RFC 2109.  If an  - header is set for this request by a call to  j8, this function has no effect. If the response headers M have already been sent, or are no longer modifiable (because of a call to  v or similar), causes a  or   exception. = If the name is not a possible name for a cookie, causes a   exception. nKCauses the user agent to unset any cookie applicable to this page with the L given name. Does not take effect instantly, but rather when headers are  sent. If an  - header is set for this request by a call to  j8, this function has no effect. If the response headers M have already been sent, or are no longer modifiable (because of a call to  v or similar), causes a  or   exception. = If the name is not a possible name for a cookie, causes a   exception. oIConstructs a cookie with the given name and value. Version is set to 1; , path, domain, and maximum age are set to Nothing; and the secure flag is  set to False>. Constructing the cookie does not cause it to be set; to do  that, call m on it. pEConstructs a cookie with the given parameters. Version is set to 1. I Constructing the cookie does not cause it to be set; to do that, call m  on it. q Sets the HTTP/&1.1 return status to 301 and sets the $ header M to the provided URL. This has the effect of issuing a permanent redirect O to the user agent. Permanent redirects, as opposed to temporary redirects, I may cause bookmarks or incoming links to be updated. If the response M headers have already been sent, or are no longer modifiable (because of a  call to v or similar), causes a  or   exception. r Sets the HTTP/&1.1 return status to 303 and sets the $ header G to the provided URL. This has the effect of issuing a see-other or   temporaryA redirect to the user agent. Temporary redirects, as opposed to G permanent redirects, do not cause bookmarks or incoming links to be N updated. If the response headers have already been sent, or are no longer $ modifiable (because of a call to v or similar), causes a   or  exception. sGEnsures that the response headers have been sent. If they are already E sent, does nothing. If output has already been closed, causes an  0 exception. Note that if the buffered identity : output mode (the first mode of operation described for v) is I to be used, this function implies that there is no additional content & beyond what has already been sent. tKReturns whether the response headers have been sent, regardless of whether ? they are modifiable (they might not be because of a call to v or  similar). uGReturns whether the response headers are modifiable, a prerequisite of F which is that they have not already been sent. (They might not be # modifiable because of a call to v or similar.) vJAppends data, interpreted as binary, to the content of the HTTP response. K Makes the response headers no longer modifiable, effective immediately. 0 If output has already been closed, causes an  H exception. If the response Transfer-Encoding as set in the response  headers is identity0 or omitted, and the response Content-Length is K omitted, data is buffered until output is closed, then sent all at once M with an appropriate Content-Length header. Otherwise - that is, if there % is a Transfer-Encoding other than identity set, or if Content-Length is F set - data is sent immediately. If Content-Length is set, and the M provided data would cause the cumulative data sent to exceed that length,  causes an & exception. At the time that data is J actually sent, if the response headers have not been sent, first sends  them. KIn other words, there are effectively three modes of operation for output. M The first, simplest mode is used if the handler does nothing special. In K this mode output is buffered and sent all at once; headers are not sent " until this time. In this mode x may be useful to force L output to be sent before the handler returns, perhaps so that additional O time-consuming processing can be done. This mode is easiest to use, in the 3 sense that it requires no support on the handler's part, but probably the . second mode should always be used instead. EThe second mode is used if the handler sets a Transfer-Encoding, for  example chunked8, and no Content-Length. In this case headers are sent  immediately upon the first v or w, and output is sent = as it is provided. Output in this mode is transformed by v into M the appropriate transfer encoding. Thus handler code need only specify a N transfer encoding, not actually implement that encoding itself. This mode O is advantageous to allow user agents to begin displaying partial content as K it is received, and particularly useful when the content is quite large K or takes significant time to generate. If you are unsure which mode to ( use, it should probably be this one. CThe third mode is used if the handler sets a Content-Length and no L Transfer-Encoding. In this case headers are again sent immediately upon  the first v or w$, and output is again sent as it is H provided. Output in this mode is not transformed. This may be more O efficient than the second mode if output is generated in many small pieces, = as it avoids computing and sending the length tags of the chunked M encoding. However, it requires the content length to be known in advance J of actually sending any content. It may be useful if you wish to have M direct-http validate that the handler is well-behaved in sending a binary  object of known size with no garbage! inserted by spurious additional  puts. wHAppends text, encoded as UTF8, to the content of the HTTP response. In  all respects this behaves as v!, but for the fact that it takes ! text rather than binary data. xJInforms the web server and the user agent that the request has completed. M As side-effects, the response headers are sent if they have not yet been, I any unread input is discarded and no more can be read, and any unsent K output is sent. This is implicitly called, if it has not already been, G after the handler returns; it may be useful within a handler if the D handler wishes to return results and then perform time-consuming N computations before exiting. If output has already been closed, causes an  6 exception. If the response headers imply that there @ will be a certain amount of data and there is not, causes an   exception. yJReturns whether it is possible to write more data; ie, whether output has  not yet been closed as by x.   !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVW9Parameters describing the behavior of the server to run. >A handler which is invoked once for each incoming connection. Never actually returns. XY:The header to query. Must be a request or entity header. 9The value of the header, if the user agent provided one. Z[$The name of the cookie to look for. +The cookie, if the user agent provided it. \]$The name of the cookie to look for. 8The value of the cookie, if the user agent provided it. ^_`abcdefghThe HTTP/1.1 status code to set. iThe HTTP/1.1 status code. jCThe header to set. Must be a response header or an entity header. The value to set. kEThe header to unset. Must be a response header or an entity header. l=The header to query. Must be a response header or an entity  header. !The value of the queried header. mThe cookie to set. n!The name of the cookie to unset. o%The name of the cookie to construct. &The value of the cookie to construct. (A cookie with the given name and value. p%The name of the cookie to construct. &The value of the cookie to construct. %The path of the cookie to construct. 'The domain of the cookie to construct. 8The maximum age of the cookie to construct, in seconds. 3Whether to flag the cookie to construct as secure. $A cookie with the given parameters. q%The URL to redirect to, as a string. r%The URL to redirect to, as a string. stuvwxyz  !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyzJUHI?@ABCDEFG;<=>WXV:9876543210/.-,+*)('&%$#"!  YZKLMNOPQRST[\]^_`abcdefghijklmnopqrstuvwxyh2:9876543210/.-,+*)('&%$#"!  ;<=>?@ABCDEFGHIJK LMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxy      !"#$%&'()*+,-./0123456789:;<=>??@ABBCDEFGHIJKLMMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~Vdirect-http-0.5.2 Network.HTTPControl.ExceptionLifted HTTPException NoConnectionCookieNameInvalidNotAResponseHeaderOutputIncompleteOutputAlreadyClosedResponseHeadersNotModifiableResponseHeadersAlreadySentHeader HttpSetCookie HttpCookie HttpWarningHttpVia HttpUpgradeHttpTransferEncoding HttpTrailer HttpPragmaHttpDateHttpConnectionHttpCacheControlHttpExtensionHeaderHttpLastModified HttpExpiresHttpContentTypeHttpContentRangeHttpContentMD5HttpContentLocationHttpContentLengthHttpContentLanguageHttpContentEncoding HttpAllowHttpWWWAuthenticateHttpVary HttpServerHttpRetryAfterHttpProxyAuthenticate HttpLocationHttpETagHttpAgeHttpAcceptRanges HttpUserAgentHttpTE HttpReferrer HttpRangeHttpProxyAuthorizationHttpMaxForwardsHttpIfUnmodifiedSince HttpIfRangeHttpIfNoneMatchHttpIfModifiedSince HttpIfMatchHttpHostHttpFrom HttpExpectHttpAuthorizationHttpAcceptLanguageHttpAcceptEncodingHttpAcceptCharset HttpAcceptHTTPListenSocketParameterslistenSocketParametersAddresslistenSocketParametersSecureHTTPServerParametersserverParametersAccessLogPathserverParametersErrorLogPathserverParametersDaemonizeserverParametersUserToChangeToserverParametersGroupToChangeToserverParametersForkPrimitiveserverParametersListenSockets MonadHTTP getHTTPStateHTTPCookie cookieName cookieValue cookieVersion cookiePath cookieDomain cookieMaxAge cookieSecure cookieComment HTTPStatehttpFork acceptLoophttpLoggetRequestHeadergetAllRequestHeaders getCookie getAllCookiesgetCookieValuegetRemoteAddressgetRequestMethod getRequestURIgetServerAddressgetContentLengthgetContentTypehttpGethttpGetNonBlockinghttpGetContentshttpIsReadablesetResponseStatusgetResponseStatussetResponseHeaderunsetResponseHeadergetResponseHeader setCookie unsetCookiemkSimpleCookiemkCookiepermanentRedirectseeOtherRedirectsendResponseHeadersresponseHeadersSentresponseHeadersModifiablehttpPut httpPutStrhttpCloseOutputhttpIsWritablelifted-base-0.2.0.2Control.Concurrent.LiftedforkOSghc-prim GHC.TypesIOmonad-control-0.3.1.4Control.Monad.Trans.ControlliftBaseDiscardMonadBaseControltransformers-0.3.0.0Control.Monad.IO.ClassMonadIO getRemoteHostnetwork-2.4.1.0Network.Socket.TypesSockAddrgetServerSecure HeaderType GeneralHeader EntityHeaderResponseHeader RequestHeaderConnectionTerminatingErrorUnexpectedEndOfInputResponseContentParametersResponseContentChunked!ResponseContentUnbufferedIdentityResponseContentBufferedIdentityResponseContentClosedResponseContentUninitializedRequestContentParametersRequestContentChunkedRequestContentIdentityRequestContentClosedRequestContentNoneRequestContentUninitializedHTTPConnectionhttpConnectionServerAddresshttpConnectionSockethttpConnectionPeerhttpConnectionInputBufferMVarhttpConnectionTimestamphttpConnectionRemoteHostnamehttpConnectionRequestMethodhttpConnectionRequestURIhttpConnectionRequestProtocolhttpConnectionRequestHeaderMaphttpConnectionRequestCookieMap"httpConnectionRequestContentBuffer&httpConnectionRequestContentParameters!httpConnectionResponseHeadersSent'httpConnectionResponseHeadersModifiablehttpConnectionResponseStatushttpConnectionResponseHeaderMaphttpConnectionResponseCookieMap#httpConnectionResponseContentBuffer'httpConnectionResponseContentParameters!httpStateAccessLogMaybeHandleMVar httpStateErrorLogMaybeHandleMVarhttpStateForkPrimitivehttpStateThreadSetMVarhttpStateThreadTerminationMSemhttpStateMaybeConnectiongetHTTPConnectioncreateListenSocket requestLoopgetRequestValidgetConnectionShouldStayAliveprepareResponse logAccess parseCookies printCookiesparseInt recvHeaders parseHeaderlogInvalidRequest isValidMethod isValidURLisValidProtocolrecvLine recvBlockextendInputBuffer httpAccessLog headerType fromHeadertoHeaderisValidInRequestisValidInResponseisValidOnlyWithEntitystripHeaderValueWhitespaceisHeaderValueWhitespacegetRequestCookieMapgetRequestProtocolgetRequestHasContentgetRequestContentAllowedhttpGet')ensureRequestContentParametersInitializedextendRequestContentBuffersetResponseHeader' mkUnsetCookierequireValidCookieNameisValidCookieTokengetHeadersBuffermarkResponseHeadersUnmodifiable reasonPhrase*ensureResponseContentParametersInitializedflushResponseContentsend requireResponseHeadersNotYetSent requireResponseHeadersModifiablerequireOutputNotYetClosed$fExceptionHTTPException $fShowHeader$fMonadHTTPReaderT $fShowConnectionTerminatingError%$fExceptionConnectionTerminatingError