Skip to content

Set CURLUPART_QUERY urlencoded value. #3231

@moteus

Description

@moteus

I did this

I try set basic qury string with value like
curl_url_set(urlp, CURLUPART_QUERY, "a=hello world", CURLU_URLENCODE);
and then I try get URL like
curl_url_set(urlp, CURLUPART_URL, &url, 0);

I expected the following

I expect url like http://example.com/?a=hello+world but I got http://example.com/?a%3dhello+world

I agree that adding multiple key / value pairs in one call can lead to ambiguity and function should add always only one pair per call. But function should not encode first equal sign.
Also, I found that curl does not encode equal sign when use call like
curl_url_set(urlp, CURLUPART_QUERY, "a=hello=world", CURLU_APPENDQUERY + CURLU_URLENCODE);
In this case result is ?a=hello=world. It little inconsistence but not a bug I think.

curl/libcurl version

7.62.0 WinSSL+WinIDN

operating system

Windows 10 x64

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions