-- | a very simple interface for acting as an HTTP client. This is mostly used for things like "Happstack.Server.Proxy". You are more likely to want a library like http-enumerator <http://hackage.haskell.org/package/http-enumerator>.moduleHappstack.Server.ClientwhereimportHappstack.Server.Internal.Handler(parseResponse,putRequest)importHappstack.Server.Internal.Types(Response,Request,getHeader,readDec')importData.Maybe(fromJust)importqualifiedData.ByteString.Char8asBimportqualifiedData.ByteString.Lazy.Char8asLimportNetwork(PortID(PortNumber),connectTo,withSocketsDo)importSystem.IO(BufferMode(NoBuffering),hFlush,hSetBuffering)-- | Sends the serialized request to the host defined in the request-- and attempts to parse response upon arrival.getResponse::Request->IO(EitherStringResponse)getResponserq=withSocketsDo$dolet(hostName,p)=span(/=':')$fromJust$fmapB.unpack$getHeader"host"rqportInt=ifnullpthen80elsereadDec'$tailpportId=PortNumber$toEnum$portInth<-connectTohostNameportIdhSetBufferinghNoBufferingputRequesthrqhFlushhinputStr<-L.hGetContentshreturn$parseResponseinputStr