ec_parse_url

March 26, 2020 Contributors

Name

ec_parse_url — parses an RFC 3986 URI

Synopsis

#include "misc/ec_url_parse.h"

| ec_url_details * **ec_parse_url** ( | url, |   |
|   | len); |   |

const char * <var class="pdparam">url</var>;
int <var class="pdparam">len</var>;

Description

Note

This reference page was automatically generated from functions found in the header files in the development branch. The function described here may not exist in generally available versions of Momentum, and may change in behavior when it is generally available. Consult your vendor for definitive advice on the use of this function.

parses an RFC 3986 URI

Given a URI string, this function parses it according to RFC 3986, additionally parsing userinfo similarly to HTTP:

userinfo.user[:userinfo.pass]

and parsing the query similarly to HTTP:

key=value(&key=value)*

into the attrs dictionary. Since some schemes may not have further encoding within the query, or may not use the HTTP-like query encoding, a raw_query as well as a the entire (percent-decoded) query are made available. Failure to decode the query in an HTTP-like manner will not cause an error, but the attrs dictionary will be absent. A path is always returned, even if empty, per the spec. All values returned have been percent-decoded, except for uri and raw_query.

Parameters

url

pointer to the URI string to parse

len

length of the URI string to parse

Return Values

Returns an ec_url_details structure on success, or NULL on failure.