[Haskell-cafe] Network.Curl cookie jar madness
Michael Orlitzky
michael at orlitzky.com
Sun Aug 19 06:45:47 CEST 2012
On 08/18/2012 08:52 PM, Michael Orlitzky wrote:
> I'm one bug away from a working program and need some help. I wrote a
> little utility that logs into LWN.net, retrieves an article, and creates
> an epub out of it.
I've created two pages where anyone can test this. The first just takes
any username and password via post and sets a session variable. The
second prints "Success." if the session variable is set, and "Failure."
if it isn't. The bash script,
#!/bin/bash
COOKIE_JAR='/tmp/network-curl-test-bash.txt'
POST_DATA='username=foo&password=bar'
URL1='http://michael.orlitzky.com/tmp/network-curl-test1.php'
URL2='http://michael.orlitzky.com/tmp/network-curl-test2.php'
echo 'Logging in...'
curl --cookie-jar "${COOKIE_JAR}" \
--data "${POST_DATA}" \
"${URL1}"
echo 'Retrieving second page...'
curl --cookie "${COOKIE_JAR}" \
"${URL2}"
works:
$ ./bash-test.sh
Logging in...
Retrieving second page...
Success.
The attached haskell program using Network.Curl, doesn't:
$ runghc haskell-test.hs
Logged in...
Failure.
Any help is appreciated =)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: haskell-test.hs
Type: text/x-haskell
Size: 2268 bytes
Desc: not available
URL: <http://www.haskell.org/pipermail/haskell-cafe/attachments/20120819/6604f221/attachment.hs>
More information about the Haskell-Cafe
mailing list