diff --git a/Setup.hs b/Setup.hs
--- a/Setup.hs
+++ b/Setup.hs
@@ -10,12 +10,13 @@
 --
 
 import Data.Char (toUpper)
-import Distribution.PackageDescription (PackageDescription)
+import Distribution.Text (display)
+import Distribution.PackageDescription (PackageDescription(..))
 import Distribution.Simple
 import Distribution.Simple.LocalBuildInfo (LocalBuildInfo)
 import Distribution.Simple.Setup (ConfigFlags)
 import Distribution.System (OS (..), buildOS)
-import System.IO (IOMode (..), hPutStrLn, withFile)
+import System.IO (IOMode (..), Handle, hPutStrLn, withFile)
 
 main :: IO ()
 main = defaultMainWithHooks $ simpleUserHooks {
@@ -29,13 +30,18 @@
 -}
 
 configure :: Args -> ConfigFlags -> PackageDescription -> LocalBuildInfo -> IO ()
-configure _ _ _ _  = do
+configure _ _ p _  = do
 
     withFile "config.h" WriteMode (\h -> do
-        hPutStrLn h ("#define " ++ s))
+        discoverOperatingSystem h
+        discoverLibraryVersion h p)
 
     return ()
 
+discoverOperatingSystem :: Handle -> IO ()
+discoverOperatingSystem h = do
+        hPutStrLn h ("#define " ++ s)
+
   where
     o = buildOS
 
@@ -46,3 +52,13 @@
             _       -> "__" ++ up o ++ "__"
 
     up x = map toUpper (show x)
+
+discoverLibraryVersion :: Handle -> PackageDescription -> IO ()
+discoverLibraryVersion h p = do
+        hPutStrLn h ("#define VERSION \"http-streams/" ++ s ++ "\"")
+
+  where
+    i = package p
+    v = pkgVersion i
+    s = display v
+
diff --git a/http-streams.cabal b/http-streams.cabal
--- a/http-streams.cabal
+++ b/http-streams.cabal
@@ -1,6 +1,6 @@
 cabal-version:       >= 1.10
 name:                http-streams
-version:             0.4.0.0
+version:             0.4.0.1
 synopsis:            An HTTP client using io-streams
 description:
  /Overview/
@@ -77,14 +77,15 @@
                      attoparsec,
                      base,
                      blaze-builder,
+                     base64-bytestring,
                      bytestring,
                      case-insensitive,
                      hspec,
+                     hspec-expectations,
                      io-streams,
                      mtl,
                      network,
                      openssl-streams >= 1.0 && <1.1,
-                     snap            >= 0.9    && < 1.0,
                      snap-core       >= 0.9    && < 1.0,
                      snap-server     >= 0.9    && < 1.0,
                      system-fileio   >= 0.3.10 && < 0.4,
@@ -104,6 +105,9 @@
                      -fno-warn-missing-signatures
                      -fno-warn-unused-binds
                      -fno-warn-unused-do-bind
+
+  include-dirs:      .
+
 
 source-repository    head
   type:              git
diff --git a/src/Network/Http/Inconvenience.hs b/src/Network/Http/Inconvenience.hs
--- a/src/Network/Http/Inconvenience.hs
+++ b/src/Network/Http/Inconvenience.hs
@@ -46,7 +46,7 @@
 import qualified Data.HashSet as HashSet
 import Data.IORef (IORef, newIORef, readIORef, writeIORef)
 import Data.List (intersperse)
-import Data.Monoid (Monoid (..), (<>))
+import Data.Monoid (Monoid (..), mappend)
 import qualified Data.Text as T
 import qualified Data.Text.Encoding as T
 import Data.Typeable (Typeable)
@@ -88,16 +88,16 @@
     go !b !s = maybe b' esc (S.uncons y)
       where
         (x,y)     = S.span (flip HashSet.member urlEncodeTable) s
-        b'        = b <> Builder.fromByteString x
+        b'        = b `mappend` Builder.fromByteString x
         esc (c,r) = let b'' = if c == ' '
-                                then b' <> Builder.fromWord8 (c2w '+')
-                                else b' <> hexd c
+                                then b' `mappend` Builder.fromWord8 (c2w '+')
+                                else b' `mappend` hexd c
                     in go b'' r
 
 
 hexd :: Char -> Builder
-hexd c0 = Builder.fromWord8 (c2w '%') <> Builder.fromWord8 hi
-                                      <> Builder.fromWord8 low
+hexd c0 = Builder.fromWord8 (c2w '%') `mappend` Builder.fromWord8 hi
+                                      `mappend` Builder.fromWord8 low
   where
     !c        = c2w c0
     toDigit   = c2w . intToDigit
diff --git a/src/Network/Http/RequestBuilder.hs b/src/Network/Http/RequestBuilder.hs
--- a/src/Network/Http/RequestBuilder.hs
+++ b/src/Network/Http/RequestBuilder.hs
@@ -9,6 +9,7 @@
 -- the BSD licence.
 --
 
+{-# LANGUAGE CPP                        #-}
 {-# LANGUAGE GeneralizedNewtypeDeriving #-}
 {-# LANGUAGE OverloadedStrings          #-}
 
@@ -43,6 +44,8 @@
 import Network.Http.Connection
 import Network.Http.Types
 
+#include "config.h"
+
 --
 -- | The RequestBuilder monad allows you to abuse do-notation to
 -- conveniently setup a 'Request' object.
@@ -91,7 +94,7 @@
 http m p' = do
     q <- get
     let h0 = qHeaders q
-    let h1 = updateHeader h0 "User-Agent" "http-streams/0.4.0.0"
+    let h1 = updateHeader h0 "User-Agent" VERSION
     let h2 = updateHeader h1 "Accept-Encoding" "gzip"
 
     let e  = case m of
@@ -190,7 +193,7 @@
 -- >                     ("*/*", 0)]
 --
 -- will result in an @Accept:@ header value of
--- @text\/html; q=1.0, application\/xml; q=0.8, *\/*; q=0.0@ as you
+-- @text\/html; q=1.0, application\/xml; q=0.8, \*\/\*; q=0.0@ as you
 -- would expect.
 --
 setAccept' :: [(ByteString,Float)] -> RequestBuilder ()
