Skip to content

CURLE_URL_MALFORMAT returned if Location has malformed url #3340

@pps83

Description

@pps83

I did this

I do http get using libcurl and returned 302 response intentionally has malformed url in the Location header (this is a unit test). I requested libcurl not to follow redirects. libcurl used to always return CURL_OK in this case without checking contents of the Location header, but starting from 7.62 unit tests started to fail and it appears that now libcurl returns CURLE_URL_MALFORMAT in this case. I think this is wrong, because request actually succeeded and response was received. CURLE_URL_MALFORMAT means that the request that I made was invalid and had malformed url. Now it's not even clear if CURLE_URL_MALFORMAT resulted from the url0 that I requested, or after fetching url0 and checking Location header that contained malformed url1. At least with previous versions of curl I was able to extract value of locations header. It was clear if CURLE_URL_MALFORMAT resulted from url0, and I was able to get malformed url1 to inspect/log it. Now I cannot even get the url1. CURLINFO_REDIRECT_URL returns NULL, and CURLINFO_REDIRECT_COUNT also returns null.
I've seen that url api code added in 7.62, I suspect that now curl tries to validate Location while it was requested not to follow it and effectively fail as it tried to follow the location.

I expected the following

curl/libcurl version

[curl -V output]

operating system

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions