{-# OPTIONS_HADDOCK prune #-}-- |Definition of things related on HTTP request.---- In general you don't have to use this module directly.moduleNetwork.HTTP.Lucu.Request(Method(..),Request(..),requestP)whereimportNetwork.HTTP.Lucu.HeadersimportNetwork.HTTP.Lucu.HttpVersionimportNetwork.HTTP.Lucu.ParserimportNetwork.HTTP.Lucu.Parser.HttpimportNetwork.URI-- |This is the definition of HTTP request methods, which shouldn't-- require any description.dataMethod=OPTIONS|GET|HEAD|POST|PUT|DELETE|TRACE|CONNECT|ExtensionMethod!Stringderiving(Eq,Show)-- |This is the definition of HTTP reqest.dataRequest=Request{reqMethod::!Method,reqURI::!URI,reqVersion::!HttpVersion,reqHeaders::!Headers}deriving(Show,Eq)instanceHasHeadersRequestwheregetHeaders=reqHeaderssetHeadersreqhdr=req{reqHeaders=hdr}requestP::ParserRequestrequestP=do_<-manycrlf(method,uri,version)<-requestLinePheaders<-headersPreturnRequest{reqMethod=method,reqURI=uri,reqVersion=version,reqHeaders=headers}requestLineP::Parser(Method,URI,HttpVersion)requestLineP=domethod<-methodP_<-spuri<-uriP_<-spver<-httpVersionP_<-crlfreturn(method,uri,ver)methodP::ParserMethodmethodP=(letmethods=[("OPTIONS",OPTIONS),("GET",GET),("HEAD",HEAD),("POST",POST),("PUT",PUT),("DELETE",DELETE),("TRACE",TRACE),("CONNECT",CONNECT)]inchoice$map(\(str,mth)->stringstr>>returnmth)methods)<|>fmapExtensionMethodtokenuriP::ParserURIuriP=dostr<-many1$satisfy(\c->not(isCtlc||c==' '))caseparseURIReferencestrofNothing->failPJusturi->returnuri