cURL / Mailing Lists / curl-library / Single Mail

curl-library

actual version: HTTP redirect -> https target

From: Harald Latzko <root_at_c-works.net>
Date: Wed, 20 Mar 2013 19:10:39 +0100

Hi,

I'm using the latest version of CURL 7.29.0 under Mac OS X and Linux 64bit in C. I'm trying to fetch a resource from the following URL: http://www.comcertca.com/Repository/COMCERT%20Root/COMCERT%20Root.crl

Using wget shows that the ressource shows a HTTP302, the new location is https://www.comcertca.com/Repository/COMCERT%20Root/COMCERT%20Root.crl:

localhost:Downloads haraldlatzko$ wget "http://www.comcertca.com/Repository/COMCERT%20Root/COMCERT%20Root.crl"
--2013-03-20 13:51:12-- http://www.comcertca.com/Repository/COMCERT%20Root/COMCERT%20Root.crl
Resolving www.comcertca.com... 212.140.163.222
Connecting to www.comcertca.com|212.140.163.222|:80... connected.
HTTP request sent, awaiting response... 302 Object Moved
Location: https://www.comcertca.com/Repository/COMCERT%20Root/COMCERT%20Root.crl [following]
--2013-03-20 13:51:13-- https://www.comcertca.com/Repository/COMCERT%20Root/COMCERT%20Root.crl
Connecting to www.comcertca.com|212.140.163.222|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 741 [application/pkix-crl]
Saving to: `COMCERT Root.crl.2'

CURL shows that a HTTP error 302 occurred (okay, this is correct), but using an older version (i.e. 7.20.0), the target is being retrieved in the moved target. I'm using the curl handle the following way:

            curl_global_init(CURL_GLOBAL_ALL);
            curl_handle = curl_easy_init();
            curl_easy_setopt(curl_handle, CURLOPT_URL, url);
            curl_easy_setopt(curl_handle, CURLOPT_NOPROGRESS, 1);
            curl_easy_setopt(curl_handle, CURLOPT_FAILONERROR, 1);
            curl_easy_setopt(curl_handle, CURLOPT_SSL_VERIFYPEER, 0);
            curl_easy_setopt(curl_handle, CURLOPT_FOLLOWLOCATION, 1);
            curl_easy_setopt(curl_handle, CURLOPT_REDIR_PROTOCOLS, CURLPROTO_HTTP | CURLPROTO_HTTPS);

So I would expect that the target ressource would be retrieved successfully, but I'm receiveing an HTTP 302 return code. What am I doing wrong?

Regards,
Harald

-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette: http://curl.haxx.se/mail/etiquette.html
Received on 2013-03-20