diff --git a/Network/TLS/Extension.hs b/Network/TLS/Extension.hs
--- a/Network/TLS/Extension.hs
+++ b/Network/TLS/Extension.hs
@@ -71,10 +71,10 @@
 
 instance Extension ServerName where
     extensionID _ = extensionID_ServerName
-    extensionEncode (ServerName l) = runPut $ mapM_ encodeNameType l
+    extensionEncode (ServerName l) = runPut $ putOpaque16 (runPut $ mapM_ encodeNameType l)
         where encodeNameType (ServerNameHostName hn)       = putWord8 0  >> putOpaque16 (BC.pack hn) -- FIXME: should be puny code conversion
-              encodeNameType (ServerNameOther (nt,opaque)) = putWord8 nt >> putOpaque16 opaque
-    extensionDecode _ = runGetMaybe (remaining >>= \len -> getList len getServerName >>= return . ServerName)
+              encodeNameType (ServerNameOther (nt,opaque)) = putWord8 nt >> putBytes opaque
+    extensionDecode _ = runGetMaybe (getWord16 >>= \len -> getList (fromIntegral len) getServerName >>= return . ServerName)
         where getServerName = do
                   ty    <- getWord8
                   sname <- getOpaque16
diff --git a/Network/TLS/Handshake/Client.hs b/Network/TLS/Handshake/Client.hs
--- a/Network/TLS/Handshake/Client.hs
+++ b/Network/TLS/Handshake/Client.hs
@@ -58,7 +58,7 @@
                 allowedvers  = pAllowedVersions params
                 ciphers      = pCiphers params
                 compressions = pCompressions params
-                getExtensions = sequence [secureReneg,npnExtention] >>= return . catMaybes
+                getExtensions = sequence [sniExtension,secureReneg,npnExtention] >>= return . catMaybes
 
                 toExtensionRaw :: Extension e => e -> ExtensionRaw
                 toExtensionRaw ext = (extensionID ext, extensionEncode ext)
@@ -70,6 +70,7 @@
                 npnExtention = if isJust $ onNPNServerSuggest params
                                  then return $ Just $ toExtensionRaw $ NextProtocolNegotiation []
                                  else return Nothing
+                sniExtension = return ((\h -> toExtensionRaw $ ServerName [(ServerNameHostName h)]) <$> clientUseServerName cparams)
                 sendClientHello = do
                         crand <- getStateRNG ctx 32 >>= return . ClientRandom
                         let clientSession = Session . maybe Nothing (Just . fst) $ clientWantSessionResume cparams
diff --git a/tls.cabal b/tls.cabal
--- a/tls.cabal
+++ b/tls.cabal
@@ -1,5 +1,5 @@
 Name:                tls
-Version:             1.1.1
+Version:             1.1.2
 Description:
    Native Haskell TLS and SSL protocol implementation for server and client.
    .
