C# Класс BonCodeAJP13.ServerPackets.BonCodeAJP13ForwardRequest

This is the implementation of a Forward Request Package A server Forward Request package initiates the conversation from Webserver to Tomcat
Наследование: BonCodeAJP13Packet
Показать файл Открыть проект Примеры использования класса

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

Метод Описание
BonCodeAJP13ForwardRequest ( ) : System

Generic Constructor can be used to create empty package

BonCodeAJP13ForwardRequest ( NameValueCollection httpHeaders ) : System

Constructor with HTTP Headers

BonCodeAJP13ForwardRequest ( NameValueCollection httpHeaders, String pathInfo ) : System

Constructor with HTTP Headers and PathInfo

BonCodeAJP13ForwardRequest ( NameValueCollection httpHeaders, String pathInfo, int sourcePort, String vdirs ) : System

Constructor with HTTP Headers, PathInfo, and Source Port This is the most frequently used one

BonCodeAJP13ForwardRequest ( NameValueCollection httpHeaders, String pathInfo, int sourcePort, String vdirs, X509Certificate cert ) : System

Constructor with HTTP Headers, PathInfo, and Source Port, and ClientCert This is used when we have client certificates over SSL

BonCodeAJP13ForwardRequest ( byte content ) : System

Creates a Body only Forward Request Package. This is normally a follow on to an initial request that has all the header data. We can only send 8186 bytes at a time.

BonCodeAJP13ForwardRequest ( byte method, string protocol, string req_uri, string remote_addr, string remote_host, string server_name, ushort server_port, bool is_ssl, int num_headers = 1 ) : System

Constructor without HTTP Headers. Used for testing URL calls only. Will not transfer Query-String.

CheckHeaders ( NameValueCollection httpHeaders ) : NameValueCollection

evaluates the headers passed from webserver and checks whether they can be accepted by tomcat as is. This also converts null headers to empty strings.

PrintPacketHeader ( ) : string

override to base class return header information about a packet. we use this for logging

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

Метод Описание
CertExportToPEM ( X509Certificate cert ) : string

Export a certificate to a PEM format string

GetCorrectHeaderName ( String headerKey ) : string

Return a correct case for the HTTP header. IIS upper cases all header names this may throw of some Java programs. We redo the character case for all headers that were initially sent in by browser or client in to their orignal case. If this is an IIS generated header we will lower case the name and return it with escaped underscores.

GetFingerprint ( NameValueCollection httpHeaders ) : string

generate the client fingerprint based on HTTP headers accepted by tomcat as is

GetHeaders ( NameValueCollection httpHeaders ) : string

Return a string of parsed IIS headers. For Debug and Testing only.

GetKeyValue ( NameValueCollection httpHeaders, string keyName ) : string

Returns the zero node string of a key existing in the collection. Return empty string if key is not defined.

GetMD5Hash ( String sourceData ) : string

Return a MD5 Hash of given text as base 64 string. This may be used with fingertprint operation of client.

GetRemoteAddr ( NameValueCollection httpHeaders ) : string

Check for override on REMOTE_ADDR and return the value from designated header instead. Intermediaries such as Proxy Servers and Load Balancers hide the REMOTE_ADDR but add alternate headers. Most likely the HTTP_X_FORWARDED_FOR header is used for this.

KeyExists ( NameValueCollection httpHeaders, string keyName ) : bool

Check whether a key is defined in the Name Value collection

PopulateRawHeaders ( String rawHeaders ) : void

Populate the p_RawHeadersTranlator hashtable with correct data from Raw Headers

WritePacket ( NameValueCollection httpHeaders, String pathInfo, int sourcePort, String vDirs = "" ) : void

Creates forward request package based on header data

WritePacket ( byte transferContent ) : void

Creates forward request package based on byte array. This is normally a follow on package to initial forward request.

WritePacket ( byte method, string protocol, string req_uri, string remote_addr, string remote_host, string server_name, ushort server_port, bool is_ssl, int num_headers, NameValueCollection httpHeaders, String realPathInfo = "", int sourcePort, String vDirs = "" ) : void

Creates actual forward request package and stores in p_ByteStore of the instance

WritePacketTest ( byte method = 0x02, string protocol = "HTTP/1.1", string req_uri = "/", string remote_addr = "::1", string remote_host = "::1", string server_name = "localhost", ushort server_port = 80, bool is_ssl = false, int num_headers = 1 ) : void

Creates test forward request package and stores in p_ByteStore of the object

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

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

Generic Constructor can be used to create empty package
public BonCodeAJP13ForwardRequest ( ) : System
Результат System

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

Constructor with HTTP Headers
public BonCodeAJP13ForwardRequest ( NameValueCollection httpHeaders ) : System
httpHeaders System.Collections.Specialized.NameValueCollection
Результат System

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

Constructor with HTTP Headers and PathInfo
public BonCodeAJP13ForwardRequest ( NameValueCollection httpHeaders, String pathInfo ) : System
httpHeaders System.Collections.Specialized.NameValueCollection
pathInfo String
Результат System

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

Constructor with HTTP Headers, PathInfo, and Source Port This is the most frequently used one
public BonCodeAJP13ForwardRequest ( NameValueCollection httpHeaders, String pathInfo, int sourcePort, String vdirs ) : System
httpHeaders System.Collections.Specialized.NameValueCollection
pathInfo String
sourcePort int
vdirs String
Результат System

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

Constructor with HTTP Headers, PathInfo, and Source Port, and ClientCert This is used when we have client certificates over SSL
public BonCodeAJP13ForwardRequest ( NameValueCollection httpHeaders, String pathInfo, int sourcePort, String vdirs, X509Certificate cert ) : System
httpHeaders System.Collections.Specialized.NameValueCollection
pathInfo String
sourcePort int
vdirs String
cert X509Certificate
Результат System

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

Creates a Body only Forward Request Package. This is normally a follow on to an initial request that has all the header data. We can only send 8186 bytes at a time.
public BonCodeAJP13ForwardRequest ( byte content ) : System
content byte
Результат System

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

Constructor without HTTP Headers. Used for testing URL calls only. Will not transfer Query-String.
public BonCodeAJP13ForwardRequest ( byte method, string protocol, string req_uri, string remote_addr, string remote_host, string server_name, ushort server_port, bool is_ssl, int num_headers = 1 ) : System
method byte
protocol string
req_uri string
remote_addr string
remote_host string
server_name string
server_port ushort
is_ssl bool
num_headers int
Результат System

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

evaluates the headers passed from webserver and checks whether they can be accepted by tomcat as is. This also converts null headers to empty strings.
public CheckHeaders ( NameValueCollection httpHeaders ) : NameValueCollection
httpHeaders System.Collections.Specialized.NameValueCollection
Результат System.Collections.Specialized.NameValueCollection

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

override to base class return header information about a packet. we use this for logging
public PrintPacketHeader ( ) : string
Результат string