Table of Contents

Class CaseHandlingUriBuilder

Namespace
SixLabors.ImageSharp.Web
Assembly
SixLabors.ImageSharp.Web.dll

Optimized helper methods for generating encoded Uris from URI components. Much of this code has been adapted from the MIT licensed .NET runtime.

public static class CaseHandlingUriBuilder
Inheritance
CaseHandlingUriBuilder
Inherited Members

Methods

BuildAbsolute(CaseHandling, HostString, PathString, PathString, QueryString)

Combines the given URI components into a string that is properly encoded for use in HTTP headers. Note that unicode in the HostString will be encoded as punycode and the scheme is not included in the result.

public static string BuildAbsolute(CaseHandlingUriBuilder.CaseHandling handling, HostString host, PathString pathBase = default, PathString path = default, QueryString query = default)

Parameters

handling CaseHandlingUriBuilder.CaseHandling

Determines case handling for the result. query is always converted to invariant lowercase.

host HostString

The host portion of the uri normally included in the Host header. This may include the port.

pathBase PathString

The first portion of the request path associated with application root.

path PathString

The portion of the request path that identifies the requested resource.

query QueryString

The query, if any.

Returns

string

The combined URI components, properly encoded for use in HTTP headers.

BuildAbsolute(CaseHandling, string, HostString, PathString, PathString, QueryString)

Combines the given URI components into a string that is properly encoded for use in HTTP headers. Note that unicode in the HostString will be encoded as punycode.

public static string BuildAbsolute(CaseHandlingUriBuilder.CaseHandling handling, string scheme, HostString host, PathString pathBase = default, PathString path = default, QueryString query = default)

Parameters

handling CaseHandlingUriBuilder.CaseHandling

Determines case handling for the result. query is always converted to invariant lowercase.

scheme string

http, https, etc.

host HostString

The host portion of the uri normally included in the Host header. This may include the port.

pathBase PathString

The first portion of the request path associated with application root.

path PathString

The portion of the request path that identifies the requested resource.

query QueryString

The query, if any.

Returns

string

The combined URI components, properly encoded for use in HTTP headers.

BuildRelative(CaseHandling, PathString, PathString, QueryString)

Combines the given URI components into a string that is properly encoded for use in HTTP headers.

public static string BuildRelative(CaseHandlingUriBuilder.CaseHandling handling, PathString pathBase = default, PathString path = default, QueryString query = default)

Parameters

handling CaseHandlingUriBuilder.CaseHandling

Determines case handling for the result. query is always converted to invariant lowercase.

pathBase PathString

The first portion of the request path associated with application root.

path PathString

The portion of the request path that identifies the requested resource.

query QueryString

The query, if any.

Returns

string

The combined URI components, properly encoded for use in HTTP headers.

Encode(CaseHandling, string)

Generates a string from the given absolute or relative Uri that is appropriately encoded for use in HTTP headers. Note that a unicode host name will be encoded as punycode.

public static string Encode(CaseHandlingUriBuilder.CaseHandling handling, string uri)

Parameters

handling CaseHandlingUriBuilder.CaseHandling

Determines case handling for the result.

uri string

The Uri to encode.

Returns

string

The encoded string version of uri.

Encode(CaseHandling, Uri)

Generates a string from the given absolute or relative Uri that is appropriately encoded for use in HTTP headers. Note that a unicode host name will be encoded as punycode.

public static string Encode(CaseHandlingUriBuilder.CaseHandling handling, Uri uri)

Parameters

handling CaseHandlingUriBuilder.CaseHandling

Determines case handling for the result.

uri Uri

The Uri to encode.

Returns

string

The encoded string version of uri.