Name

uri_create_uri — create a new URI from an existing URI

Library

URI parsing library (liburi, -luri)

Synopsis

#include <liburi.h>

URI *uri_create_uri( const URI *restrict uri, const URI *restrict base);

Description

The uri_create_str function creates a new URI instance from an existing URI.

If uri is not absolute, and an absolute base URI is supplied as base, the source URI will be resolved relative to the base URI and the result will be an absolute URI. If no base URI is supplied, the result will be a duplicate of uri.

The resulting instance must be freed later using uri_destroy(3).

Parameters

uri

The source URI to duplicate or resolve.

base

An optional absolute base URI. If base is supplied but is not an absolute URI, the results are undefined.

Return value

If the URI was duplicated or resolved successfully, uri_create_uri will return a new URI instance. If the URI could not be duplicated, or some other error occurs, NULL will be returned and errno set accordingly.

Diagnostics

In the event of an error ocurring, errno may be set to one of the following values:

ENOMEM

A memory allocation operation failed.

See also

liburi(3), uri_create_str(3), uri_destroy(3), uri_absolute(3), uri_str(3).