K      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJ None2468MKSequence of steps to get a StreamWorker. This class is independent of things like the finer details concerning the frames and the streams.]Todo: although this shows a common pattern, I'm not sure how having a class here helps....LiA StreamWorker: a conduit that takes input tokens and answers with output tokens. It can perform I/O.KMNOLPQRSTUVWXYZ[\]^_`abcKMNOLPQRSTUVWXYZ[\]^_`ab KMNOLPVUTSRQWXY\[Z]^_`abcNone3HM nCallbacks that you can provide your sessions to notify you of interesting things happening in the server. ^Used by this session engine to report an error at some component, in a particular session. Components at an individual session. Used to report where in the session an error was produced. This interface is likely to change in the future, as we add more metadata to exceptions 3Information used to identify a particular session. Get/set a numeric Id from a  [. For example, to get the session id with this, import `Control.Lens.(^.)` and then do 3 session_id = session_coordinates ^. sessionId ?Configuration information you can provide to the session maker.Session callbacks(Lens to access sessionsCallbacks in the   object.TCreates a default sessions context. Modify as needed using the lenses interfaces d          d  None3HMContains information that applies to all sessions created in the program. Use the lenses interface to access members of this struct. efghijk efghijkefghijkNone  Nonelmn%How to know if we can split somewhereInput left-oversGenerator action+Packet and leftovers, if we could get them o%How to know if we can split somewhereInput left-oversGenerator actionPacket bytes and left-overs.pqlmnoqlmnopq NoneB rstuvwxyz{|} rtuvwxyz{| rstuvwxyz{|}  Safe-Inferred+:MA function which takes three arguments: the first one says how to send data (on a socket or similar transport), and the second one how to receive data on the transport. The third argument encapsulates the sequence of steps needed for a clean shutdown. qYou can implement one of these to let somebody else supply the push, pull and close callbacks. For example, tlsServeWithALPN' will supply these arguments to an . Attendants encapsulate all the session book-keeping functionality, which for HTTP/2 is quite complicated. You use the functions http**Attendant to create one of these from a .:This library supplies two of such Attendant factories,  for HTTP 1.1 sessions, and  for HTTP/2 sessions.Callback that the session calls to realease resources associated with the channels. Take into account that your callback should be able to deal with non-clean shutdowns also, for example, if the connection to the remote peer is severed suddenly.uCallback type to pull data from a channel. The same as to PushAction applies to exceptions thrown from there. mCallback type to push data to a channel. Part of this interface is the abstract exception type IOProblem. Throw an instance of it from here to notify the session that the connection has been broken. There is no way to signal "normal termination", since HTTP/2's normal termination can be observed at a higher level when a GO_AWAY frame is seen.  Safe-Inferred+:M'This exception will be raised inside a CoherentWorker when the underlying stream is cancelled (STREAM_RESET in HTTP/2). Do any necessary cleanup in a handler, or simply use the fact that the exception is asynchronously delivered to your CoherentWorker Haskell thread, giving you an opportunity to interrupt any blocked operations.sA concrete case of the above exception. Throw one of this if you don't want to implement your own type. Use  in catch signatures.)Throw exceptions derived from this (e.g, ? below) to have the HTTP/2 session to terminate gracefully. !Thrown with HTTP 1.1 over HTTP1.1 sessions when the response body or the request body doesn't include a Content-Length header field, even if it should have included it #Abstract exception. All HTTP/1.1 related exceptions derive from here. Notice that this includes a lot of logical errors and they can be raised when handling HTTP/2 sessions also%OThrown when the HTTP/2 connection prefix doesn't match the expected prefix.'BAbstract exception. Thrown when encoding/decoding of a frame fails);Abstract exception. All HTTP/2 exceptions derive from here % !"#$%&'()*~ !"#$%&'()*)*'(%&#$ !" !"#$%&'()*~None+Activates logging to terminal+++None+,,Singleton type. Used in conjunction with an '. If the MVar is full, the fuction 1I knows that it should finish at its earliest convenience and call the  for any open sessions..Exceptions inheriting from . This is thrown by the OpenSSL subsystem to signal that the connection was broken or that otherwise there was a problem at the SSL layer. 0Simple function to open 1Interruptible version of 0. Use the extra argument to ask the server to finish: you pass an empty MVar and when you want to finish you just populate it. ,-./0APath to a certificate the server is going to use to identify itself. Bear in mind that multiple domains can be served from the same HTTP/2 TLS socket, so please create the HTTP/2 certificate accordingly. Also, currently this function only accepts paths to certificates or certificate chains in .pem format. %Path to the key of your certificate. AName of the network interface where you want to start your server-List of protocol names and the corresponding  to use for each. This way you can serve both HTTP/1.1 over TLS and HTTP/2 in the same socket. When no ALPN negotiation is present during the negotiation, the first protocol in this list is used.(Port to open to listen for connections. 1 Same as for 0  Same as for 0 Same as for 0 Same as for 04Finish request, write a value here to finish serving,-./01,-./01None+2468M2A pushed stream, represented by a list of request headers, a list of response headers, and the usual response body (which may include final footers (not implemented yet)).3(A list of pushed streams. Notice that a list of IO computations is required here. These computations only happen when and if the streams are pushed to the client. The lazy nature of Haskell helps to avoid unneeded computations if the streams are not going to be sent to the client.4HMain type of this library. You implement one of these for your server. Basically this is a callback that the library calls as soon as it has all the headers of a request. For GET requests that's the entire request basically, but for POST and PUT requests this is just before the data starts arriving to the server. 5A source-like conduit with the data returned in the response. The return value of the conduit is a list of footers. For now that list can be anything (even bottom), I'm not handling it just yet. 6+You use this type to answer a request. The ;V are thus response headers and they should contain the :status pseudo-header. The 3N is a list of pushed streams...(I don't thaink that I'm handling those yet)7Finalization headers 8Finalization headers. If you don't know what they are, chances are that you don't need to worry about them for now. The support in this library for those are at best sketchy. 9A request is a set of headers and a request body.... which will normally be empty, except for POST and PUT requests. But this library enforces none of that. :This is a Source conduit (see Haskell Data.Conduit library from Michael Snoyman) that you can use to retrieve the data sent by the client piece-wise. ;tList of headers. The first part of each tuple is the header name (be sure to conform to the HTTP/2 convention of using lowercase) and the second part is the headers contents. This list needs to include the special :method, :scheme, :authority and :path pseudo-headers for requests; and :status (with a plain numeric value represented in ascii digits) for responses.<The complete header=The value part of a header>The name part of a header?"Gets a single header from the list23456789:;<=>?23456789:;<=>?23456789:;<=>?None23456789:;<=>??>=<;89746325:NoneHM @Abstract data-type. Use D to get one of these from ;<. The underlying representation admits better asymptotics.APHTTP headers are case-insensitive, so we can use lowercase versions everywhereB!Checks that headers are lowercaseCLooks for a given headerD O(n*log n) Builds the editor from a list. EO(n)' Takes the HeaderEditor back to HeadersFTreplaceHeaderValue headers header_name maybe_header_value looks for header_name. If header_name is found and maybe_header_value is nothing, it returns a new headers list with the header deleted. If header_name is found and header_value is Just new_value, it returns a new list with the header containing the new value. If header_name is not in headers and maybe_header_value is Nothing, it returns the original headers list. If header_name is not in headers and maybe_header_value is Just new_value, it returns a new list where the last element is (header_name, new_value)GheaderLens header_name represents a lens into the headers, and you can use it then to add, alter and remove headers. It uses the same semantics than FHReplaces a "host" HTTP/1.1 header by an ":authority" HTTP/2 header. The list is expected to be already in lowercase, so nothing will happen if there the header name portion is "Host" instead of "host".Notice that having a HostR header in an HTTP/2 message is perfectly valid in certain circumstances, check  7https://http2.github.io/http2-spec/#rfc.section.8.1.2.3Section 8.1.2.3 of the spec for details.@ABCDEFGH @ABCDEFGH ABC@DEGFH @ABCDEFGHNone3HMQ 9 None*+242      !"#$%&'()*+,-./012345%'(#       !"#$%&'()*+,-./012345Noneo(None6iStop condition when parsing the body. Right now only length is supported, given with Content-Length. ZTODO: Support "chunked" transfer encoding for classical HTTP/1.1, uploads will need it.7Was the parser complete?8@Some requests are mal-formed. We can check those cases here.9For requests with a body. The second argument is a condition to stop receiving the body, the third is leftovers from parsing the headers.:Headers were completed. For some HTTP methods that's all there is, and that's what this case represents. The second argument is a left-overs string.;DNo, not even headers are done. Use the returned value to continue&<=>6?789:;@ABCDEFGHIJKLMNOPQRSTUVWXYZ[6?789:;AEFHKLXY<>=6?7;:98@ABCDEFGHIJKLMNOPQRSTUVWXYZ[NoneI&Session attendant that speaks HTTP/1.1IIINone+,-./0101+./,-NoneJ+The type of this function is equivalent to: [ http2Attendant :: CoherentWorker -> PushAction -> PullAction -> CloseAction -> IO () Given a 4r, this function wraps it with flow control, multiplexing, and state maintenance needed to run an HTTP/2 session. }Notice that this function is using HTTP/2 over TLS. We haven't implemented yet a session handling mechanism for HTTP/1.1 . JJJNoneJJNoneII$(c) Alcides Viamontes Esquivel, 2015BSDalcidesv@zunzun.se experimentalPOSIXNone+,-./0123456789:;<=>IJ;>=<9746325:8IJ01./,-+\ !"#$$%&&'()* + , - . / 0112233445566778899:;;<<=>?@ABCDEFGHIJKLMNOPQRST U V W X Y Z [ \ ] ^ _ ` a b c d e f g g h i j k lm + n o p q r s t u v w x y z z { | } ~  L     a% !"#$%&'()*+,-./01234567889:;<=>?@ABCDEFGHIJKLMNOPQRsecond-transfer-0.5.0.0SecondTransfer.Sessions.ConfigSecondTransfer.SessionsSecondTransfer.TypesSecondTransfer.ExceptionSecondTransfer.MainLoop SecondTransfer.Utils.HTTPHeadersSecondTransfer.Http1SecondTransfer.Http2SecondTransfer.MainLoop.Tokens SecondTransfer.Sessions.InternalSecondTransfer.MainLoop.FramerSecondTransfer.Utils$SecondTransfer.MainLoop.PushPullTypeCoherentWorkerhttp11Attendanthttp2AttendantSecondTransfer.MainLoop.Logging#SecondTransfer.MainLoop.OpenSSL_TLS&SecondTransfer.MainLoop.CoherentWorkerSecondTransfer.Http2.SessionSecondTransfer.Http2.Framer SecondTransfer.MainLoop.InternalSecondTransfer.Http1.ParseSecondTransfer.Http1.Session"SecondTransfer.Http2.MakeAttendantSecondTransferSessionsCallbacks_reportErrorCallback ErrorCallbackSessionComponentSession_HTTP11Framer_HTTP2SessionComponent-SessionDataOutputThread_HTTP2SessionComponent0SessionHeadersOutputThread_HTTP2SessionComponent(SessionInputThread_HTTP2SessionComponentSessionCoordinates sessionIdSessionsConfig_sessionsCallbacksreportErrorCallbacksessionsCallbacksdefaultSessionsConfigSessionsContextmakeSessionsContext Attendant CloseAction PullAction PushActionStreamCancelledExceptionGenericIOProblem IOProblemHTTP11SyntaxExceptionContentLengthMissingExceptionHTTP11ExceptionBadPrefaceExceptionFramerExceptionHTTP2SessionExceptionenableConsoleLogging FinishRequestTLSLayerGenericProblemtlsServeWithALPN"tlsServeWithALPNAndFinishOnRequest PushedStream PushedStreamsDataAndConclusionPrincipalStreamFootersFinalizationHeadersRequestInputDataStreamHeadersHeader HeaderValue HeaderNamegetHeaderFromFlatList HeaderEditorlowercaseHeadersheadersAreValidHTTP2 fetchHeaderfromListtoListreplaceHeaderValue headerLensreplaceHostByAuthorityStreamWorkerClass StreamWorker initService initSession initStreamStreamOutputAction Finish_SOASendAssociatedFinish_SOASendAssociatedData_SOA SendData_SOASendAssociatedHeaders_SOASendHeaders_SOAGlobalStreamId LocalStreamIdStreamInputToken Finish_StkData_Stk Headers_STkUnpackedNameValueListactionIsForAssociatedStreampackHeaderTuplesunpackHeaderTuples getHeader$fBinaryUnpackedNameValueList$fEqSessionCoordinates_sessionsConfig_nextSessionId nextSessionIdsessionsConfigacquireNewSessionTagsessionExceptionHandlerLengthCallbackFramer readNextChunkreadNextChunkAndContinuereadUpTo readLengthWord24strToInt word24ToInt getWord24be putWord24be lowercaseTextunfoldChannelAndSource stripString domainFromUrl subByteString$fBinaryWord24'convertHTTP2SessionExceptionToException%getHTTP2SessionExceptionFromException!convertFramerExceptionToExceptiongetFramerExceptionFromException!convertHTTP11ExceptionToExceptiongetHTTP11ExceptionFromException#$fExceptionStreamCancelledException$fExceptionGenericIOProblem$fExceptionIOProblem$fShowIOProblem $fExceptionHTTP11SyntaxException($fExceptionContentLengthMissingException$fExceptionHTTP11Exception$fShowHTTP11Exception$fExceptionBadPrefaceException$fExceptionFramerException$fShowFramerException $fExceptionHTTP2SessionException$fShowHTTP2SessionExceptionconfigureLoggingToConsolesetLoggerLevelsbaseGHC.MVarMVar Protocols Wired_PtrConnection_PtrWired_t Connection_tInterruptibleEither InterruptedRight_ILeft_IcloseConnectiondisposeWiredSessiongetSelectedProtocolrecvDatasendDatawaitForConnectionmakeConnectionallOk badHappenedtimeoutReached useBufferSizeprotocolsToWiredefaultWaitTime smallWaitTime!$fExceptionTLSLayerGenericProbleminnerMap AutosortedtoFlatBscolon$fOrdAutosortedWorkerThreadEnvironment _streamId_headersOutput _dataOutput_streamsCancelled_WTEDataOutputToConveyor HeadersSent InputFrame OutputFrameuseChunkLength SessionData_sessionsContext _sessionInput_sessionOutput_toEncodeHeaders_toDecodeHeaders_stream2HeaderBlockFragment_forWorkerThread_coherentWorker_streamsCancelled_stream2PostInputMechanism_stream2WorkerThread_sessionIdAtSessionPostInputMechanismCoherentSession SessionMakerSessionOutputCommandCancelSession_SOCSessionInputCommandCancelSession_SIC WorkerMonadStream2HeaderBlockFragment HashTable SessionOutput SessionInputSession dataOutput headersOutputstreamIdstreamsCancelled_WTEsendFrameToSessionsendCommandToSessiongetFrameFromSessioncoherentWorkerforWorkerThreadsessionIdAtSession sessionInput sessionOutputsessionsContextstream2HeaderBlockFragmentstream2PostInputMechanismstream2WorkerThreadstreamsCancelledtoDecodeHeaderstoEncodeHeaders http2SessionsessionInputThreadframeEndsStreamcreateMechanismForStreamclosePostDataSourcestreamWorkerSendDatasendBytesToPimpostDataSourceFromMechanism isSettingsAckisStreamCancelled workerThreadsendDataOfStreamappendHeaderFragmentBlockgetHeaderBytesframeIsHeaderOfStreamframeEndsHeadersstreamIdFromFrameheadersOutputThreadbytestringChunkdataOutputThreadFramerSessionData _stream2flow_stream2outputBytes_defaultStreamWindow _canOutput_outputIsForbidden_noHeadersInChannel _pushAction _closeAction _sessionId _lastStreamNoHeadersInChannel CanOutputStream2AvailSpaceFlowControlCommand AddBytes_FCMhttp2PrefixLength FramerSession canOutput closeActiondefaultStreamWindow lastStreamnoHeadersInChanneloutputIsForbidden pushAction stream2flowstream2outputBytes wrapSessionhttp2FrameLength addCapacity inputGathereroutputGathererupdateLastStreamstartStreamOutputQueuehandleHeadersOfStream pushFramesendGoAwayFrame sendBytesflowControlOutput releaseFramerBodyStopConditionHttp1ParserCompletionRequestIsMalformed_H1PCHeadersAndBody_H1PCOnlyHeaders_H1PCMustContinue_H1PCRequestOrResponseLine Response_RoRL Request_RoRLUseBodyLength_BSCHeaderParseClosureIncrementalHttp1Parser _fullText _stateParsernewIncrementalHttp1ParseraddByteselaborateHeaders splitByColonparseFirstLine bsToLowerstripBs locateCRLFstwoCRLFsAreConsecutiveisWsCh8isWs http1Token http1Method unspacedUrispace requestLinedigit responseLine httpFirstLineheaderListToHTTP11TextserializeHTTPResponsehttpStatusTable$fShowIncrementalHttp1Parser