Skip to content

curl_url_set fails for encoded hostname #14656

Closed
@muttalkadavul

Description

@muttalkadavul

I did this

int main() 
{
    std::string input = "resum%33%35.com";
    CURLUcode rc = CURLUE_BAD_HANDLE;
    CURLU *urlh = curl_url();

    rc = curl_url_set(urlh, CURLUPART_HOST, input.c_str(), 0);
    if(rc != CURLUE_OK)
    {
        std::cout << "curlucode = " << rc << std::endl;
        curl_url_cleanup(urlh);
    }
    
    std::cout << "Hostname: " << input << std::endl;
    std::cout << "libcurl version" << curl_version() << std::endl;
    return 0;
} 

I expected the following

I expected it to return CURLUE_OK but got this

curlucode = 21
Hostname: resum%33%35.com
libcurl versionlibcurl/8.9.1 OpenSSL/1.1.1f zlib/1.2.11 brotli/1.0.7 libpsl/0.21.0

When I run the above code with an older curl I get

Hostname: resum%33%35.com
libcurl versionlibcurl/7.68.0 OpenSSL/1.1.1f zlib/1.2.11 brotli/1.0.7 libidn2/2.2.0 libpsl/0.21.0 (+libidn2/2.2.0) libssh/0.9.3/openssl/zlib nghttp2/1.40.0 librtmp/2.3

No error!

curl/libcurl version

libcurl versionlibcurl/8.9.1 OpenSSL/1.1.1f zlib/1.2.11 brotli/1.0.7 libpsl/0.21.0

operating system

Ubuntu 22.04

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions