cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: https redirect problem?

From: Daniel Stenberg <daniel-curl_at_haxx.se>
Date: Mon, 11 Oct 2004 00:26:03 +0200 (CEST)

On Sun, 10 Oct 2004, Iris Jing wrote:

...

> it doesn't seem to handle https redirect properly. (At first I tought it
> could be within curlpp wrapper, but then I figured out it shouldn't,

...

> As I have RedHat linux installed, so there is already a bundled curl
> (7.10.6), which is under /usr/bin.

This is a pretty old version so you don't surprise us if you find many bugs in
it.

> $curl https://username:password@my.xxxxx.net/XXX/XXX/XXX.jsp
>
> and it worked perfectly! (I even don't need to put -L option in the command
> line. I got the file I want.

This is a clue for you: without -L it doesn't follow redirects. Your issue has
nothing to do with redirects and I don't know why you ever thought so.

> < HTTP/1.1 200 OK

No 3XX code and no Location: header = no redirect.

> I'm thinking that the problem could be within libcurl, because the curl
> seems to be able to handle https web rediction properly...

This is no redirection.

> I understand that curl and libcurl are totally different things, curl is a
> command-line tool. While if curl can handle https redirect w/o problem, I
> assume that libcurl should be able to do something similar.

curl uses libcurl so yes, libcurl does everything transfer-related that curl
does.

> I suppose if curl_easy_setopt(curl, CURLOPT_FOLLOWLOCATION, 1) works, then
> after the authentication (which already happened properly), it should
> automatically redirect to the https webpage I intended to fetch (but it
> didn't)

If the server would respond with a proper 3XX code and a Location: header,
then yes, but otherwise no.

> Any suggestion would be greatly appreciated. Thanks in advance.

I'm having a hard time just to understand your question. As I understand it,
you get the page you want with curl but not when using libcurl from your
program?

Then I suggest you make your program send the exact same request as curl does.
Use CURLOPT_VERBOSE and curl -v to get the details.

-- 
      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-11