ocaml-opentelemetry/uri/Uri/index.html
2025-01-31 01:39:34 +00:00

33 lines
31 KiB
HTML
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml"><head><title>Uri (uri.Uri)</title><meta charset="utf-8"/><link rel="stylesheet" href="../../_odoc-theme/odoc.css"/><meta name="generator" content="odoc 2.4.4"/><meta name="viewport" content="width=device-width,initial-scale=1.0"/><script src="../../highlight.pack.js"></script><script>hljs.initHighlightingOnLoad();</script></head><body class="odoc"><nav class="odoc-nav"><a href="../index.html">Up</a> <a href="../index.html">uri</a> &#x00BB; Uri</nav><header class="odoc-preamble"><h1>Module <code><span>Uri</span></code></h1><p>Uniform Resource Identifier handling that is RFC3986-compliant.</p></header><nav class="odoc-toc"><ul><li><a href="#core-functionality">Core functionality</a></li><li><a href="#query-functions">Query functions</a></li><li><a href="#component-getters-and-setters">Component getters and setters</a></li><li><a href="#formatters">Formatters</a></li></ul></nav><div class="odoc-content"><div class="odoc-spec"><div class="spec type anchored" id="type-t"><a href="#type-t" class="anchor"></a><code><span><span class="keyword">type</span> t</span></code></div><div class="spec-doc"><p>A single URI that is a compact sequence of characters that identifies an abstract or physical resource.</p></div></div><div class="odoc-spec"><div class="spec type anchored" id="type-component"><a href="#type-component" class="anchor"></a><code><span><span class="keyword">type</span> component</span><span> = </span><span>[ </span></code><ol><li id="type-component.Scheme" class="def variant constructor anchored"><a href="#type-component.Scheme" class="anchor"></a><code><span>| </span><span>`Scheme</span></code></li><li id="type-component.Authority" class="def variant constructor anchored"><a href="#type-component.Authority" class="anchor"></a><code><span>| </span><span>`Authority</span></code></li><li id="type-component.Userinfo" class="def variant constructor anchored"><a href="#type-component.Userinfo" class="anchor"></a><code><span>| </span><span>`Userinfo</span></code><div class="def-doc"><span class="comment-delim">(*</span><p>subcomponent of authority in some schemes</p><span class="comment-delim">*)</span></div></li><li id="type-component.Host" class="def variant constructor anchored"><a href="#type-component.Host" class="anchor"></a><code><span>| </span><span>`Host</span></code><div class="def-doc"><span class="comment-delim">(*</span><p>subcomponent of authority in some schemes</p><span class="comment-delim">*)</span></div></li><li id="type-component.Path" class="def variant constructor anchored"><a href="#type-component.Path" class="anchor"></a><code><span>| </span><span>`Path</span></code></li><li id="type-component.Query" class="def variant constructor anchored"><a href="#type-component.Query" class="anchor"></a><code><span>| </span><span>`Query</span></code></li><li id="type-component.Query_key" class="def variant constructor anchored"><a href="#type-component.Query_key" class="anchor"></a><code><span>| </span><span>`Query_key</span></code></li><li id="type-component.Query_value" class="def variant constructor anchored"><a href="#type-component.Query_value" class="anchor"></a><code><span>| </span><span>`Query_value</span></code></li><li id="type-component.Fragment" class="def variant constructor anchored"><a href="#type-component.Fragment" class="anchor"></a><code><span>| </span><span>`Fragment</span></code></li><li id="type-component.Generic" class="def variant constructor anchored"><a href="#type-component.Generic" class="anchor"></a><code><span>| </span><span>`Generic</span></code></li><li id="type-component.Custom" class="def variant constructor anchored"><a href="#type-component.Custom" class="anchor"></a><code><span>| </span><span>`Custom <span class="keyword">of</span> <a href="#type-component">component</a> * string * string</span></code></li></ol><code><span> ]</span></code></div></div><div class="odoc-spec"><div class="spec type anchored" id="type-pct_encoder"><a href="#type-pct_encoder" class="anchor"></a><code><span><span class="keyword">type</span> pct_encoder</span></code></div><div class="spec-doc"><p>For pct encoding customization when converting a URI to a string.</p></div></div><h3 id="core-functionality"><a href="#core-functionality" class="anchor"></a>Core functionality</h3><div class="odoc-spec"><div class="spec value anchored" id="val-empty"><a href="#val-empty" class="anchor"></a><code><span><span class="keyword">val</span> empty : <a href="#type-t">t</a></span></code></div><div class="spec-doc"><p>The empty (zero length) URI reference. Useful for constructing URIs piece-by-piece.</p></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-compare"><a href="#val-compare" class="anchor"></a><code><span><span class="keyword">val</span> compare : <span><a href="#type-t">t</a> <span class="arrow">&#45;&gt;</span></span> <span><a href="#type-t">t</a> <span class="arrow">&#45;&gt;</span></span> int</span></code></div><div class="spec-doc"><p>Comparator ordering by host, scheme, port, userinfo, path, query, and finally fragment. Designed to produce a reasonable sort order.</p></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-equal"><a href="#val-equal" class="anchor"></a><code><span><span class="keyword">val</span> equal : <span><a href="#type-t">t</a> <span class="arrow">&#45;&gt;</span></span> <span><a href="#type-t">t</a> <span class="arrow">&#45;&gt;</span></span> bool</span></code></div><div class="spec-doc"><p><code>equal a b</code> is <code>compare a b = 0</code>.</p></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-pct_encode"><a href="#val-pct_encode" class="anchor"></a><code><span><span class="keyword">val</span> pct_encode : <span><span class="optlabel">?scheme</span>:string <span class="arrow">&#45;&gt;</span></span> <span><span class="optlabel">?component</span>:<a href="#type-component">component</a> <span class="arrow">&#45;&gt;</span></span> <span>string <span class="arrow">&#45;&gt;</span></span> string</span></code></div><div class="spec-doc"><p>Percent-encode a string. The <code>component</code> argument defaults to `Path</p></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-pct_encoder"><a href="#val-pct_encoder" class="anchor"></a><code><span><span class="keyword">val</span> pct_encoder :
<span><span class="optlabel">?scheme</span>:<a href="#type-component">component</a> <span class="arrow">&#45;&gt;</span></span>
<span><span class="optlabel">?userinfo</span>:<a href="#type-component">component</a> <span class="arrow">&#45;&gt;</span></span>
<span><span class="optlabel">?host</span>:<a href="#type-component">component</a> <span class="arrow">&#45;&gt;</span></span>
<span><span class="optlabel">?path</span>:<a href="#type-component">component</a> <span class="arrow">&#45;&gt;</span></span>
<span><span class="optlabel">?query_key</span>:<a href="#type-component">component</a> <span class="arrow">&#45;&gt;</span></span>
<span><span class="optlabel">?query_value</span>:<a href="#type-component">component</a> <span class="arrow">&#45;&gt;</span></span>
<span><span class="optlabel">?fragment</span>:<a href="#type-component">component</a> <span class="arrow">&#45;&gt;</span></span>
<span>unit <span class="arrow">&#45;&gt;</span></span>
<a href="#type-pct_encoder">pct_encoder</a></span></code></div><div class="spec-doc"><p>Construct a pct_encoder.</p></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-pct_decode"><a href="#val-pct_decode" class="anchor"></a><code><span><span class="keyword">val</span> pct_decode : <span>string <span class="arrow">&#45;&gt;</span></span> string</span></code></div><div class="spec-doc"><p>Percent-decode a percent-encoded string</p></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-of_string"><a href="#val-of_string" class="anchor"></a><code><span><span class="keyword">val</span> of_string : <span>string <span class="arrow">&#45;&gt;</span></span> <a href="#type-t">t</a></span></code></div><div class="spec-doc"><p>Parse a URI string literal into a URI structure. A bare string will be interpreted as a path; a string prefixed with `//` will be interpreted as a host.</p></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-to_string"><a href="#val-to_string" class="anchor"></a><code><span><span class="keyword">val</span> to_string : <span><span class="optlabel">?pct_encoder</span>:<a href="#type-pct_encoder">pct_encoder</a> <span class="arrow">&#45;&gt;</span></span> <span><a href="#type-t">t</a> <span class="arrow">&#45;&gt;</span></span> string</span></code></div><div class="spec-doc"><p>Convert a URI structure into a percent-encoded URI string</p></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-resolve"><a href="#val-resolve" class="anchor"></a><code><span><span class="keyword">val</span> resolve : <span>string <span class="arrow">&#45;&gt;</span></span> <span><a href="#type-t">t</a> <span class="arrow">&#45;&gt;</span></span> <span><a href="#type-t">t</a> <span class="arrow">&#45;&gt;</span></span> <a href="#type-t">t</a></span></code></div><div class="spec-doc"><p>Resolve a URI against a default scheme and base URI</p></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-canonicalize"><a href="#val-canonicalize" class="anchor"></a><code><span><span class="keyword">val</span> canonicalize : <span><a href="#type-t">t</a> <span class="arrow">&#45;&gt;</span></span> <a href="#type-t">t</a></span></code></div><div class="spec-doc"><p>Canonicalize a URI according to Sec 6.2.3 &quot;Scheme-Based Normalization&quot;. This transform is more aggressive than the standard URI-generic normalization automatically done. In particular, HTTP(S) URIs with empty path components will have their path components set to &quot;/&quot;. Some applications like web servers may rely on the distinction between a path-less and a root-path URI to distinguish request URIs (e.g. OPTIONS * vs OPTIONS /).</p><ul class="at-tags"><li class="see"><span class="at-tag">see</span> <a href="https://tools.ietf.org/html/rfc3986#section-6.2.3" class="value">https://tools.ietf.org/html/rfc3986#section-6.2.3</a> <p>RFC 3986.6.2.3</p></li></ul></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-make"><a href="#val-make" class="anchor"></a><code><span><span class="keyword">val</span> make :
<span><span class="optlabel">?scheme</span>:string <span class="arrow">&#45;&gt;</span></span>
<span><span class="optlabel">?userinfo</span>:string <span class="arrow">&#45;&gt;</span></span>
<span><span class="optlabel">?host</span>:string <span class="arrow">&#45;&gt;</span></span>
<span><span class="optlabel">?port</span>:int <span class="arrow">&#45;&gt;</span></span>
<span><span class="optlabel">?path</span>:string <span class="arrow">&#45;&gt;</span></span>
<span><span class="optlabel">?query</span>:<span><span>(string * <span>string list</span>)</span> list</span> <span class="arrow">&#45;&gt;</span></span>
<span><span class="optlabel">?fragment</span>:string <span class="arrow">&#45;&gt;</span></span>
<span>unit <span class="arrow">&#45;&gt;</span></span>
<a href="#type-t">t</a></span></code></div><div class="spec-doc"><p>Make a URI from supplied components. If userinfo or port are supplied without host, an empty host is added. If path is supplied and userinfo, host, or port is also supplied, path is made absolute but not resolved.</p></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-with_uri"><a href="#val-with_uri" class="anchor"></a><code><span><span class="keyword">val</span> with_uri :
<span><span class="optlabel">?scheme</span>:<span>string option</span> <span class="arrow">&#45;&gt;</span></span>
<span><span class="optlabel">?userinfo</span>:<span>string option</span> <span class="arrow">&#45;&gt;</span></span>
<span><span class="optlabel">?host</span>:<span>string option</span> <span class="arrow">&#45;&gt;</span></span>
<span><span class="optlabel">?port</span>:<span>int option</span> <span class="arrow">&#45;&gt;</span></span>
<span><span class="optlabel">?path</span>:<span>string option</span> <span class="arrow">&#45;&gt;</span></span>
<span><span class="optlabel">?query</span>:<span><span><span>(string * <span>string list</span>)</span> list</span> option</span> <span class="arrow">&#45;&gt;</span></span>
<span><span class="optlabel">?fragment</span>:<span>string option</span> <span class="arrow">&#45;&gt;</span></span>
<span><a href="#type-t">t</a> <span class="arrow">&#45;&gt;</span></span>
<a href="#type-t">t</a></span></code></div><div class="spec-doc"><p>Functional update for a URI using the supplied components. If a component is unspecified then it will be unchanged. If a component is supplied as <code>None</code> then the component will be removed in the returned URI. If a component is supplied as <code>Some x</code> then <code>x</code> will be added if it does not exist in the source URI or replaced if it does exist.</p></div></div><h3 id="query-functions"><a href="#query-functions" class="anchor"></a>Query functions</h3><p>The query string API attempts to accommodate conventional query string representations (i.e. <code>?key0=value0&amp;key1=value1</code>) while maximally exposing any meaning in those representations. For example, it is not necessarily the case that <code>/</code> and <code>/?</code> are equivalent to a web server. In the former case, we observe a zero query string whereas in the latter case, we observe a query string with a single key, <code>&quot;&quot;</code> and a zero value. Compare this with <code>/?=</code> which has a single key and a single empty value, <code>&quot;&quot;</code>. Additionally, some query functions return lists of values for a key. These list values are extracted from a <b>single</b> key with a comma-separated value list. If a query string has multiple identical keys, you must use <a href="#val-query"><code>query</code></a> to retrieve the entirety of the structured query string.</p><div class="odoc-spec"><div class="spec value anchored" id="val-query"><a href="#val-query" class="anchor"></a><code><span><span class="keyword">val</span> query : <span><a href="#type-t">t</a> <span class="arrow">&#45;&gt;</span></span> <span><span>(string * <span>string list</span>)</span> list</span></span></code></div><div class="spec-doc"><p>Get a query string from a URI</p></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-verbatim_query"><a href="#val-verbatim_query" class="anchor"></a><code><span><span class="keyword">val</span> verbatim_query : <span><span class="optlabel">?pct_encoder</span>:<a href="#type-pct_encoder">pct_encoder</a> <span class="arrow">&#45;&gt;</span></span> <span><a href="#type-t">t</a> <span class="arrow">&#45;&gt;</span></span> <span>string option</span></span></code></div><div class="spec-doc"><p>Get a verbatim query string from a URI. If the provenance of the URI is a string and its query component has not been updated, this is the literal query string as parsed. Otherwise, this is the composition of <a href="#val-query"><code>query</code></a> and <a href="#val-encoded_of_query"><code>encoded_of_query</code></a></p></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-encoded_of_query"><a href="#val-encoded_of_query" class="anchor"></a><code><span><span class="keyword">val</span> encoded_of_query :
<span><span class="optlabel">?scheme</span>:string <span class="arrow">&#45;&gt;</span></span>
<span><span class="optlabel">?pct_encoder</span>:<a href="#type-pct_encoder">pct_encoder</a> <span class="arrow">&#45;&gt;</span></span>
<span><span><span>(string * <span>string list</span>)</span> list</span> <span class="arrow">&#45;&gt;</span></span>
string</span></code></div><div class="spec-doc"><p>Make a percent-encoded query string from percent-decoded query tuple</p></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-query_of_encoded"><a href="#val-query_of_encoded" class="anchor"></a><code><span><span class="keyword">val</span> query_of_encoded : <span>string <span class="arrow">&#45;&gt;</span></span> <span><span>(string * <span>string list</span>)</span> list</span></span></code></div><div class="spec-doc"><p>Parse a percent-encoded query string into a percent-decoded query tuple</p></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-with_query"><a href="#val-with_query" class="anchor"></a><code><span><span class="keyword">val</span> with_query : <span><a href="#type-t">t</a> <span class="arrow">&#45;&gt;</span></span> <span><span><span>(string * <span>string list</span>)</span> list</span> <span class="arrow">&#45;&gt;</span></span> <a href="#type-t">t</a></span></code></div><div class="spec-doc"><p>Replace the query URI with the supplied list. Input URI is not modified</p></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-with_query'"><a href="#val-with_query'" class="anchor"></a><code><span><span class="keyword">val</span> with_query' : <span><a href="#type-t">t</a> <span class="arrow">&#45;&gt;</span></span> <span><span><span>(string * string)</span> list</span> <span class="arrow">&#45;&gt;</span></span> <a href="#type-t">t</a></span></code></div><div class="spec-doc"><p>Replace the query URI with the supplied singleton query list. Input URI is not modified</p></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-get_query_param'"><a href="#val-get_query_param'" class="anchor"></a><code><span><span class="keyword">val</span> get_query_param' : <span><a href="#type-t">t</a> <span class="arrow">&#45;&gt;</span></span> <span>string <span class="arrow">&#45;&gt;</span></span> <span><span>string list</span> option</span></span></code></div><div class="spec-doc"><p><code>get_query_param' q key</code> returns the list of values for the <code>key</code> parameter in query <code>q</code>. Note that an empty list is not the same as a <code>None</code> return value. For a query <code>foo</code>, the mapping is:</p><ul><li><code>/</code> returns None</li><li><code>/?foo</code> returns Some </li><li><code>/?foo=</code> returns <code>Some [&quot;&quot;]</code></li><li><code>/?foo=bar</code> returns <code>Some [&quot;bar&quot;]</code></li><li><code>/?foo=bar,chi</code> returns <code>Some [&quot;bar&quot;,&quot;chi&quot;]</code></li></ul><p>Query keys can be duplicated in the URI, in which case the first one is returned. If you want to resolve duplicate keys, obtain the full result set with <a href="#val-query"><code>query</code></a> instead.</p></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-get_query_param"><a href="#val-get_query_param" class="anchor"></a><code><span><span class="keyword">val</span> get_query_param : <span><a href="#type-t">t</a> <span class="arrow">&#45;&gt;</span></span> <span>string <span class="arrow">&#45;&gt;</span></span> <span>string option</span></span></code></div><div class="spec-doc"><p><code>get_query_param q key</code> returns the value found for a <code>key</code> in query <code>q</code>. If there are multiple values for the key, then the first one is returned.</p></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-add_query_param"><a href="#val-add_query_param" class="anchor"></a><code><span><span class="keyword">val</span> add_query_param : <span><a href="#type-t">t</a> <span class="arrow">&#45;&gt;</span></span> <span><span>(string * <span>string list</span>)</span> <span class="arrow">&#45;&gt;</span></span> <a href="#type-t">t</a></span></code></div><div class="spec-doc"><p>Add a query parameter to the input query URI. Input URI is not modified</p></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-add_query_param'"><a href="#val-add_query_param'" class="anchor"></a><code><span><span class="keyword">val</span> add_query_param' : <span><a href="#type-t">t</a> <span class="arrow">&#45;&gt;</span></span> <span><span>(string * string)</span> <span class="arrow">&#45;&gt;</span></span> <a href="#type-t">t</a></span></code></div><div class="spec-doc"><p>Add a query parameter to the input singleton query URI. Input URI is not modified</p></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-add_query_params"><a href="#val-add_query_params" class="anchor"></a><code><span><span class="keyword">val</span> add_query_params : <span><a href="#type-t">t</a> <span class="arrow">&#45;&gt;</span></span> <span><span><span>(string * <span>string list</span>)</span> list</span> <span class="arrow">&#45;&gt;</span></span> <a href="#type-t">t</a></span></code></div><div class="spec-doc"><p>Add a query parameter list to the input query URI. Input URI is not modified</p></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-add_query_params'"><a href="#val-add_query_params'" class="anchor"></a><code><span><span class="keyword">val</span> add_query_params' : <span><a href="#type-t">t</a> <span class="arrow">&#45;&gt;</span></span> <span><span><span>(string * string)</span> list</span> <span class="arrow">&#45;&gt;</span></span> <a href="#type-t">t</a></span></code></div><div class="spec-doc"><p>Add a query singleton parameter list to the input query URI. Input URI is not modified</p></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-remove_query_param"><a href="#val-remove_query_param" class="anchor"></a><code><span><span class="keyword">val</span> remove_query_param : <span><a href="#type-t">t</a> <span class="arrow">&#45;&gt;</span></span> <span>string <span class="arrow">&#45;&gt;</span></span> <a href="#type-t">t</a></span></code></div><div class="spec-doc"><p>Remove a query key from the input query URI. Input URI is not modified, and no error is generated if the key does not already exist in the URI.</p></div></div><h3 id="component-getters-and-setters"><a href="#component-getters-and-setters" class="anchor"></a>Component getters and setters</h3><div class="odoc-spec"><div class="spec value anchored" id="val-path"><a href="#val-path" class="anchor"></a><code><span><span class="keyword">val</span> path : <span><span class="optlabel">?pct_encoder</span>:<a href="#type-pct_encoder">pct_encoder</a> <span class="arrow">&#45;&gt;</span></span> <span><a href="#type-t">t</a> <span class="arrow">&#45;&gt;</span></span> string</span></code></div><div class="spec-doc"><p>Get the encoded path component of a URI</p></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-path_and_query"><a href="#val-path_and_query" class="anchor"></a><code><span><span class="keyword">val</span> path_and_query : <span><a href="#type-t">t</a> <span class="arrow">&#45;&gt;</span></span> string</span></code></div><div class="spec-doc"><p>Get the encoded path and query components of a URI</p></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-with_path"><a href="#val-with_path" class="anchor"></a><code><span><span class="keyword">val</span> with_path : <span><a href="#type-t">t</a> <span class="arrow">&#45;&gt;</span></span> <span>string <span class="arrow">&#45;&gt;</span></span> <a href="#type-t">t</a></span></code></div><div class="spec-doc"><p>Replace the path URI with the supplied encoded path. If a host is present in the supplied URI, the path is made absolute but not resolved. If the path is empty, the path component is removed. Input URI is not modified</p></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-scheme"><a href="#val-scheme" class="anchor"></a><code><span><span class="keyword">val</span> scheme : <span><a href="#type-t">t</a> <span class="arrow">&#45;&gt;</span></span> <span>string option</span></span></code></div><div class="spec-doc"><p>Get the scheme component of a URI</p></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-with_scheme"><a href="#val-with_scheme" class="anchor"></a><code><span><span class="keyword">val</span> with_scheme : <span><a href="#type-t">t</a> <span class="arrow">&#45;&gt;</span></span> <span><span>string option</span> <span class="arrow">&#45;&gt;</span></span> <a href="#type-t">t</a></span></code></div><div class="spec-doc"><p>Replace the scheme portion of the URI with the supplied <code>scheme</code>. Input URI is not modified</p></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-userinfo"><a href="#val-userinfo" class="anchor"></a><code><span><span class="keyword">val</span> userinfo : <span><span class="optlabel">?pct_encoder</span>:<a href="#type-pct_encoder">pct_encoder</a> <span class="arrow">&#45;&gt;</span></span> <span><a href="#type-t">t</a> <span class="arrow">&#45;&gt;</span></span> <span>string option</span></span></code></div><div class="spec-doc"><p>Get the userinfo component of a URI</p></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-with_userinfo"><a href="#val-with_userinfo" class="anchor"></a><code><span><span class="keyword">val</span> with_userinfo : <span><a href="#type-t">t</a> <span class="arrow">&#45;&gt;</span></span> <span><span>string option</span> <span class="arrow">&#45;&gt;</span></span> <a href="#type-t">t</a></span></code></div><div class="spec-doc"><p>Replace the userinfo portion of the URI with the supplied <code>string option</code>. If no host is present in the supplied URI, an empty host is added. Input URI is not modified.</p></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-user"><a href="#val-user" class="anchor"></a><code><span><span class="keyword">val</span> user : <span><a href="#type-t">t</a> <span class="arrow">&#45;&gt;</span></span> <span>string option</span></span></code></div><div class="spec-doc"><p>Get the username component of a URI</p></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-password"><a href="#val-password" class="anchor"></a><code><span><span class="keyword">val</span> password : <span><a href="#type-t">t</a> <span class="arrow">&#45;&gt;</span></span> <span>string option</span></span></code></div><div class="spec-doc"><p>Get the password component of a URI</p></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-with_password"><a href="#val-with_password" class="anchor"></a><code><span><span class="keyword">val</span> with_password : <span><a href="#type-t">t</a> <span class="arrow">&#45;&gt;</span></span> <span><span>string option</span> <span class="arrow">&#45;&gt;</span></span> <a href="#type-t">t</a></span></code></div><div class="spec-doc"><p>Replace the password portion of the URI with the supplied <code>string option</code>. If no host is present in the supplied URI, an empty host is added. Input URI is not modified.</p></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-host"><a href="#val-host" class="anchor"></a><code><span><span class="keyword">val</span> host : <span><a href="#type-t">t</a> <span class="arrow">&#45;&gt;</span></span> <span>string option</span></span></code></div><div class="spec-doc"><p>Get the host component of a URI</p></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-with_host"><a href="#val-with_host" class="anchor"></a><code><span><span class="keyword">val</span> with_host : <span><a href="#type-t">t</a> <span class="arrow">&#45;&gt;</span></span> <span><span>string option</span> <span class="arrow">&#45;&gt;</span></span> <a href="#type-t">t</a></span></code></div><div class="spec-doc"><p>Replace the host component of the URI. Input URI is not modified.</p></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-host_with_default"><a href="#val-host_with_default" class="anchor"></a><code><span><span class="keyword">val</span> host_with_default : <span><span class="optlabel">?default</span>:string <span class="arrow">&#45;&gt;</span></span> <span><a href="#type-t">t</a> <span class="arrow">&#45;&gt;</span></span> string</span></code></div><div class="spec-doc"><p>Get the host component of a URI, with a default supplied if one is not present</p></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-port"><a href="#val-port" class="anchor"></a><code><span><span class="keyword">val</span> port : <span><a href="#type-t">t</a> <span class="arrow">&#45;&gt;</span></span> <span>int option</span></span></code></div><div class="spec-doc"><p>Get the port component of a URI</p></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-with_port"><a href="#val-with_port" class="anchor"></a><code><span><span class="keyword">val</span> with_port : <span><a href="#type-t">t</a> <span class="arrow">&#45;&gt;</span></span> <span><span>int option</span> <span class="arrow">&#45;&gt;</span></span> <a href="#type-t">t</a></span></code></div><div class="spec-doc"><p>Replace the port component of the URI with the supplied port. If no host is present in the supplied URI, an empty host is added. Input URI is not modified.</p></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-fragment"><a href="#val-fragment" class="anchor"></a><code><span><span class="keyword">val</span> fragment : <span><a href="#type-t">t</a> <span class="arrow">&#45;&gt;</span></span> <span>string option</span></span></code></div><div class="spec-doc"><p>Get the fragment component of a URI</p></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-with_fragment"><a href="#val-with_fragment" class="anchor"></a><code><span><span class="keyword">val</span> with_fragment : <span><a href="#type-t">t</a> <span class="arrow">&#45;&gt;</span></span> <span><span>string option</span> <span class="arrow">&#45;&gt;</span></span> <a href="#type-t">t</a></span></code></div><div class="spec-doc"><p>Replace the fragment component of a URI with the supplied fragment. Input URI is not modified</p></div></div><h3 id="formatters"><a href="#formatters" class="anchor"></a>Formatters</h3><div class="odoc-spec"><div class="spec value anchored" id="val-pp"><a href="#val-pp" class="anchor"></a><code><span><span class="keyword">val</span> pp : <span><a href="../../ocaml/Stdlib/Format/index.html#type-formatter">Stdlib.Format.formatter</a> <span class="arrow">&#45;&gt;</span></span> <span><a href="#type-t">t</a> <span class="arrow">&#45;&gt;</span></span> unit</span></code></div><div class="spec-doc"><p><code>pp ppf t</code> will output a human readable version of the Uri <code>t</code> to the formatter <code>ppf</code></p></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-pp_hum"><a href="#val-pp_hum" class="anchor"></a><code><span><span class="keyword">val</span> pp_hum : <span><a href="../../ocaml/Stdlib/Format/index.html#type-formatter">Stdlib.Format.formatter</a> <span class="arrow">&#45;&gt;</span></span> <span><a href="#type-t">t</a> <span class="arrow">&#45;&gt;</span></span> unit</span></code></div><div class="spec-doc"><p><code>pp_hum</code> is now an alias for the <a href="#val-pp"><code>pp</code></a> function.</p></div></div><div class="odoc-spec"><div class="spec module anchored" id="module-Parser"><a href="#module-Parser" class="anchor"></a><code><span><span class="keyword">module</span> <a href="Parser/index.html">Parser</a></span><span> : <span class="keyword">sig</span> ... <span class="keyword">end</span></span></code></div></div><div class="odoc-spec"><div class="spec module anchored" id="module-Absolute_http"><a href="#module-Absolute_http" class="anchor"></a><code><span><span class="keyword">module</span> <a href="Absolute_http/index.html">Absolute_http</a></span><span> : <span class="keyword">sig</span> ... <span class="keyword">end</span></span></code></div><div class="spec-doc"><p>Specializations for HTTP and HTTPS schemes as per RFC9110</p></div></div></div></body></html>