cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: https redirect problem?

From: Daniel Stenberg <daniel-curl_at_haxx.se>
Date: Wed, 13 Oct 2004 08:48:03 +0200 (CEST)

On Tue, 12 Oct 2004, Iris Jing wrote:

> However, when I send request from my program like this:
>
> ..curl_easy_setopt(curl, CURLOPT_URL,
> "https://username:password@my.xxxxx.net:443/NOTlogindir/MyTargetFile.jsp");
>
> I only obtained the login page (login.jsp).

No you I don't think you did. Since it sent no Location: header it didnt't
redirect, it was just the server that decided to respond back to you with some
contents that you didn't expect. Perhaps the same contents as the login.jsp
page.

This is most likely not curl's fault since the command line version works. I
would guess that the server is stupidly doing this due to the lack of
user-agent field.

> So it seems to me that curl got passed the authentication and grab the file
> properly (*redirect* to MyTargetFile after login);

There is no "login" for this, the autentication credentials are passed on in
the request for that single page.

> For cookies, I tried to turn on the COOKIEJAR, but still didn't work out.

You didn't use cookies for the command line version.

> The cookies for Curl and libcurl are different because they're actually from
> different pages: Curl grabs cookies from MyTargetFile.jsp, while libcurl got
> it from login.jsp, that's what I assumed.

Cookies are very seldom for a specific page, they are for domains and paths.
And since the server didn't do any redirect, it _is_ the same page both
approaches get, it is just different contents (and cookies apparently) and
that's a server-side decision.

> I suspect that I either haven't got the right version of libcurl (I'm using
> curlpp0.3.1 now), or there could be something wrong with my program, but
> still couldn't figure out what it is. Should I use this one --
> curl-7.12.1.tar.gz at http://curl.haxx.se/download.html? Or you think it
> doesn't matter that I use curlpp0.3.1 or curl-7.12.1. Thanks.

I tend to always recommend the latest version (unless something really weird
is going on) and I still do. However, I don't think you suffer from a libcurl
bug so I doubt it'll change the behaviour for you.

I can't say anything about the curlpp version as I know nothing about it.

-- 
      Daniel Stenberg -- http://curl.haxx.se -- http://daniel.haxx.se
       Dedicated custom curl help for hire: http://haxx.se/curl.html
Received on 2004-10-13