curl / Mailing Lists / curl-library / Single Mail
Buy commercial curl support from WolfSSL. We help you work out your issues, debug your libcurl applications, use the API, port to new platforms, add new features and more. With a team lead by the curl founder himself.

Re: CURLINFO_EFFECTIVE_URL when using CURLOPT_CURLU

From: Daniel Stenberg via curl-library <curl-library_at_lists.haxx.se>
Date: Tue, 7 Jun 2022 17:43:29 +0200 (CEST)

On Tue, 7 Jun 2022, Adam Light wrote:

> One difference I have found with the new version of libcurl is that if you
> set the URL with CURLOPT_CURLU, you must call curl_easy_perform() first
> before it's possible to use curl_easy_getinfo() to get the URL (before then
> you just get an empty string). However if you set the URL with CURLOPT_URL
> you can immediately retrieve it by calling curl_easy_getinfo(). The
> CURLINFO_EFFECTIVE_URL documentation says "...and get the last used
> effective URL" so the current behavior might still be "right" based on the
> documentation, but there is a difference between CURLOPT_URL and
> CURLOPT_CURLU.

curl_easy_getinfo() is designed to bring you information about a previous
transfer and CURLINFO_EFFECTIVE_URL is one of those details. The "effective
URL" used in the previous transfer.

If you didn't do any transfer then you can't know what URL it would be!

So, the fact that you actually get any content back at all before you have
performed any transfer I call just pure luck and a circumstance that I
consider an undocumented behavior.

-- 
  / daniel.haxx.se
  | Commercial curl support up to 24x7 is available!
  | Private help, bug fixes, support, ports, new features
  | https://curl.se/support.html
-- 
Unsubscribe: https://lists.haxx.se/listinfo/curl-library
Etiquette:   https://curl.haxx.se/mail/etiquette.html
Received on 2022-06-07