Permalink
Browse files

withSocketsDo explanation

  • Loading branch information...
1 parent 920a7f9 commit 8fce4018e0be370da18aca252f68e1e6f637308c @snoyberg committed Nov 2, 2010
Showing with 18 additions and 1 deletion.
  1. +17 −0 Network/HTTP/Enumerator.hs
  2. +1 −1 http-enumerator.cabal
View
@@ -34,6 +34,23 @@
-- * Host
--
-- * Accept-Encoding (not currently set, but client usage of this variable /will/ cause breakage).
+--
+-- One last thing: there are two different backends available for the HTTPS
+-- support: the OpenSSL library and the tls package. The former requires some
+-- initialization, while the latter does not. Therefore, this module exports a
+-- 'withHttpEnumerator' function to provide necessary initialization.
+-- Additionally, any network code on Windows requires some initialization, and
+-- the network library provides withSocketsDo to perform it. Therefore, proper
+-- usage of this library will always involve calling those two functions at
+-- some point. The best approach is to simply call them at the beginning of
+-- your main function, such as:
+--
+-- > import Network.HTTP.Enumerator
+-- > import qualified Data.ByteString.Lazy as L
+-- > import Network (withSocketsDo)
+-- >
+-- > main = withSocketsDo . withHttpEnumerator
+-- > $ simpleHttp "http://www.haskell.org/" >>= L.putStr
module Network.HTTP.Enumerator
( -- * Perform a request
simpleHttp
View
@@ -1,5 +1,5 @@
name: http-enumerator
-version: 0.2.0.2
+version: 0.2.0.3
license: BSD3
license-file: LICENSE
author: Michael Snoyman <michael@snoyman.com>

0 comments on commit 8fce401

Please sign in to comment.