Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 35 lines (33 sloc) 0.957 kb
7a0d930 @snoyberg Host is a bytestring
snoyberg authored
1 {-# LANGUAGE OverloadedStrings #-}
87ea8d5 @snoyberg Enumeratees for response bodies (constant space usage)
snoyberg authored
2 {-# LANGUAGE CPP #-}
4aaaf9f @snoyberg Splitting into multiple modules
snoyberg authored
3 import Network.HTTP.Conduit
6b585a0 @snoyberg Basis of a public API
snoyberg authored
4 import Network
a89dda0 @snoyberg Some initial work
snoyberg authored
5 import qualified Data.ByteString as S
56a2480 @snoyberg Response datatype
snoyberg authored
6 import qualified Data.ByteString.Lazy as L
224214d @snoyberg UTF8 support
snoyberg authored
7 import System.Environment.UTF8 (getArgs)
7a3f2e8 @snoyberg Fixed test
snoyberg authored
8 import Data.CaseInsensitive (original)
8aceb33 @snoyberg Hopefully final set of rearrangements
snoyberg authored
9 import Data.Conduit
f812149 @snoyberg Major API simplification
snoyberg authored
10 import Control.Monad.IO.Class (liftIO)
62269c1 @snoyberg Minor tweaks
snoyberg authored
11 import Control.Exception (finally)
a89dda0 @snoyberg Some initial work
snoyberg authored
12
27712fb @snoyberg Cleaned up all warnings
snoyberg authored
13 main :: IO ()
4198cd8 @snoyberg Switch to zlib-enum package
snoyberg authored
14 main = withSocketsDo $ do
7a3f2e8 @snoyberg Fixed test
snoyberg authored
15 [url] <- getArgs
47eed3f @snoyberg certificateVerifyDomain
snoyberg authored
16 _req2 <- parseUrl url
ad7a2be @snoyberg Massive cleanup, introduce ConnInfo
snoyberg authored
17 {-
d6cf200 @snoyberg urlEncodedBody
snoyberg authored
18 let req = urlEncodedBody
19 [ ("foo", "bar")
20 , ("baz%%38**.8fn", "bin")
21 ] _req2
ad7a2be @snoyberg Massive cleanup, introduce ConnInfo
snoyberg authored
22 -}
62269c1 @snoyberg Minor tweaks
snoyberg authored
23 flip finally printOpenSockets $ runResourceT $ do
8aceb33 @snoyberg Hopefully final set of rearrangements
snoyberg authored
24 man <- newManager
f9ae2cf @snoyberg redirectCount setting
snoyberg authored
25 Response sc hs b <- httpLbs _req2 man
f812149 @snoyberg Major API simplification
snoyberg authored
26 liftIO $ do
8aceb33 @snoyberg Hopefully final set of rearrangements
snoyberg authored
27 print sc
28 mapM_ (\(x, y) -> do
29 S.putStr $ original x
30 putStr ": "
31 S.putStr y
32 putStrLn "") hs
33 putStrLn ""
34 L.putStr b
Something went wrong with that request. Please try again.