4]       !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~  None3579NSequence 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....iA StreamWorker: a conduit that takes input tokens and answers with output tokens. It can perform I/O. None4IN lCallbacks that you can provide your sessions to notify you of interesting things happening in the server.Used by the session engine to report delivery of each data frame. Keep this callback very light, it runs in the main sending thread. It is called as f session_id stream_id ordinal when_delivered]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 2Information used to identify a particular session.Get/set a numeric Id from a  Y. For example, to get the session id with this, import `Control.Lens.(^.)` and then do 3 session_id = session_coordinates ^. sessionId This is a temporal interface, but an useful one nonetheless. By setting some values here to True, second-transfer will add some headers to inbound requests, and some headers to outbound requests.MThis interface is deprecated in favor of the AwareWorker functionality....VAdds a second-transfer-eh--used-protocol header to inbound requests. Default: False?Configuration information you can provide to the session maker.Session callbacks.Size to use when splitting data in data frames*Don't insert any extra-headers by default.SCreates a default sessions context. Modify as needed using the lenses interfaces       None4INContains information that applies to all sessions created in the program. Use the lenses interface to access members of this struct.    None!    None%How to know if we can split somewhereInput left-oversGenerator action*Packet and leftovers, if we could get them%How to know if we can split somewhereInput left-oversGenerator actionPacket bytes and left-overs. Safe!CThe protocol version used. Here we distinguish only between HTTP 1.1 and HTTP2!"#!"#!"#None;N $cA set of functions describing how to do I/O in a session. As usual, we provide lenses accessors.&put some data in the channel'get exactly this much data from the channel. This function can be used by HTTP/2 since lengths are pretty well built inside the protocoll itself.(pull data from the channel, as much as the TCP stack wants to provide. we have no option but use this one when talking HTTP/1.1, where the best way to know the length is to scan until a Content-Length is found.)1this is called when we wish to close the channel.*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.+ Callback type to pull data from a channel. The same as to PushAction applies to exceptions thrown from there. The first argument is the number of bytes to pull from the medium. Barring exceptions, we always know how many bytes we are expecting with HTTP/2.Callback type to pull data from a channel in a best-effort basis. When the first argument is True, the data-providing backend can block if the input buffers are empty and await for new data. Otherwise, it will return immediately with an empty ByteString,gCallback 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.-This is an intermediate type. It represents what you obtain by combining something that speaks the protocol and an AwareWorker. In turn, you need to feed a bundle of callbacks implementing I/O to finally start a server.pYou 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.$%&'()*+,-./01$%&'()*+,-./01 $%&'()*+,-./01Safe+;N 2'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.4rA concrete case of the above exception. Throw one of this if you don't want to implement your own type. Use 6 in catch signatures.6)Throw exceptions derived from this (e.g, 4> 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, given that should have included it<MAbstract exception. It is an error if an exception of this type bubbles to this library, but we will do our best to handle it gracefully. All internal error precursors at the workers can thus inherit from here to have a fallback option in case they forget to handle the error. This exception inherits from HTTP11Exception>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 as well@NThrown when the HTTP/2 connection prefix doesn't match the expected prefix.BBAbstract exception. Thrown when encoding/decoding of a frame failsDConcrete exception. Used internally to signal that the client violated the protocol. Clients of the library shall never see this exception.F:Abstract exception. All HTTP/2 exceptions derive from hereH5Use the traditional idiom if you need to derive from <, this is one of the helpersI5Use the traditional idiom if you need to derive from <, this is one of the helpers.23456789:;<=>?@ABCDEFGHI23456789:;<=>?@ABCDEFGHIFGBC@A>?89<=HI:;674523DE#23456789:;<=>?@ABCDEFGHINoneJActivates logging to terminalProtect logging with a mutex... that is to say, this is a horrible hack and you should try to log as little as possible or nothing at all. This just works for instrumentation locks...%Used internally to avoid garbled logs JKJK JKNone+L,Singleton type. Used in conjunction with an &. If the MVar is full, the fuction QI knows that it should finish at its earliest convenience and call the * for any open sessions.NExceptions inheriting from 6. 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.PSimple function to openQInterruptible version of P. 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. LMNOP>Path 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.Q Same as for P Same as for P Same as for P Same as for P4Finish request, write a value here to finish servingLMNOPQLMNOPQNoneC             None +3579NRData related to the requestTRThe HTTP/2 stream id. Or the serial number of the request in an HTTP/1.1 session.UA number uniquely identifying the session. This number is unique and the same for each TPC connection that a client opens using a given protocol.VTMonotonic time close to when the request was first seen in the processing pipeline.W%Which protocol is serving the requestX:For new connections, probably a list of anounced protocolsYThis 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.ZrList 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^A 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.hA 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)).mA 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.n%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.oFinalization headerspFinalization 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.tySometimes a response needs to be handled a bit specially, for example by reporting delivery details back to the workerxFirst argument is the ordinal of this data frame, second an approximation of when the frame was delivered, according to the monotonic clock. Do not linger in this call, it may delay some important thread|+You use this type to answer a request. The ZU are thus response headers and they should contain the :status pseudo-header. The nN is a list of pushed streams...(I don't thaink that I'm handling those yet)A tuple representing the data alone usually needed to create a response. That is, the headers (including HTTP/2 :path, :authority, etc) and maybe an input data stream for requests that include it, that is, POST and PUT.A tuple representing the data alone that you usually need to give as a response, that is, the headers in the response (including the HTTP/2 :status), any pushed streams, a stream with the response data and the footers.A CoherentWorker is a simplified callback that you can implement to handle requests. Then you can convert it to an AwareWorker with .<Main type of this library. You implement one of these for your server. 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.It is important that you consume the data in the cases where there is an input stream, otherwise the memory is lost for the duration of the request, and a malicious client can use that.rAlso, notice that when handling requests your worker can be interrupted with an asynchronous exception of type StreamCancelledException#, if the peer cancels the stream*Convert between the two types of callback."Gets a single header from the listIf you want to skip the footers, i.e., they are empty, use this function to convert an ordinary Source to a DataAndConclusion.@RSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~@RSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~*RSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~NoneQ!"#$%&'()*+,-./01RSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~Q,+-*$%&'()10/.]\[Zp^_`aboRSTUVWXtuvw|}~nhijklmYxqrsyz{fgecd!"#NoneIf you are not processing the potential POST input in a request, use this consumer to drop the data to oblivion. Otherwise it will remain in an internal queue until the client closes the stream, and if the client doesn't want to do so....NoneIN Abstract data-type. Use  to get one of these from Z;. The underlying representation admits better asymptotics.OHTTP headers are case-insensitive, so we can use lowercase versions everywhere!Checks that headers are lowercaseLooks for a given header O(n*log n) Builds the editor from a list.O(n)' Takes the HeaderEditor back to HeadersQreplaceHeaderValue 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)headerLens 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 Replaces 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 HostQ 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.$Given a header editor, introduces a DateB header. This function has a side-effect: to get the current time  Z Z None4INr !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~&  >@ABCDEFGKLOPXYZ[lL !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~None*+35CGenerator action*Packet and leftovers, if we could get them@. None NonegStop condition when parsing the body. Right now only length is supported, given with Content-Length.YTODO: Support "chunked" transfer encoding for classical HTTP/1.1, uploads will need it.Was the parser complete?DNo, not even headers are done. Use the returned value to continueHeaders 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.For requests with a body. The second argument is a condition to stop receiving the body, the third is leftovers from parsing the headers.?Some requests are mal-formed. We can check those cases here.&None&Session attendant that speaks HTTP/1.1NoneJKLMNOPQPQJKNOLMNone+The type of this function is equivalent to: F http2Attendant :: CoherentWorker -> AttendantCallbacks -> IO () Given a q, 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 . NoneNone$(c) Alcides Viamontes Esquivel, 2015BSDalcidesv@zunzun.se experimentalPOSIXNone-JLMNOPQYZ[\]^hmnop|Z]\[^o|nhmYp-PQNOLMJ !"#$%&'(()**+,-../01234567 8 9 : ; <==>?@ABCDEFGHIJJKKLLMMNNOOPPQQRRSSTTUVWXYYZZ[\]]^_`abcdefghhijklmnopqqrstuvwxyz{||}~                   8         !"#$%&&'()*+,-./01234567789:;<=>?@ABCDEEFGHHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~'D]{gsecon_1L4pBBzDSdaCt0bzBRCuaISecondTransfer.Sessions.ConfigSecondTransfer.SessionsSecondTransfer.TypesSecondTransfer.ExceptionSecondTransfer.MainLoopSecondTransfer.Utils.DevNull SecondTransfer.Utils.HTTPHeadersSecondTransfer.Http1SecondTransfer.Http2SecondTransfer.MainLoop.Tokens SecondTransfer.Sessions.InternalSecondTransfer.MainLoop.Framer SecondTransfer.MainLoop.Protocol$SecondTransfer.MainLoop.PushPullTypeCoherentWorkerhttp11Attendanthttp2AttendantSecondTransfer.MainLoop.Logging#SecondTransfer.MainLoop.OpenSSL_TLSSecondTransfer.Utils&SecondTransfer.MainLoop.CoherentWorkerSecondTransfer.Http2.SessionSecondTransfer.Http2.Framer SecondTransfer.MainLoop.InternalSecondTransfer.Http1.ParseSecondTransfer.Http1.Session"SecondTransfer.Http2.MakeAttendantSecondTransferSessionsCallbacks_reportErrorCallback_SC_dataDeliveryCallback_SCDataFrameDeliveryCallback ErrorCallbackSessionComponent(SessionInputThread_HTTP2SessionComponent0SessionHeadersOutputThread_HTTP2SessionComponent-SessionDataOutputThread_HTTP2SessionComponentFramer_HTTP2SessionComponentSession_HTTP11SessionCoordinates sessionIdSessionsEnrichedHeaders_addUsedProtocoldataDeliveryCallback_SCreportErrorCallback_SCSessionsConfig_sessionsCallbacks_sessionsEnrichedHeaders_dataFrameSizeaddUsedProtocoldefaultSessionsEnrichedHeaders dataFrameSizesessionsCallbackssessionsEnrichedHeadersdefaultSessionsConfigSessionsContextmakeSessionsContextHttpProtocolVersion Http11_HPV Http2_HPVAttendantCallbacks_pushAction_AtC_pullAction_AtC_bestEffortPullAction_AtC_closeAction_AtC CloseAction PullAction PushAction AttendantbestEffortPullAction_AtCcloseAction_AtCpullAction_AtCpushAction_AtCStreamCancelledExceptionGenericIOProblem IOProblemHTTP11SyntaxExceptionContentLengthMissingExceptionHTTP500PrecursorExceptionHTTP11ExceptionBadPrefaceExceptionFramerExceptionHTTP2ProtocolExceptionHTTP2SessionException+convertHTTP500PrecursorExceptionToException)getHTTP500PrecursorExceptionFromExceptionenableConsoleLogginglogit FinishRequestTLSLayerGenericProblemtlsServeWithALPN"tlsServeWithALPNAndFinishOnRequest Perception _streamId_Pr _sessionId_Pr_startedTime_Pr _protocol_Pr_anouncedProtocols_PrInputDataStreamHeadersHeader HeaderValue HeaderNameRequest _headers_RQ _inputData_RQ_perception_RQanouncedProtocols_Pr protocol_Pr sessionId_PrstartedTime_Pr streamId_Pr PushedStream_requestHeaders_Psh_responseHeaders_Psh_dataAndConclusion_PshDataAndConclusion PushedStreamsFootersFinalizationHeaders headers_RQ inputData_RQ perception_RQEffect_fragmentDeliveryCallback_Ef_priorityEffect_EfFragmentDeliveryCallbackdataAndConclusion_PshrequestHeaders_PshresponseHeaders_PshPrincipalStream _headers_PS_pushedStreams_PS_dataAndConclusion_PS _effect_PSfragmentDeliveryCallback_EfpriorityEffect_EfdefaultEffects TupledRequestTupledPrincipalStream AwareWorkerdataAndConclusion_PS effect_PS headers_PSpushedStreams_PS&tupledPrincipalStreamToPrincipalStreamrequestToTupledRequestcoherentToAwareWorkergetHeaderFromFlatList nullFooterdropIncomingData HeaderEditorlowercaseHeadersheadersAreLowercase!headersAreLowercaseAtHeaderEditor fetchHeaderfromListtoListreplaceHeaderValue headerLensreplaceHostByAuthorityintroduceDateHeaderStreamWorkerClass StreamWorker initService initSession initStreamStreamOutputActionSendHeaders_SOASendAssociatedHeaders_SOA SendData_SOASendAssociatedData_SOASendAssociatedFinish_SOA Finish_SOAGlobalStreamId LocalStreamIdStreamInputToken Headers_STkData_Stk Finish_StkUnpackedNameValueListactionIsForAssociatedStreampackHeaderTuplesunpackHeaderTuples getHeader$fBinaryUnpackedNameValueList$fEqSessionCoordinates_sessionsConfig_nextSessionId nextSessionIdsessionsConfigacquireNewSessionTagsessionExceptionHandlerLengthCallbackFramer readNextChunkreadNextChunkAndContinuereadUpToreadLengthFromUntamedBestEffortPullAction'convertHTTP2SessionExceptionToException%getHTTP2SessionExceptionFromException!convertFramerExceptionToExceptiongetFramerExceptionFromException!convertHTTP11ExceptionToExceptiongetHTTP11ExceptionFromException#$fExceptionStreamCancelledException$fExceptionGenericIOProblem$fExceptionIOProblem$fShowIOProblem $fExceptionHTTP11SyntaxException($fExceptionContentLengthMissingException$$fExceptionHTTP500PrecursorException$fShowHTTP500PrecursorException$fExceptionHTTP11Exception$fShowHTTP11Exception$fExceptionBadPrefaceException$fExceptionFramerException$fShowFramerException!$fExceptionHTTP2ProtocolException $fExceptionHTTP2SessionException$fShowHTTP2SessionExceptiongloballyLogWelllogWithExclusivityLogitconfigureLoggingToConsolesetLoggerLevels loggerChanreadLoggerChanbaseGHC.MVarMVar Protocols Wired_PtrConnection_PtrWired_t Connection_tInterruptibleEitherLeft_IRight_I InterruptedcloseConnectiondisposeWiredSessiongetSelectedProtocolrecvDataBestEffortrecvDatasendDatawaitForConnectionmakeConnectionallOk badHappenedtimeoutReached useBufferSizeprotocolsToWiredefaultWaitTime smallWaitTimeprovideActions!$fExceptionTLSLayerGenericProblemWord24strToInt word24ToInt getWord24be putWord24be lowercaseTextunfoldChannelAndSource stripString domainFromUrl subByteString$fBinaryWord24innerMap AutosortedtoFlatBsaTitleIsLowercasecolon$fMonoidHeaderEditor$fOrdAutosortedSessionSettings _pushEnabledHeaderOutputMessageNormalResponse_HMPushPromise_HMDataOutputToConveyor HeadersSent InputFrame OutputFrameWorkerThreadEnvironment _streamId_headersOutput _dataOutput_streamsCancelled_WTE_sessionSettings_WTE_nextPushStream_WTE pushEnabled SessionData_sessionsContext _sessionInput_sessionOutput_toEncodeHeaders_toDecodeHeaders_receivingHeaders_lastGoodStream_stream2HeaderBlockFragment_forWorkerThread _awareWorker_streamsCancelled_stream2PostInputMechanism_stream2WorkerThread_sessionIdAtSession_sessionSettings_nextPushStreamPostInputMechanismCoherentSession SessionMakerSessionOutputCommandCancelSession_SOCFinishStream_SOCSessionInputCommandFirstFrame_SICMiddleFrame_SICInternalAbort_SICCancelSession_SIC WorkerMonadStream2HeaderBlockFragment HashTable SessionOutputSessionOutputChannelAbstractionSessionOutputPacket SessionInputSession dataOutput headersOutputnextPushStream_WTEsessionSettings_WTEstreamIdstreamsCancelled_WTEsendMiddleFrameToSessionsendFirstFrameToSessionsendCommandToSessiongetFrameFromSession awareWorkerforWorkerThreadlastGoodStreamnextPushStreamreceivingHeaderssessionIdAtSession sessionInput sessionOutputsessionSettingssessionsContextstream2HeaderBlockFragmentstream2PostInputMechanismstream2WorkerThreadstreamsCancelledtoDecodeHeaderstoEncodeHeaders http2SessionsessionInputThread sendOutFrameaddExtraHeadersvalidateIncomingHeaderscloseConnectionBecauseIsInvalidframeEndsStreamunlessReceivingHeaderscreateMechanismForStreamclosePostDataSourcestreamWorkerSendDatasendBytesToPimpostDataSourceFromMechanism isSettingsAckisStreamCancelledsendPrimitive500Error workerThread pusherThreadsendDataOfStreamappendHeaderFragmentBlockgetHeaderBytesisAboutHeadersgetHeadersPriorityframeEndsHeadersstreamIdFromFrameheadersOutputThreadbytestringChunkdataOutputThreadFramerSessionData _stream2flow_stream2outputBytes_defaultStreamWindow _canOutput_outputIsForbidden_noHeadersInChannel _pushAction _closeAction_sessionIdAtFramer _lastStream_prioritySendStatePrioritySendState _semToSend_prioQ PrioPacketNoHeadersInChannel CanOutputStream2AvailSpaceFlowControlCommand AddBytes_FCM Finish_FCMhttp2PrefixLengthmaxPacketsInQueue$fOrdPrioPacket$fEqPrioPacket FramerSession canOutput closeActiondefaultStreamWindow lastStreamnoHeadersInChanneloutputIsForbiddenprioritySendState pushActionsessionIdAtFramer stream2flowstream2outputBytes wrapSessionhttp2FrameLength addCapacityfinishFlowControlForStream readNextFrame inputGathereroutputGathererupdateLastStream!startStreamOutputQueueIfNotExistsstartStreamOutputQueuehandleHeadersOfStreamframeIsHeadersAndOpensStream pushFramesendGoAwayFrame sendBytesflowControlOutput releaseFramerwithPrioritySendsendReorderingBodyStopConditionHttp1ParserCompletionMustContinue_H1PCOnlyHeaders_H1PCHeadersAndBody_H1PCRequestIsMalformed_H1PCRequestOrResponseLine Request_RoRL Response_RoRLUseBodyLength_BSCHeaderParseClosureIncrementalHttp1Parser _fullText _stateParsernewIncrementalHttp1ParseraddByteselaborateHeaders splitByColonparseFirstLine bsToLowerstripBs locateCRLFstwoCRLFsAreConsecutiveisWsCh8isWs http1Token http1Method unspacedUrispace requestLinedigit responseLine httpFirstLineheaderListToHTTP11TextserializeHTTPResponsehttpStatusTable$fShowIncrementalHttp1Parser