Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Set CURLUPART_QUERY urlencoded value. #3231

Closed
moteus opened this issue Nov 4, 2018 · 1 comment
Closed

Set CURLUPART_QUERY urlencoded value. #3231

moteus opened this issue Nov 4, 2018 · 1 comment
Labels

Comments

@moteus
Copy link

moteus commented Nov 4, 2018

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

@bagder bagder added the URL label Nov 4, 2018
@bagder
Copy link
Member

bagder commented Nov 4, 2018

The documentation doesn't say anything about not encoding the equals sign when CURLU_URLENCODE is used. It does however say it for the CURLU_APPENDQUERY bit.

We could probably discuss if that shouldn't just skip the encoding of the first equals sign but at least what you describe matches the dopumentation!

@bagder bagder closed this as completed in 9aa8ff2 Nov 7, 2018
@lock lock bot locked as resolved and limited conversation to collaborators Feb 5, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Development

No branches or pull requests

2 participants