Initial commit
This commit is contained in:
commit
bd56b879a7
2 changed files with 50 additions and 0 deletions
22
Main.hs
Normal file
22
Main.hs
Normal file
|
@ -0,0 +1,22 @@
|
|||
import Network.HTTP.Server
|
||||
import Network.HTTP.Server.Logger
|
||||
import Network.HTTP.Base
|
||||
import Network.HTTP.Headers
|
||||
import Network.Socket.Internal
|
||||
import Network.URL
|
||||
|
||||
displayListHdr :: [Header] -> [Char]
|
||||
displayListHdr = concatMap show
|
||||
|
||||
copyHeaders :: SockAddr -> URL -> Request [Char] -> IO (Response [Char])
|
||||
copyHeaders addr url req =
|
||||
return Response {rspCode = (2,0,0)
|
||||
,rspReason = "OK"
|
||||
,rspHeaders = [Header HdrConnection "close"]
|
||||
,rspBody = displayListHdr $ rqHeaders req}
|
||||
|
||||
main = serverWith config copyHeaders
|
||||
where
|
||||
config = Config { srvLog = quietLogger
|
||||
, srvHost = "menf.in"
|
||||
, srvPort = 8000 }
|
28
http-request.cabal
Normal file
28
http-request.cabal
Normal file
|
@ -0,0 +1,28 @@
|
|||
-- Initial http-request.cabal generated by cabal init. For further
|
||||
-- documentation, see http://haskell.org/cabal/users-guide/
|
||||
|
||||
name: http-request
|
||||
version: 0.1.0.0
|
||||
synopsis: Displays the full http request your browser (and ISP) made for you
|
||||
-- description:
|
||||
license: PublicDomain
|
||||
license-file: LICENSE
|
||||
author: Martin Potier
|
||||
maintainer: mpo.framacode@marvid.fr
|
||||
-- copyright:
|
||||
-- category:
|
||||
build-type: Simple
|
||||
-- extra-source-files:
|
||||
cabal-version: >=1.10
|
||||
|
||||
executable http-request
|
||||
main-is: Main.hs
|
||||
-- other-modules:
|
||||
-- other-extensions:
|
||||
build-depends: base >=4.8 && <4.9
|
||||
, http-server
|
||||
, url
|
||||
, network
|
||||
, HTTP
|
||||
-- hs-source-dirs:
|
||||
default-language: Haskell2010
|
Loading…
Reference in a new issue