HTTP 4000.0.0 → 4000.0.1
raw patch · 2 files changed
+20/−17 lines, 2 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
Files
- HTTP.cabal +3/−5
- Network/Browser.hs +17/−12
HTTP.cabal view
@@ -1,5 +1,5 @@ Name: HTTP-Version: 4000.0.0+Version: 4000.0.1 Cabal-Version: >= 1.2 Build-type: Simple License: BSD3@@ -21,12 +21,10 @@ package to allow overloaded representation of HTTP request bodies and responses. Provides three such instances: lazy and strict 'ByteString', along with the good old @String@.--+ . Inspired in part by Jonas Aadahl et al's work on ByteString'ifying HTTP a couple of years ago.--+ . Git repository available at <http://code.galois.com/HTTPbis.git> Flag old-base
Network/Browser.hs view
@@ -101,7 +101,7 @@ , BufferMode(NoBuffering, LineBuffering) ) import Data.Word (Word8)-+import Debug.Trace type Octet = Word8 @@ -200,7 +200,7 @@ headerToCookies :: String -> Header -> [Cookie] headerToCookies dom (Header HdrSetCookie val) = case parse cookies "" val of- Left e -> error ("Cookie parse failure on: " ++ val ++ " " ++ show e)+ Left e -> error ("Cookie parse failure on: " ++ val ++ " " ++ show e) Right x -> x where cookies :: Parser [Cookie]@@ -221,7 +221,7 @@ spaces_l = many (satisfy isSpace) - cvalue = quotedstring <|> many1 (satisfy $ not . (==';'))+ cvalue = quotedstring <|> many1 (satisfy $ not . (==';')) <|> return "" -- all keys in the result list MUST be in lower case cdetail :: Parser [(String,String)]@@ -483,7 +483,7 @@ anticipateChallenge :: HTTPRequest ty -> BrowserAction t (Maybe Authority) anticipateChallenge rq = let uri = rqURI rq in- do { authlist <- getAuthFor (uriToAuthorityString uri) (uriPath uri)+ do { authlist <- getAuthFor (uriAuthToString $ reqURIAuth rq) (uriPath uri) ; return (listToMaybe authlist) } @@ -730,7 +730,7 @@ request' nullVal rqState rq = do -- add cookies to request let uri = rqURI rq- cookies <- getCookiesFor (uriToAuthorityString uri) (uriPath uri)+ cookies <- getCookiesFor (uriAuthToString $ reqURIAuth rq) (uriPath uri) when (not $ null cookies) (out $ "Adding cookies to request. Cookie names: " ++ foldl spaceappend "" (map ckName cookies))@@ -749,7 +749,7 @@ out ("Sending:\n" ++ show rq'') e_rsp <- case p of- NoProxy -> dorequest (uriAuth $ rqURI rq'') rq''+ NoProxy -> dorequest (reqURIAuth rq'') rq'' Proxy str ath -> do let rq''' = maybe rq'' (\x -> insertHeader HdrProxyAuthorization (withAuthority x rq'') rq'')@@ -785,7 +785,7 @@ out ("Received:\n" ++ show rsp) -- add new cookies to browser state let cookieheaders = retrieveHeaders HdrSetCookie rsp- let newcookies = concat (map (headerToCookies $ uriToAuthorityString uri) cookieheaders)+ let newcookies = concat (map (headerToCookies $ uriAuthToString $ reqURIAuth rq) cookieheaders) when (not $ null newcookies) (out $ foldl (\x y -> x ++ "\n " ++ show y) "Cookies received:" newcookies)@@ -951,11 +951,16 @@ c' <- debugByteStream (f++'-': uriAuthToString hst) c sendHTTP c' r -uriAuth :: URI -> URIAuth-uriAuth x = case uriAuthority x of- Just ua -> ua- _ -> error ("No uri authority for: "++show x)-+reqURIAuth :: HTTPRequest ty -> URIAuth+reqURIAuth req = + case uriAuthority (rqURI req) of+ Just ua -> ua+ _ -> case lookupHeader HdrHost (rqHeaders req) of+ Nothing -> error ("reqURIAuth: no URI authority for: " ++ show req)+ Just h -> URIAuth { uriUserInfo = ""+ , uriRegName = h+ , uriPort = ""+ } ------------------------------------------------------------------ ------------------ Request Building ------------------------------