curl / Mailing Lists / curl-users / Single Mail

curl-users

URL parsing for the command line tool?

From: Daniel Stenberg <daniel_at_haxx.se>
Date: Thu, 9 Aug 2018 15:57:32 +0200 (CEST)

Hi,

In a future libcurl release, there is going to be a URL parsing/handling API
[1] added. It can parse URLs, allow access to parts of the URL, setting or
updating specific parts and can "merge" a relative URL onto an absolute one.

Do you think the command line tool would benefit from offering these services
somehow? If so, how? What you like curl to help your scripts or shells with in
this regard?

Extract the different parts from a URL? Maybe like this?

   in="https://example.com/index.html"
   curl --url-input $in --url-out "%{host} %{path}\n"

Maybe change parts of a URL and output the new version?

   curl --url-input $in --url-replace "host=example.org" --url-out "%{url}\n"

Perhaps applying a relative path onto an absolute URL and show the resulting
path part?

   curl --url-input $in --url-new "../index?nooo" --url-out "%{path}\n"

I'm just brain-storming here.

[1] = https://github.com/curl/curl/wiki/URL-API

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