C# Class HttpServer.HttpContextFactory

Used to create and reuse contexts.
Inheritance: IHttpContextFactory
显示文件 Open project: aurora-sim/Aurora-Libs Class Usage Examples

Public Methods

Method Description
CreateContext ( Socket socket ) : IHttpClientContext

Creates a IHttpClientContext that handles a connected client.

CreateSecureContext ( Socket socket, X509Certificate certificate, SslProtocols protocol ) : IHttpClientContext

Create a secure IHttpClientContext.

HttpContextFactory ( ILogWriter writer, int bufferSize, IRequestParserFactory factory ) : System

Initializes a new instance of the HttpContextFactory class.

Protected Methods

Method Description
CreateContext ( bool isSecured, IPEndPoint endPoint, Stream stream, Socket sock ) : HttpClientContext

Create a new context.

CreateNewContext ( bool isSecured, IPEndPoint endPoint, Stream stream, Socket sock ) : HttpClientContext

Create a new context.

Private Methods

Method Description
OnFreeContext ( object sender, HttpServer.DisconnectedEventArgs e ) : void
OnRequestReceived ( object sender, HttpServer.RequestEventArgs e ) : void

Method Details

CreateContext() protected method

Create a new context.
protected CreateContext ( bool isSecured, IPEndPoint endPoint, Stream stream, Socket sock ) : HttpClientContext
isSecured bool true if socket is running HTTPS.
endPoint System.Net.IPEndPoint Client that connected
stream Stream Network/SSL stream.
sock Socket
return HttpClientContext

CreateContext() public method

Creates a IHttpClientContext that handles a connected client.
public CreateContext ( Socket socket ) : IHttpClientContext
socket Socket Client socket (accepted by the ).
return IHttpClientContext

CreateNewContext() protected method

Create a new context.
protected CreateNewContext ( bool isSecured, IPEndPoint endPoint, Stream stream, Socket sock ) : HttpClientContext
isSecured bool true if HTTPS is used.
endPoint System.Net.IPEndPoint Remote client
stream Stream Network stream, uses .
sock Socket
return HttpClientContext

CreateSecureContext() public method

Create a secure IHttpClientContext.
public CreateSecureContext ( Socket socket, X509Certificate certificate, SslProtocols protocol ) : IHttpClientContext
socket Socket Client socket (accepted by the ).
certificate System.Security.Cryptography.X509Certificates.X509Certificate HTTPS certificate to use.
protocol SslProtocols Kind of HTTPS protocol. Usually TLS or SSL.
return IHttpClientContext

HttpContextFactory() public method

Initializes a new instance of the HttpContextFactory class.
public HttpContextFactory ( ILogWriter writer, int bufferSize, IRequestParserFactory factory ) : System
writer ILogWriter The writer.
bufferSize int Amount of bytes to read from the incoming socket stream.
factory IRequestParserFactory Used to create a request parser.
return System