[T|b      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghij%the socket to make a connection from )the action run when the connection fails k'the connection to fork the threads for 'the action which reads from the socket lGWait for conndead to be set to False on the given connection, then run  the given action mHWrap a connection thread so that, when the thread dies, it races to set J the dead flag. If it does so, it closes the socket and kills the other  thread nClose a connection oKAtomically take elements from the end of the given sequence and write them @ to the given socket. Throw an exception when the write fails data is removed from the end the socket to write to p+Write a given number of bytes to a socket. bdejknbdedejknX4The list of valid methods, see RFC 2616 section 5.1  &HTTP headers, see RFC 2616 section 14  !"#$%&'()*+,-./01234 A HTTP range 5the final n bytes 6(the bytes in the given range, inclusive 7'everything from the given byte onwards 8 A HTTP reply 9:;<=>?A HTTP request @ABCDEFq>A mapping from status code to message. Taken from Johan Tibell's Hydra  package G0Convert a status code to a message (e.g. 200 -> OK) rRFC 2616 2.1, #rule Parse an RFC1123 date s!Parse a zero, or positive, int64 t3Check that a list of ranges are syntatically valid uHIvwxyz{|JKL  !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKL?@ABCDE89:;<=>4765  !"#$%&'()*+,-./0123FG JKHIL  )  !"#$%&'()*+,-./0123  !"#$%&'()*+,-./0123476556789:;<=>9:;<=>?@ABCDE@ABCDEFGHIJKLIParse the given filename as a mime.types file and return a map from file  extension to mime type. MSame as parseMimeTypes1, but never throw an exception, return a Nothing  instead. LMLMLM#NThe processing monad OKProcessing a request involve running a number of actions in a StateT monad G where the state for that monad is this record. This contains both a  Source and a Handle+ element. Often something will fill in the Handle 2 and expect later processing to convert it to a Source. Somehow, you have  to end up with a Source , however. }~the original request 5 | the system mime types db, mapping file extensions the current reply the current source the current handle 6 | an action to be performed before sending the reply PQ some data R end of data Serror - please don't read this source again TFA source is a stream of data, like a lazy data structure, but without < some of the dangers that such entail. A source returns a  SourceResult  each time you evaluate it. 1This assumes a little endian system because I can't find a nice way to probe  the endianness U%Construct a source from a ByteString V!Construct a source from a Handle #the first and last byte to include the handle to read from WA source with no data (e.g. devnull) XReturn the request YReturn the current reply ZDSet the current reply to be a reply with the given status code, the K default message for that status code, an empty body and an empty set of  headers. [LSet a header in the current reply. Because of the way records work, you use  this function like this: 5 setHeader $ \h -> h { httpSomeHeader = Just value } \LThis handles the If-*Matches and If-*Modified conditional headers. It takes J its information from the Last-Modified and ETag headers of the current H reply. Note that, for the purposes of ETag matching, a reply without H an ETag header is considered not to exist from the point of view of,  say, If-Matches: *. ]DIf the current state includes a Handle, this turns it into a Source FGiven the length of the resource, filter any unsatisfiable ranges and ' convert them all into RangeOf form. ^IThis handles Range requests and also translates from Handles to Sources. M If the WebMonad has a Handle at this point, then we can construct sources I from any subrange of the file. (We also assume that Content-Length is  correctly set.) See RFC 2616, section 14.35 _BAt the moment, this just adds the header Server: Network.MiniHTTP KIf a source is missing, install a null source. If this was a HEAD request, = remove the current source and set the content length to 0 `IThis is a very simple handler which deals with requests by returning the N requested file from the filesystem. It sets a Handle in the state and sets > the Content-Type, Content-Length and Last-Modified headers )the root of the filesystem to serve from JBlock until the given queue has less than the given number of bytes in it " then enqueue a new ByteString. @the max number of bytes in the queue before we enqueue anything the connection to write to the data to enqueue $Read a single request from a socket 1data which has already been read from the socket &Loop, reading and processing requests previously read data athe port number to listen on the processing action NOPQRSTUVWXYZ[\]^_`aTPSRQUVWNOXYZ[\]^_`aNOPSRQQRSTUVWXYZ[\]^_`a      !"#$%&'()*+,-./0123456789:;<<=>?@ABBCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcddefghijklmnopqrstuvwxyz{|}Q~network-minihttp-0.1Network.MiniHTTP.MarshalNetwork.MiniHTTP.MimeTypesParseNetwork.MiniHTTP.ServerNetwork.MiniHTTP.Connection MediaTypeMethodCONNECTTRACEDELETEPUTPOSTHEADGETOPTIONSHeaders httpAccepthttpAcceptCharsethttpAcceptEncodinghttpAcceptLanguagehttpAcceptRangeshttpAge httpAllowhttpAuthorizationhttpConnectionClosehttpConnectionhttpContentEncodingshttpContentLanguagehttpContentLengthhttpContentLocationhttpContentRangehttpContentTypehttpDatehttpETag httpExpireshttpHost httpIfMatchhttpIfModifiedSincehttpIfNoneMatch httpIfRangehttpIfUnmodifiedSince httpKeepAlivehttpLastModified httpLocation httpPragmahttpProxyAuthenticatehttpProxyAuthorization httpRange httpRefererhttpRetryAfter httpServer httpTrailerhttpTransferEncoding httpUserAgenthttpWWWAuthenticatehttpOtherHeadersRange RangeSuffixRangeOf RangeFromReply replyMajor replyMinor replyStatus replyMessage replyHeadersRequest reqMethodreqUrlreqMajorreqMinor reqHeaders emptyHeadersstatusToMessage parseRequest parseReply putRequestputReplyparseMimeTypesparseMimeTypesTotalWebMonadWebState SourceResult SourceData SourceEOF SourceErrorSourcebsSourcehSource nullSource getRequestgetReplysetReply setHeaderhandleConditionalRequesthandleHandleToSourcehandleRangeRequestshandleDecorationhandleFromFilesystemserve Connection connsocketconnoutqconnreaderthreadconnwriterthread conndeathconndeadnew forkThreadswaitForReadySignalconnectionThreadWrapperclose seqToSocketwritea reasonPhrasesdateint64 checkRanges parseMethodputQualityList putHeaderM putHeaderML putHeaderLputList putQuoted putHeaders wsRequest wsMimeTypeswsReplywsSourcewsHandlewsActionhtonssatisfiableRanges handleFinalpipelinewaitForLowWaterAndEnqueue readRequest readRequests acceptLoop