C# 클래스 HTTP.HttpProcessor

Implements a Handler for each HTTP Client Request
파일 보기 프로젝트 열기: bietiekay/hacs 1 사용 예제들

공개 프로퍼티들

프로퍼티 타입 설명
ns NetworkStream

공개 메소드들

메소드 설명
HttpProcessor ( Socket s, String HTTP_DocumentRoot, sones.storage.TinyOnDiskStorage Storage, sones.storage.TinyOnDiskStorage LatitudeStorage, hacs.xs1.configuration.XS1Configuration _XS1_Configuration, hacs.ConsoleOutputLogger Logger, MAXMonitoringThread ELVMAXMonitoring, bool AuthEnabled, String Uname, String Pword, String StartAddrFilter ) : System

Each HTTP processor object handles one client. If Keep-Alive is enabled then this object will be reused for subsequent requests until the client breaks keep-alive. This usually happens when it times out. Because this could easily lead to a DoS attack, we keep track of the number of open processors and only allow 100 to be persistent active at any one time. Additionally, we do not allow more than 500 outstanding requests.

getFileExtension ( string filename ) : string

extracts the file extension from a filename

parseRequest ( ) : bool

parses the Request and determines if it's actually a valid one or not

process ( ) : void

This is the main method of each thread of HTTP processing. We pass this method to the thread constructor when starting a new connection.

readHeaders ( ) : bool

Reads the headers of the request and determines if they are valid or not

writeError ( int status, string message ) : void
writeFailure ( ) : void
writeForbidden ( ) : void
writeNotAuthorized ( String realm ) : void
writeResult ( int status, string message, long length ) : void
writeResult ( int status, string message, long length, string mimetype ) : void
writeSuccess ( long length ) : void
writeSuccess ( long length, string mimetype ) : void
writeURL ( ) : void

We need to make sure that the url that we are trying to treat as a file lies below the document root of the http server so that people can't grab random files off your computer while this is running.

비공개 메소드들

메소드 설명
ForwardToIndexHTML ( String Message ) : String
ForwardToLastPage ( String Message ) : String
ForwardToPage ( String Message, String URL ) : String

메소드 상세

HttpProcessor() 공개 메소드

Each HTTP processor object handles one client. If Keep-Alive is enabled then this object will be reused for subsequent requests until the client breaks keep-alive. This usually happens when it times out. Because this could easily lead to a DoS attack, we keep track of the number of open processors and only allow 100 to be persistent active at any one time. Additionally, we do not allow more than 500 outstanding requests.
public HttpProcessor ( Socket s, String HTTP_DocumentRoot, sones.storage.TinyOnDiskStorage Storage, sones.storage.TinyOnDiskStorage LatitudeStorage, hacs.xs1.configuration.XS1Configuration _XS1_Configuration, hacs.ConsoleOutputLogger Logger, MAXMonitoringThread ELVMAXMonitoring, bool AuthEnabled, String Uname, String Pword, String StartAddrFilter ) : System
s Socket the Socket to work with
HTTP_DocumentRoot String
Storage sones.storage.TinyOnDiskStorage
LatitudeStorage sones.storage.TinyOnDiskStorage
_XS1_Configuration hacs.xs1.configuration.XS1Configuration
Logger hacs.ConsoleOutputLogger
ELVMAXMonitoring hacs.MAXMonitoringThread
AuthEnabled bool
Uname String
Pword String
StartAddrFilter String
리턴 System

getFileExtension() 공개 메소드

extracts the file extension from a filename
public getFileExtension ( string filename ) : string
filename string the complete filename or path+filename
리턴 string

parseRequest() 공개 메소드

parses the Request and determines if it's actually a valid one or not
public parseRequest ( ) : bool
리턴 bool

process() 공개 메소드

This is the main method of each thread of HTTP processing. We pass this method to the thread constructor when starting a new connection.
public process ( ) : void
리턴 void

readHeaders() 공개 메소드

Reads the headers of the request and determines if they are valid or not
public readHeaders ( ) : bool
리턴 bool

writeError() 공개 메소드

public writeError ( int status, string message ) : void
status int
message string
리턴 void

writeFailure() 공개 메소드

public writeFailure ( ) : void
리턴 void

writeForbidden() 공개 메소드

public writeForbidden ( ) : void
리턴 void

writeNotAuthorized() 공개 메소드

public writeNotAuthorized ( String realm ) : void
realm String
리턴 void

writeResult() 공개 메소드

public writeResult ( int status, string message, long length ) : void
status int
message string
length long
리턴 void

writeResult() 공개 메소드

public writeResult ( int status, string message, long length, string mimetype ) : void
status int
message string
length long
mimetype string
리턴 void

writeSuccess() 공개 메소드

public writeSuccess ( long length ) : void
length long
리턴 void

writeSuccess() 공개 메소드

public writeSuccess ( long length, string mimetype ) : void
length long
mimetype string
리턴 void

writeURL() 공개 메소드

We need to make sure that the url that we are trying to treat as a file lies below the document root of the http server so that people can't grab random files off your computer while this is running.
public writeURL ( ) : void
리턴 void

프로퍼티 상세

ns 공개적으로 프로퍼티

public NetworkStream ns
리턴 NetworkStream