C# Class Universe.Framework.Utilities.UntrustedHttpWebRequest

Used for requests to untrusted endpoints that may potentially be malicious
Mostra file Open project: Virtual-Universe/Virtual-Universe

Public Methods

Method Description
Create ( Uri uri ) : HttpWebRequest

Creates an HttpWebRequest that is hardened against malicious endpoints after ensuring the given Uri is safe to retrieve

Create ( Uri uri, bool allowLoopback, int readWriteTimeoutMS, int timeoutMS, int maximumRedirects ) : HttpWebRequest

Creates an HttpWebRequest that is hardened against malicious endpoints after ensuring the given Uri is safe to retrieve

GetUntrustedUrl ( Uri url ) : string
PostToUntrustedUrl ( Uri url, string data ) : string

Private Methods

Method Description
IsIPv6Loopback ( IPAddress ip ) : bool

Determines whether an IP address is the IPv6 equivalent of "localhost/127.0.0.1".

IsUriAllowable ( Uri uri, bool allowLoopback ) : bool

Determines whether a URI is allowed based on scheme and host name. No requireSSL check is done here

Method Details

Create() public static method

Creates an HttpWebRequest that is hardened against malicious endpoints after ensuring the given Uri is safe to retrieve
If uri is null If uri is unsafe
public static Create ( Uri uri ) : HttpWebRequest
uri System.Uri Web location to request
return System.Net.HttpWebRequest

Create() public static method

Creates an HttpWebRequest that is hardened against malicious endpoints after ensuring the given Uri is safe to retrieve
If uri is null If uri is unsafe
public static Create ( Uri uri, bool allowLoopback, int readWriteTimeoutMS, int timeoutMS, int maximumRedirects ) : HttpWebRequest
uri System.Uri Web location to request
allowLoopback bool True to allow connections to localhost, otherwise false
readWriteTimeoutMS int Read write timeout, in milliseconds
timeoutMS int Connection timeout, in milliseconds
maximumRedirects int Maximum number of allowed redirects
return System.Net.HttpWebRequest

GetUntrustedUrl() public static method

public static GetUntrustedUrl ( Uri url ) : string
url System.Uri
return string

PostToUntrustedUrl() public static method

public static PostToUntrustedUrl ( Uri url, string data ) : string
url System.Uri
data string
return string