Marmos
v juptune
v asn1
v lang
v ast
v Classes
v Enums
v ir
v parser
v Enums
v Structs
v core
v crypto
v keyexchange
v memory
v data
v alphabet
v buffer
v json
v builder
v parser
v Enums
v Structs
v serialise
v Structs
v Templates
v pem
v Enums
v Structs

Functions uriParseNoCopy

1
2
3
4
5
6
7
module juptune.http.uri;

Result uriParseNoCopy(
    const char[] input, 
    Uri uri, 
    UriParseRules rules = UriParseRules.strict
);

Documentation

Higher level Uri parsing functions

Parses a URI from a string into a Uri, which specifically does not contain any copy of the input data, but instead slices from the original inputslice.

This means the returned Uriis only valid for as long as the inputslice is valid and unmodified.

This function is intended to be used when the caller wants to avoid copying the input data, and is willing to accept the limitations and risks of a Uri.

Please report any non-compliance with RFC 3986 as a bug.

Valid Formats

isAbsolute -> scheme://user:info@host:port/path?query#fragment, e.g. "http://user:info@localhost:8080/some/path?some=query#some-fragment"

isNetworkReference -> //user:info@host:port/path?query#fragment, e.g. "//user:info@localhost:8080/some/path?some=query#some-fragment"

!isAbsolute && !isNetworkReference && pathIsAbsolute -> /path?query#fragment, e.g. "/some/path?some=query#some-fragment"

pathIsRootless only if UriParseRules.allowUriSuffixIS NOT set. -> path?query#fragment, e.g. "some/path?some=query#some-fragment"

isUriSuffix only the host component is supported within the authority - port and user info are not supported due to their colons causing the URI to be seen as an absolute URI, which will likely generate an error. only if UriParseRules.allowUriSuffixIS set. -> host/path?query#fragment, e.g. "localhost/some/path?some=query#some-fragment"

Please see the individual, lower level parsing functions for the exact details of each component.

Notes

The output of all outparameters is undefined if the function returns an error.

This parser will attempt to heuristically determine whether the start of the URI is a scheme or an authority. Please note that errors in a scheme may manifest as an error in the authority component.

If it's not clear, you can use uri.hintsto determine the exact structure of the URI.

Params

Throws

Anything that uriParseScheme, uriParseAuthority, uriParsePath, uriParseQuery, or uriParseFragmentcan throw.

Returns

A Resultindicating whether the parsing was successful or not.