cURL / Mailing Lists / curl-users / Single Mail

curl-users

Re: curl 7.7.1 (win32) -b option doesn't send cookies!?

From: Daniel Stenberg <daniel_at_haxx.se>
Date: Mon, 23 Apr 2001 08:06:42 +0200 (MET DST)

On Mon, 23 Apr 2001, Serge Kruppa wrote:

> Given the nature of the Hotmail login procedure I have to use two batch
> files with distinct curl commands. The first batch file reads like:
>
> curl -A "Mozilla/4.0 (compatible; MSIE 5.01; Windows NT 5.0)" -D cookies
> -b -v -i -e lc3.law5.hotmail.passport.com -d "login=MYLOGIN (etc)..."
> https://lc3.law5.hotmail.passport.com/cgi-bin/dologin -L

*bzzzzzt* Error detected!

If you want the -b option to actually read something from a file here, you
need to enter a valid file name that holds the cookies. You specify '-b -v'
which makes curl attempt to read cookies from a file named '-v'. I don't
think you want that. Anyway, the -v doesn't work using this command line, as
the -b will treat it as a an argument to it and eat it.

Use '-b -' instead, if all you want is to enable the cookie parser. Then the
following '-v' will take effect.

> During the resulting login process Hotmail sends a lot of cookies that
> are handled by curl and saved to the cookies file as expected. Finally a
> URL is sent that must be opened using the second batch file which looks
> like:
>
> curl -A "Opera/5.11 (Windows 2000; U) [en]" -v -i -b cookies -L
> "http://lw15fd. (etc)..."

This line looks fine however.

> The problem is that according to my packet sniffer's trace, none of the
> saved cookies are sent to the remote host that aborts the connection as a
> result (with a "nocookies" redirect to the main login page).

You don't have to sniff on curl doings, the -v option displays all requests.

> I do not have any debugging facilities to check if the cookies file is
> opened and read at all. It's content is similar to:

[cookies cut off]

> While the output from the packet sniffer shows that curl is trying to
> access the correct URL but is not supplying the cookies as it should:

> GET /cgi-bin/sbox?curmbox= (etc)... HTTP/1.1
> User-Agent: Opera/5.11 (Windows 2000; U)  [en]
> Host: lw15fd.law15.hotmail.msn.com

^^^^ ooooooooh...

You don't have any cookies stored for that domain. If you take a look again
in the cookies file you just showed us, you see that all the four cookies are
specified for the .passport.com domain and this request above is obviously
not done to a host in that domain (judging from the Host: line).

Or is the Host: line not correct? (We've found some other Host:-related
problems in 7.7.1 already, chances are you've hit a variation of it, hence my
question.)

Thus, you don't get any of those cookies passed to the server.

> Pragma: no-cache
> Accept: image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, */*

I stored your cookiefile and tried to run curl on the
lc3.law5.hotmail.passport.com host with a line like:

        curl -b [your headers] lc3.law5.hotmail.passport.com -v

... and I got it to pass cookies all right.

> Am I making a silly mistake or is there really a problem in curl?

I'm sure there are problems in curl but I don't think you've yet hit any of
them.

If you just sort out if there are cookies to pass to the hotmail.com site, I
bet you'll be closer.

BTW, there already is a mail-downloader for hotmail called 'gotmail' that is
based on curl for the downloads...

> Besides that I have noticed that shuffling around the -b and -A arguments
> sometimes (quite frequently) causes curl to use one of the literal
> parameters as a hostname and attempt a DNS resolution!

I think that's only because you didn't properly shuffle around the following
argument to those options properly. If you think otherwise, please provide me
with example command lines that seem to do wrong. I want bugs to get fixed.

-- 
  Daniel Stenberg -- curl project maintainer -- http://curl.haxx.se/
Received on 2001-04-23