Absolute URL from relative path

I have a base URL and some relative URIs in this document in which I want to have an absolute path.

eg. base = https://example.com/some/path.html?query=string and relative URIs in this document:

In Java, you have a URL class :

URL abs = new URL(new URL(basePath), relPath);

But, oddly enough, I can't find a simple C library or function that implements just that.

Is there a library supporting this feature? Or even better is some small stand-alone file that you can use?

+5
source share
2 answers

You can bet that it has already been written a thousand times in C. For example, for apache.

Here are a few pointers:

libSoup, the http library used by GNOME: http://developer.gnome.org/libsoup/unstable/SoupURI.html#soup-uri-new-with-base

Suggested for Boost libraries: http://cpp-netlib.github.com/

Google itself (part of Chrome?): Http://code.google.com/p/google-url/

One more thing: http://uriparser.sourceforge.net/

W3C: http://www.w3.org/Library/src/HTParse

URL libcamel: http://www.google.com/codesearch#KhbZeNk3OGk/camel/camel-url.c

API- URI, , , URI:

GLib, C: http://developer.gnome.org/glib/unstable/glib-URI-Functions.html

libedataserver ( Evolution) http://developer.gnome.org/libedataserver/stable/libedataserver-e-url.html

GNet, glib addon: http://developer.gnome.org/gnet/stable/gnet-uri.html

+2

Windows CoInternetCombineUrl Urlmon.dll UrlCombine Shlwapi.lib. AFAIK.

+1

All Articles