tighttp: Tiny and Incrementally-Growing HTTP library

[ bsd3, library, network ] [ Propose Tags ]

Example programs


This is simple client. This send GET request and show page source. Run as following.

runhaskell get.hs hackage.haskell.org /packages/


import "monads-tf" Control.Monad.Trans
import Data.Pipe
import System.Environment
import Network
import Network.TigHTTP.Client
import Network.TigHTTP.Types

import qualified Data.ByteString as BS

main :: IO ()
main = do
	addr : pth : _ <- getArgs
	h <- connectTo addr $ PortNumber 80
	r <- request h $ get addr 80 pth
	_ <- runPipe $ responseBody r =$= finally printP (putStrLn "")
	return ()

printP :: MonadIO m => Pipe BS.ByteString () m ()
printP = await >>= maybe (return ()) (\s -> liftIO (BS.putStr s) >> printP)


This is simple server. This recieve client's request. And send command line arguments as response. Run as following.

runhaskell server.hs Hello World I Am TigHTTP
 import Control.Monad
 import Control.Concurrent
 import Data.Pipe
 import System.IO
 import System.Environment
 import Network
 import Network.TigHTTP.Server
 import Network.TigHTTP.Types

 import qualified Data.ByteString.Char8 as BSC
 import qualified Data.ByteString.Lazy as LBS

 main :: IO ()
 main = do
 	as <- getArgs
 	soc <- listenOn $ PortNumber 80
 	forever $ do
 		(h, _, _) <- accept soc
 		void . forkIO $ do
 			req <- getRequest h
 			print $ requestPath req
 			putResponse h
				. (response :: LBS.ByteString -> Response Pipe Handle)
				. LBS.fromChunks $ map BSC.pack as

If you want more examples. Please see examples directory.

Versions [faq],,,,,,,,,, (info)
Dependencies base (>=4.8 && <5), bytestring (==0.10.*), handle-like (==0.1.*), monads-tf (==0.1.*), old-locale (==1.0.*), papillon (==0.1.*), simple-pipe (==0.0.0.*), time (==1.5.*) [details]
License BSD-3-Clause
Author Yoshikuni Jujo <PAF01143@nifty.ne.jp>
Maintainer Yoshikuni Jujo <PAF01143@nifty.ne.jp>
Revised Revision 1 made by HerbertValerioRiedel at 2018-10-04T09:02:38Z
Category Network
Home page https://github.com/YoshikuniJujo/tighttp/wiki
Source repo head: git clone git://github.com/YoshikuniJujo/tighttp.git
this: git clone git://github.com/YoshikuniJujo/tighttp.git(tag tighttp-
Uploaded by YoshikuniJujo at 2017-02-09T00:31:32Z
Distributions NixOS:
Downloads 6610 total (12 in the last 30 days)
Rating (no votes yet) [estimated by Bayesian average]
Your Rating
  • λ
  • λ
  • λ
Status Hackage Matrix CI
Docs not available [build log]
All reported builds failed as of 2017-02-09 [all 3 reports]


  • Network
    • TigHTTP
      • Network.TigHTTP.Client
      • Network.TigHTTP.Server
      • Network.TigHTTP.Types


Note: This package has metadata revisions in the cabal description newer than included in the tarball. To unpack the package including the revisions, use 'cabal get'.

Maintainer's Corner

For package maintainers and hackage trustees