Reposting this, as it seems my Haskell Cafe posts for the past few days aren't making it to the list.
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.
> GET /resourceList.do?form=webForwardsForm&readOnly=false&policyLaunching=true&resourcePrefix=webForwards&path=%2FshowWebForwards.do&messageResourcesKey=webForwards&actionPath=%2FresourceList.do HTTP/1.1
User-Agent: Mozilla/4.0 (compatible; MSIE 5.01; Windows NT 5.0)
Host: 172.16.1.18
Accept: */*
Accept-Encoding: gzip,deflate
Referer: https://172.16.1.18/showWebForwards.do
Cookie: domainLogonTicket=SLXa10225c6e8389b3eb181e3df5dcf08de; logonTicket=SLXa10225c6e8389b3eb181e3df5dcf08de; lbTrack=OAIAGHMWQDOLYYTJEXQHXBYPXVALXNREKIHAYYRZSOGYJLUYNNCJ--------; SSLX_SSESHID=bvgx4mggmy6v
^ 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 text/javascript, text/html, application/xml, text/xml, */*"
> , "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 1.6.0.3"
> ]
> , CurlEncoding "gzip,deflate"
> , CurlReferer "https://172.16.1.18/showWebForwards.do"
> ]