X-Git-Url: http://gitweb.michael.orlitzky.com/?p=dead%2Flwn-epub.git;a=blobdiff_plain;f=src%2FLWN%2FHTTP.hs;h=71058dc67040b69da700e2744fe1daa796ae3607;hp=1b6bcfd3c966a060ea326a06245f67811f66ba9a;hb=8202cb1437ece6be41677c0bbdae4713041199ac;hpb=e9151ade502fa997be41b6e37fb9841cacd0f528 diff --git a/src/LWN/HTTP.hs b/src/LWN/HTTP.hs index 1b6bcfd..71058dc 100644 --- a/src/LWN/HTTP.hs +++ b/src/LWN/HTTP.hs @@ -48,10 +48,7 @@ default_curl_opts = CurlFollowLocation True, -- Give it a little time... - CurlTimeout 45, - - -- For debugging. - CurlVerbose True ] + CurlTimeout 45 ] make_cookie_jar :: IO FilePath @@ -93,9 +90,8 @@ get_page cookie_file url = -- | Log in using curl. Store the resulting session cookies in the --- supplied file.Warning: This returns an error if the function --- fails! -log_in :: FilePath -> String -> String -> IO (Maybe String) +-- supplied file. +log_in :: FilePath -> String -> String -> IO (Either String String) log_in cookie_jar username password = withCurlDo $ do -- Create a curl instance. @@ -111,8 +107,8 @@ log_in cookie_jar username password = return $ case code of - CurlOK -> Nothing - error_code -> Just $ "HTTP Error: " ++ (show error_code) + CurlOK -> Right (respBody resp) + error_code -> Left $ "HTTP Error: " ++ (show error_code) -- If an error occurred, we want to dump as much information as -- possible. If this becomes a problem, we can use respGetInfo to -- query the response object for more information