On Thu, 9 Aug 2018, Daniel Jeliński via curl-library wrote:
char *append = "&thistoo=44";Well assuming we want to use the API to build URL based on HTML form with GET action, curl_url_query_append suggested by Geoff would be much nicer.
Yes, you're right. I've taken a more generic approach that isn't at all aware of HTML forms.
In particular, I would expect the API to: - figure out if it needs to add & or ? - figure out if it needs to URLEncode the parameter or value (eg. when setting "company"="AT&T", we need to escape the ampersand) - do the appending / memory allocation part on its own What do you think?
I hear you! How about... A dedicated feature bit to append the string to the query? /* append to query, ask for encoding */ curl_url_set(h, CURLUPART_QUERY, "company=AT&T", CURLU_APPENDQUERY| CURLU_URLENCODE); /* append to query, already encoded */ curl_url_set(h, CURLUPART_QUERY, "company=AT%26T", CURLU_APPENDQUERY); - CURLU_APPENDQUERY makes it also add a '&' before the string if there's already contents in the query. - CURLU_URLENCODE with CURLU_APPENDQUERY set, will skip the '=' letter when doing the encoding -- / daniel.haxx.se
------------------------------------------------------------------- Unsubscribe: https://cool.haxx.se/list/listinfo/curl-library Etiquette: https://curl.haxx.se/mail/etiquette.html