ڭ      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~#portable experimental!dominic.steinitz@blueyonder.co.uk BCut up a string into 72 char lines, each line terminated by CRLF. portable experimental!dominic.steinitz@blueyonder.co.uk Take [Octet] and return [Octet] according to the standard. H The length of the result is always 16 octets or 128 bits as required  by the standard. non-portable (not tested) experimentalbjorn@bringert.netAllows stream logging.  Refer to  below. ?Streams should make layering of TLS protocol easier in future,  they allow reading/$writing to files etc for debugging, + they allow use of protocols other than TCP/IP  and they allow customisation. (Instances of this class should not trim - the input in any way, e.g. leave LF on line 3 endings etc. Unless that is exactly the behaviour ) you want from your twisted instances ;) >This is the type returned by many exported network functions.  Wraps a stream with logging I/ O, the first 7 argument is a filename which is opened in AppendMode.      non-portable (not tested) experimentalbjorn@bringert.net The 4 object allows input buffering, and maintenance of  some admin-type data. The - newtype is a wrapper that allows us to make ( connections an instance of the StreamIn/%Out classes, without ghc extensions. D While this looks sort of like a generic reference to the transport = layer it is actually TCP specific, which can be seen in the  implementation of the 'Stream Connection' instance. /Open a connection to port 80 on a remote host. 3This function establishes a connection to a remote  host, it uses  getHostByName which interrogates the 5 DNS system, hence may trigger a network connection. Add a  persistant) option? Current persistant is default.  Use Result+ type for synchronous exception reporting? 4Checks both that the underlying Socket is connected 0 and that the connection peer matches the given ( host name (which is recorded locally).   non-portable (not tested) experimentalbjorn@bringert.netAn HTTP Response.  The : instance of this type is used for message serialisation, B which means no body data is output, additionally the output will D show an HTTP version of 1.1 instead of the actual version returned  by a server.  !"#$An HTTP Request.  The : instance of this type is used for message serialisation, % which means no body data is output. %&might need changing in future  1) to support  uri in OPTIONS request + 2) transparent support for both relative  &% absolute uris, although this should  already work (leave scheme & host parts empty). '()*+The HTTP request method, to be used in the %$ object. = We are missing a few of the stranger methods, but these are - not really necessary until we add full TLS. +,-./012DThis class allows us to write generic header manipulation functions  for both %$ and  data types. 3HTTP Header Name type: 0 Why include this at all? I have some reasons / 1) prevent spelling errors of header names, 5 2) remind everyone of what headers are available, 4 3) might speed up searches for specific headers. Arguments against: / 1) makes customising header names laborious  2) increases code volume. 41Allows for unrecognised or experimental headers. 56789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdef(The Header data type pairs header names & values. ghijklmn#Parse the authority part of a URL.  RFC 1732, section 3.1:  4 //<user>:<password>@<host>:<port>/<url-path> @ Some or all of the parts "<user>:<password>@", ":<password>", 0 ":<port>", and "/<url-path>" may be excluded. opqr0Inserts a header with the given name and value.  Allows duplicate header names. 6Adds the new header only if no previous header shares  the same name. )Removes old headers with duplicate name. Inserts multiple headers. s)Gets a list of headers with a particular 3. t<Lookup presence of specific HeaderName in a list of Headers 3 Returns the value from the first matching header. uvASimple way to get a resource across a non-persistant connection.  Headers that may be altered: > Host Altered only if no Host header is supplied, HTTP/1.1 & requires a Host header. D Connection Where no allowance is made for persistant connections 3 the Connection header will be set to close wLike v*, but acting on an already opened stream. xyHReceive and parse a HTTP request from the given Stream. Should be used ! for server side interactions. zHVery simple function, send a HTTP response over the given stream. This 9 could be improved on to use different transfer types. 4Used when we know exactly how many bytes to expect. 'Used when nothing about data is known, . Unfortunately waiting for a socket closure ' causes bad behaviour. Here we just ( take data once and give up the rest. A necessary feature of HTTP/1.1 , Also the only transfer variety likely to  return any footers. 2Maybe in the future we will have a sensible thing 4 to do here, at that time we might want to change  the name. DRemove leading crlfs then call readTillEmpty2 (not required by RFC) 'Read lines until an empty line (CRLF), - also accepts a connection close as end of  input, which is not an HTTP/1.1 compliant * thing to do - so probably indicates an  error condition. {|}~  !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}au$%&'() !"*10/.-,+#vwxyz2fg3edcba`_^]\[ZYXWVUTSRQPONMLKJIHGFEDCBA@?>=<;:987654oprsqt|{}hijklmna !" !"#$%&'()%&'()*10/.-,++,-./01232edcba`_^]\[ZYXWVUTSRQPONMLKJIHGFEDCBA@?>=<;:987654456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefgghijklmijklmnopqrstuvwxyz{|}non-portable (not tested) experimentalbjorn@bringert.netl~     5Specifies if a proxy should be used for the request. +Use the proxy given. Should be of the form http://host:port, host,  host:port, or  http://host Don't use a proxy.  !"#$%&'()*+3Splits a list into two parts, the delimiter occurs 6 at the head of the second list. Nothing is returned . when no occurance of the delimiter is found. ,Removes delimiters. 0Returns a URI that is consistent with the first 4 argument uri when read in the context of a second. 2 If second argument is not sufficient context for , determining a full URI then anarchy reins. -/Serialise a Cookie for inclusion in a request. .9Adds a cookie to the browser state, removing duplicates. /018Convert WWW-Authenticate header into a Challenge object 20Return authorities for a given domain and path.  Assumes dom is lower case  Interacting with browser state: 343Retrieve a likely looking authority for a Request. 5*Asking the user to respond to a challenge 65Generating a credentials value from an Authority, in 7 the context of a specific request. If a client nonce 1 was to be used then this function might need to ( be of type ... -> BrowserAction String #Apply a browser action to a state. 7Alter browser state 8Do an io action 9:;</~2~/~=      !"#$%%&'()*++,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijkllmmnopqrstuvwxyz{|}~      !"#$%&'()*+,-./0123456789 HTTP-3001.0.3Network.Stream Network.TCP Network.HTTPNetwork.BrowserNetwork.HTTP.MD5AuxNetwork.HTTP.Base64Network.HTTP.MD5DebugStreamreadLine readBlock writeBlockcloseResult ConnError ErrorMisc ErrorParse ErrorClosed ErrorResetbindEhandleSocketErrormyrecv debugStreamConn ConnClosedMkConnconnSockconnAddrconnBffrconnHost ConnectionConnRefgetRefopenTCP openTCPPort isConnectedToResponserspCode rspReason rspHeadersrspBody ResponseCodeRequestrqURIrqMethod rqHeadersrqBody RequestMethodTRACEOPTIONSDELETEPOSTGETPUTHEAD HasHeaders HeaderName HdrCustomHdrContentTransferEncodingHdrLastModified HdrExpiresHdrETagHdrContentTypeHdrContentRange HdrContentMD5HdrContentLocationHdrContentLengthHdrContentLanguageHdrContentEncodingHdrContentBaseHdrAllowHdrWWWAuthenticate HdrWarningHdrVary HdrSetCookie HdrServer HdrRetryAfter HdrPublicHdrProxyAuthenticate HdrLocationHdrAge HdrUserAgent HdrRefererHdrRangeHdrProxyAuthorizationHdrMaxForwardsHdrIfUnmodifiedSince HdrIfRangeHdrIfNoneMatch HdrIfMatchHdrIfModifiedSinceHdrHostHdrFrom HdrExpect HdrCookieHdrAuthorizationHdrAcceptLanguageHdrAcceptEncodingHdrAcceptCharset HdrAcceptHdrVia HdrUpgradeHdrTransferEncoding HdrPragmaHdrDate HdrConnectionHdrCacheControlHeader URIAuthorityuserpasswordhostportparseURIAuthority insertHeaderinsertHeaderIfMissing replaceHeader insertHeadersretrieveHeaders findHeader httpVersion simpleHTTP simpleHTTP_sendHTTP receiveHTTP respondHTTP urlDecode urlEncode urlEncodeVarsForm BrowserAction BrowserStateProxyNoProxy Authority AuthDigestauNonce auAlgorithmauDomainauOpaqueauQop AuthBasicauRealm auUsername auPasswordauSiteCookie uriDefaultTo uriTrimHostdefaultCookieFilteruserCookieFilter addCookie setCookies getCookiessetCookieFiltergetAuthoritiessetAuthorities addAuthoritygetAuthorityGensetAuthorityGensetAllowBasicAuthbrowseioAction setErrHandler setOutHandlerouterrsetAllowRedirectsgetAllowRedirectssetProxy setDebugLogrequestdefaultGETRequest formToRequestMD5get_nextlen_padfinishedWordListBoolListStrABCDRotationXYZZord64md5md5smd5imd5_main md5_do_block md5_roundmd5_inner_functionmd5_fmd5_gmd5_hmd5_i magic_numbersroundsabcd_to_stringdisplay_32bits_as_hexabcd_to_integerrev_numstring_to_word32sbools_to_word32slength_to_charsOctet encodeArray int4_char3 char3_int4enc1chop72encencodedecodehashDbg Behaviour DieHorribly ExpectEntityDoneRetryContinuebaseGHC.ShowShow RequestData ResponseDataGHC.Num* getHeaders setHeadersdebug httpLogFiletrimsplit pURIAuthority pUserInfobefore orNothing headerMap lookupHeader parseHeader parseHeadersparseRequestHeadparseResponseHead matchResponsegetAuthuriToAuthorityStringlinearTransferhopefulTransferchunkedTransferchunkedTransferCuglyDeathTransferreadTillEmpty1readTillEmpty2FormVar RequestStateBAliftBSbsErrbsOut bsCookiesbsCookieFilterbsAuthorityGen bsAuthoritiesbsAllowRedirectsbsAllowBasicAuthbsConnectionPoolbsProxybsDebug Challenge ChalDigestchDomainchNoncechOpaquechStale chAlgorithmchQop ChalBasicchRealmQop QopAuthIntQopAuth Algorithm AlgMD5sessAlgMD5MkCookieckDomainckNameckValueckPath ckComment ckVersion quotedstringword splitManycookieToHeaderheaderToCookies getCookiesForgetCookieFilterheaderToChallenge getAuthFor pickChallengeanticipateChallengechallengeToAuthority withAuthorityalterBSgetBSgetProxyrequest'uriAuthToString