[Haskell-cafe] Question concerning Network.Curl.Opts
michael at schmong.org
Sat Jan 15 00:44:31 CET 2011
I'm having trouble passing header strings properly, and I'd like some advice
on how to proceed. Below is a capture of what is being sent, versus what I
am trying to send. I won't include all code, only what I think is necessary.
If I have omitted something important, please let me know. How could I
discover what the cause of the discrepancy is?
Thanks again for any feedback.
Here's a snippet from the header, what is being sent.
User-Agent: Mozilla/4.0 (compatible; MSIE 5.01; Windows NT 5.0)
^ compare this to CurlHttpHeaders
Here's the part of the source I think is relevant
> launch :: String -> String -> IO (Either String String)
> launch user pass = do
> -- Initialize Curl
> curl <- initCurl
> -- Sequence of steps
> let steps = do
> curlResp curl urlInitial method_GET
> curlResp curl urlLogin $ loginOpts user pass
> curlResp curl urlFlash1 method_GET
> curlResp curl urlFlash2 method_GET
> curlResp curl urlGetResource resourceOpts <---- here's where the
problem is revealed
> runErrorT steps
> main :: IO ()
> main = do
> -- username and password
> user:pass:_ <- getArgs
> -- Launch webpage
> resp <- launch user pass
> -- Response comes as Either String String
> -- You have to handle each case
> case resp of
> Left err -> print err
> Right body -> putStrLn body
> resourceOpts :: [CurlOption]
> resourceOpts =
> [ CurlHttpHeaders
> , "Accept-Language en-us,en;q=0.5"
> , "Accept-Charset ISO-8859-1,utf-8;q=0.7,*;q=0.7"
> , "Keep-Alive 115"
> , "Connection keep-alive"
> , "X-Requested-With XMLHttpRequest"
> , "X-Prototype-Version 188.8.131.52"
> , CurlEncoding "gzip,deflate"
> , CurlReferer "https://172.16.1.18/showWebForwards.do"
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Haskell-Cafe