C# Класс HttpServer.HttpClientContextImp

Contains a connection to a browser/client.
Наследование: IHttpClientContext
Показать файл Открыть проект

Открытые методы

Метод Описание
Disconnect ( SocketError error ) : void

Disconnect from client

HttpClientContextImp ( bool secured, IPEndPoint remoteEndPoint, RequestReceivedHandler requestHandler, ClientDisconnectedHandler disconnectHandler, Stream stream, ILogWriter writer ) : System

Initializes a new instance of the HttpClientContextImp class.

HttpClientContextImp ( bool secured, IPEndPoint remoteEndPoint, Stream stream, RequestReceivedHandler requestHandler ) : System

Initializes a new instance of the HttpClientContextImp class.

Respond ( string body ) : void

Send a response.

Respond ( string httpVersion, HttpServer.HttpStatusCode statusCode, string reason ) : void

Send a response.

Respond ( string httpVersion, HttpServer.HttpStatusCode statusCode, string reason, string body, string contentType ) : void

Send a response.

Send ( byte buffer ) : void

send a whole buffer

Send ( byte buffer, int offset, int size ) : void

Send data using the stream

Защищенные методы

Метод Описание
Check100Continue ( ) : void

This method checks the request if a responde to 100-continue should be sent.

100 continue is a value in the Expect header. It's used to let the webserver determine if a request can be handled. The client waits for a reply before sending the body.

Приватные методы

Метод Описание
OnReceive ( IAsyncResult ar ) : void
OnRequestCompleted ( IHttpRequest request ) : void

Описание методов

Check100Continue() защищенный Метод

This method checks the request if a responde to 100-continue should be sent.
100 continue is a value in the Expect header. It's used to let the webserver determine if a request can be handled. The client waits for a reply before sending the body.
protected Check100Continue ( ) : void
Результат void

Disconnect() публичный Метод

Disconnect from client
public Disconnect ( SocketError error ) : void
error SocketError error to report in the delegate.
Результат void

HttpClientContextImp() публичный Метод

Initializes a new instance of the HttpClientContextImp class.
If beginreceive fails
public HttpClientContextImp ( bool secured, IPEndPoint remoteEndPoint, RequestReceivedHandler requestHandler, ClientDisconnectedHandler disconnectHandler, Stream stream, ILogWriter writer ) : System
secured bool true if the connection is secured (SSL/TLS)
remoteEndPoint System.Net.IPEndPoint client that connected.
requestHandler RequestReceivedHandler delegate handling incoming requests.
disconnectHandler ClientDisconnectedHandler delegate being called when a client disconnectes
stream Stream Stream used for communication
writer ILogWriter delegate used to write log entries
Результат System

HttpClientContextImp() публичный Метод

Initializes a new instance of the HttpClientContextImp class.
If beginreceive fails
public HttpClientContextImp ( bool secured, IPEndPoint remoteEndPoint, Stream stream, RequestReceivedHandler requestHandler ) : System
secured bool true if the connection is secured (SSL/TLS)
remoteEndPoint System.Net.IPEndPoint client that connected
stream Stream Stream used for communication
requestHandler RequestReceivedHandler delegate handling incoming requests.
Результат System

Respond() публичный Метод

Send a response.
public Respond ( string body ) : void
body string
Результат void

Respond() публичный Метод

Send a response.
public Respond ( string httpVersion, HttpServer.HttpStatusCode statusCode, string reason ) : void
httpVersion string Either HttpHelper.HTTP10 or HttpHelper.HTTP11
statusCode HttpServer.HttpStatusCode http status code
reason string reason for the status code.
Результат void

Respond() публичный Метод

Send a response.
If httpVersion is invalid.
public Respond ( string httpVersion, HttpServer.HttpStatusCode statusCode, string reason, string body, string contentType ) : void
httpVersion string Either HttpHelper.HTTP10 or HttpHelper.HTTP11
statusCode HttpServer.HttpStatusCode http status code
reason string reason for the status code.
body string html body contents, can be null or empty.
contentType string A content type to return the body as, ie 'text/html' or 'text/plain', defaults to 'text/html' if null or empty
Результат void

Send() публичный Метод

send a whole buffer
public Send ( byte buffer ) : void
buffer byte buffer to send
Результат void

Send() публичный Метод

Send data using the stream
public Send ( byte buffer, int offset, int size ) : void
buffer byte Contains data to send
offset int Start position in buffer
size int number of bytes to send
Результат void