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.

CURLINFO_EFFECTIVE_URL when using CURLOPT_CURLU

From: Adam Light via curl-library <curl-library_at_lists.haxx.se>
Date: Mon, 6 Jun 2022 15:40:09 -0700

Our application wraps libcurl to allow our users to write code in our
application's scripting language that supports ftp and http[s] transfers.

We recently upgraded from libcurl version 7.67.0 to 7.83.1 and some of our
tests started failing. These tests all use URLs that contain spaces (e.g. "
ftp://ftp.example.com/untitled folder/test.txt". I traced these failures
down to https://github.com/curl/curl/pull/7073, which changed urlapi to
reject spaces in URLs. I understand the reasoning behind that change, but
for backwards compatibility purposes I would prefer if our application was
able to continue supporting spaces in URLs, just as one can paste in a URL
containing spaces into a browser and (usually?) get the intended page.

In the past we have been using the CURLOPT_URL option to set the url, but I
found the new CURLOPT_CURLU option. I'm now able to create the URL handle
with the CURLU_ALLOW_SPACE flag and then pass that handle to
curl_easy_setopt.

However the problem is that it appears that when the url is set using
CURLOPT_CURLU, curl_easy_getinfo for CURLINFO_EFFECTIVE_URL returns an
empty string. So unless I am missing something it doesn't seem to be
possible to have raw spaces in the URL and also use CURLINFO_EFFECTIVE_URL
to retrieve the actual URL after curl has followed redirects. If anyone has
suggestions about how to use both of these together I'd appreciate it.

Thanks
Adam


-- 
Unsubscribe: https://lists.haxx.se/listinfo/curl-library
Etiquette:   https://curl.haxx.se/mail/etiquette.html
Received on 2022-06-07