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
URL

Comments

@moteus
Copy link

@moteus 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

This comment has been minimized.

Copy link
Member

@bagder 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 added a commit that referenced this issue Nov 6, 2018
Fixes #3231
@bagder bagder closed this 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.
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants
You can’t perform that action at this time.