C# 클래스 HttpServer.HttpClientContext

Contains a connection to a browser/client.
Remember to Start after you have hooked the RequestReceived event.
상속: IHttpClientContext, IDisposable
파일 보기 프로젝트 열기: aurora-sim/Aurora-Libs 1 사용 예제들

공개 프로퍼티들

프로퍼티 타입 설명
Available bool

Private Properties

프로퍼티 타입 설명
Dispose void
OnReceive void
OnRequestCompleted void
OnRequestLine void

공개 메소드들

메소드 설명
Cleanup ( ) : void

Clean up context.

Make sure to call base.Cleanup() if you override the method.

Close ( ) : void
Disconnect ( SocketError error ) : void

Disconnect from client

Dispose ( ) : void
HttpClientContext ( bool secured, IPEndPoint remoteEndPoint, Stream stream, IRequestParserFactory parserFactory, int bufferSize, Socket sock, ILogWriter log ) : System

Initializes a new instance of the HttpClientContext 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

Start ( ) : void

Start reading content.

Make sure to call base.Start() if you override this method.

보호된 메소드들

메소드 설명
OnBodyBytesReceived ( object sender, HttpServer.Parser.BodyEventArgs e ) : void

Process incoming body bytes.

OnHeaderReceived ( object sender, HttpServer.Parser.HeaderEventArgs e ) : void

비공개 메소드들

메소드 설명
Dispose ( bool unmanaged ) : void
OnReceive ( IAsyncResult ar ) : void
OnRequestCompleted ( object source, EventArgs args ) : void
OnRequestLine ( object sender, HttpServer.Parser.RequestLineEventArgs e ) : void

메소드 상세

Cleanup() 공개 메소드

Clean up context.
Make sure to call base.Cleanup() if you override the method.
public Cleanup ( ) : void
리턴 void

Close() 공개 메소드

public Close ( ) : void
리턴 void

Disconnect() 공개 메소드

Disconnect from client
public Disconnect ( SocketError error ) : void
error SocketError error to report in the event.
리턴 void

Dispose() 공개 메소드

public Dispose ( ) : void
리턴 void

HttpClientContext() 공개 메소드

Initializes a new instance of the HttpClientContext class.
If fails Stream must be writable and readable.
public HttpClientContext ( bool secured, IPEndPoint remoteEndPoint, Stream stream, IRequestParserFactory parserFactory, int bufferSize, Socket sock, ILogWriter log ) : System
secured bool true if the connection is secured (SSL/TLS)
remoteEndPoint System.Net.IPEndPoint client that connected.
stream Stream Stream used for communication
parserFactory IRequestParserFactory Used to create a .
bufferSize int Size of buffer to use when reading data. Must be at least 4096 bytes.
sock Socket
log ILogWriter
리턴 System

OnBodyBytesReceived() 보호된 메소드

Process incoming body bytes.
protected OnBodyBytesReceived ( object sender, HttpServer.Parser.BodyEventArgs e ) : void
sender object
e HttpServer.Parser.BodyEventArgs Bytes
리턴 void

OnHeaderReceived() 보호된 메소드

protected OnHeaderReceived ( object sender, HttpServer.Parser.HeaderEventArgs e ) : void
sender object
e HttpServer.Parser.HeaderEventArgs
리턴 void

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 or
statusCode HttpServer.HttpStatusCode HTTP status code
reason string reason for the status code.
리턴 void

Respond() 공개 메소드

Send a response.
If is invalid.
public Respond ( string httpVersion, HttpServer.HttpStatusCode statusCode, string reason, string body, string contentType ) : void
httpVersion string Either or
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, i.e. '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

Start() 공개 메소드

Start reading content.
Make sure to call base.Start() if you override this method.
public Start ( ) : void
리턴 void

프로퍼티 상세

Available 공개적으로 프로퍼티

public bool Available
리턴 bool