title: Absolute URL from relative path
body: <p>I've got a base URL and some relative URIs in that document I want to have the absolute path of.</p>
  
  <p>E.g. base = <a href="https://example.com/some/path.html?query=string" rel="nofollow">https://example.com/some/path.html?query=string</a> and relative URIs in that document:</p>
  
  <ul>
  <li>index.html → <a href="https://example.com/some/index.html" rel="nofollow">https://example.com/some/index.html</a></li>
  <li>.. → <a href="https://example.com/" rel="nofollow">https://example.com/</a></li>
  <li>../../../../abc → <a href="https://example.com/abc" rel="nofollow">https://example.com/abc</a></li>
  <li>abc/.. → <a href="https://example.com/some/" rel="nofollow">https://example.com/some/</a></li>
  <li>//example.org/ → <a href="https://example.org/" rel="nofollow">https://example.org/</a></li>
  <li><a href="ftp://example.net/" rel="nofollow">ftp://example.net/</a> → <a href="ftp://example.net/" rel="nofollow">ftp://example.net/</a></li>
  </ul>
  
  <p>In Java you have the <a href="http://docs.oracle.com/javase/6/docs/api/java/net/URL.html" rel="nofollow">class URL</a> accomplishing that:</p>
  
  <pre class="lang-java prettyprint-override"><code>URL abs = new URL(new URL(basePath), relPath);
  </code></pre>
  
  <p>But strangely enough I can't find a plain C library or function realizing just that.</p>
  
  <p>Is there a library proving that feature? Or better yet some small self-contained file one can use?</p>