curl / Mailing Lists / curl-library / Single Mail

curl-library

Re: a URL API ?

From: Daniel Stenberg <daniel_at_haxx.se>
Date: Thu, 2 Aug 2018 17:36:36 +0200 (CEST)

On Thu, 2 Aug 2018, Geoff Beier wrote:

> The setters would be important to us. I might be bikeshedding here, but the
> ability to add to the query would be very nice. So something like
> curl_url_query_append(urlp, "numitems", 3)

That ("numitems", 3) approach is very specific for adding a "[name]=[number]"
snippet though. Shouldn't it rather be a function for appdending a generic
string?

   curl_url_query_append(urp, "numitems=3");

... or using the alternative B API
(https://github.com/curl/curl/wiki/URL-API#url-api-alternative-b) approach:

   curl_url_append(urp, CURLUPART_QUERY, "numitems=3");

> An unsigned type feels more appropriate for port than int does.

Yes, or as a full blown string to make it a generic part in alternative B.

> I assume this is obvious, but if this API gets added to curl, a setopt that
> takes a CURLURL would be wanted :)

Yes!

-- 
  / daniel.haxx.se
-------------------------------------------------------------------
Unsubscribe: https://cool.haxx.se/list/listinfo/curl-library
Etiquette:   https://curl.haxx.se/mail/etiquette.html
Received on 2018-08-02