OpenSim
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Events Macros
Public Member Functions | Public Attributes | Protected Attributes | Properties | List of all members
OpenSim.Framework.Servers.HttpServer.BaseHttpServer Class Reference
Inheritance diagram for OpenSim.Framework.Servers.HttpServer.BaseHttpServer:
Inheritance graph
[legend]
Collaboration diagram for OpenSim.Framework.Servers.HttpServer.BaseHttpServer:
Collaboration graph
[legend]

Public Member Functions

delegate void WebSocketRequestDelegate (string servicepath, WebSocketHttpServerHandler handler)
 This is a pending websocket request before it got an sucessful upgrade response. The consumer must call handler.HandshakeAndUpgrade() to signal to the handler to start the connection and optionally provide an origin authentication method. More...
 
 BaseHttpServer (uint port)
 
 BaseHttpServer (uint port, bool ssl)
 
 BaseHttpServer (uint port, bool ssl, uint sslport, string CN)
 
 BaseHttpServer (uint port, bool ssl, string CPath, string CPass)
 
void AddStreamHandler (IRequestHandler handler)
 Add a stream handler to the http server. If the handler already exists, then nothing happens. More...
 
void AddWebSocketHandler (string servicepath, WebSocketRequestDelegate handler)
 
void RemoveWebSocketHandler (string servicepath)
 
List< string > GetStreamHandlerKeys ()
 
bool AddXmlRPCHandler (string method, XmlRpcMethod handler)
 
bool AddXmlRPCHandler (string method, XmlRpcMethod handler, bool keepAlive)
 
XmlRpcMethod GetXmlRPCHandler (string method)
 Gets the XML RPC handler for given method name More...
 
List< string > GetXmlRpcHandlerKeys ()
 
bool AddJsonRPCHandler (string method, JsonRPCMethod handler)
 
JsonRPCMethod GetJsonRPCHandler (string method)
 
List< string > GetJsonRpcHandlerKeys ()
 
bool AddHTTPHandler (string methodName, GenericHTTPMethod handler)
 Add a handler for an HTTP request. More...
 
List< string > GetHTTPHandlerKeys ()
 
bool AddPollServiceHTTPHandler (string methodName, PollServiceEventArgs args)
 
List< string > GetPollServiceHandlerKeys ()
 
bool AddLLSDHandler (string path, LLSDMethod handler)
 Adds a LLSD handler, yay. More...
 
List< string > GetLLSDHandlerKeys ()
 
bool SetDefaultLLSDHandler (DefaultLLSDMethod handler)
 
void OnRequest (object source, RequestEventArgs args)
 
virtual void HandleRequest (OSHttpRequest request, OSHttpResponse response)
 This methods is the start of incoming HTTP request handling. More...
 
byte[] HandleHTTPRequest (OSHttpRequest request, OSHttpResponse response)
 
byte[] SendHTML404 (OSHttpResponse response, string host)
 
byte[] SendHTML500 (OSHttpResponse response)
 
void Start ()
 
void Start (bool performPollResponsesAsync)
 Start the http server More...
 
void httpServerDisconnectMonitor (IHttpClientContext source, SocketError err)
 
void httpServerException (object source, Exception exception)
 
void Stop ()
 
void RemoveStreamHandler (string httpMethod, string path)
 
void RemoveHTTPHandler (string httpMethod, string path)
 Remove an HTTP handler More...
 
void RemovePollServiceHTTPHandler (string httpMethod, string path)
 
void RemoveXmlRPCHandler (string method)
 
void RemoveJsonRPCHandler (string method)
 
bool RemoveLLSDHandler (string path, LLSDMethod handler)
 
string GetHTTP404 (string host)
 
string GetHTTP500 ()
 
- Public Member Functions inherited from OpenSim.Framework.Servers.HttpServer.IHttpServer
void AddWebSocketHandler (string servicepath, BaseHttpServer.WebSocketRequestDelegate handler)
 Websocket HTTP server handlers. More...
 

Public Attributes

volatile bool HTTPDRunning = false
 

Protected Attributes

CoolHTTPListener m_httpListener2
 
Dictionary< string, XmlRpcMethodm_rpcHandlers = new Dictionary<string, XmlRpcMethod>()
 
Dictionary< string, JsonRPCMethodjsonRpcHandlers = new Dictionary<string, JsonRPCMethod>()
 
Dictionary< string, bool > m_rpcHandlersKeepAlive = new Dictionary<string, bool>()
 
DefaultLLSDMethod m_defaultLlsdHandler = null
 
Dictionary< string, LLSDMethodm_llsdHandlers = new Dictionary<string, LLSDMethod>()
 
Dictionary< string,
IRequestHandler
m_streamHandlers = new Dictionary<string, IRequestHandler>()
 
Dictionary< string,
GenericHTTPMethod
m_HTTPHandlers = new Dictionary<string, GenericHTTPMethod>()
 
Dictionary< string,
PollServiceEventArgs
m_pollHandlers
 
Dictionary< string,
WebSocketRequestDelegate
m_WebSocketHandlers
 
uint m_port
 
uint m_sslport
 
bool m_ssl
 
bool m_firstcaps = true
 
string m_SSLCommonName = ""
 
IPAddress m_listenIPAddress = IPAddress.Any
 

Properties

int DebugLevel [get, set]
 Gets or sets the debug level. More...
 
int RequestNumber [get, set]
 Request number for diagnostic purposes. More...
 
PollServiceRequestManager PollServiceRequestManager [get, set]
 
uint SSLPort [get]
 
string SSLCommonName [get]
 
uint Port [get]
 
bool UseSSL [get]
 
IPAddress ListenIPAddress [get, set]
 
- Properties inherited from OpenSim.Framework.Servers.HttpServer.IHttpServer
uint SSLPort [get]
 
string SSLCommonName [get]
 
uint Port [get]
 
bool UseSSL [get]
 

Detailed Description

Definition at line 53 of file BaseHttpServer.cs.

Constructor & Destructor Documentation

OpenSim.Framework.Servers.HttpServer.BaseHttpServer.BaseHttpServer ( uint  port)
inline

Definition at line 146 of file BaseHttpServer.cs.

OpenSim.Framework.Servers.HttpServer.BaseHttpServer.BaseHttpServer ( uint  port,
bool  ssl 
)
inline

Definition at line 151 of file BaseHttpServer.cs.

OpenSim.Framework.Servers.HttpServer.BaseHttpServer.BaseHttpServer ( uint  port,
bool  ssl,
uint  sslport,
string  CN 
)
inline

Definition at line 156 of file BaseHttpServer.cs.

OpenSim.Framework.Servers.HttpServer.BaseHttpServer.BaseHttpServer ( uint  port,
bool  ssl,
string  CPath,
string  CPass 
)
inline

Definition at line 164 of file BaseHttpServer.cs.

Member Function Documentation

bool OpenSim.Framework.Servers.HttpServer.BaseHttpServer.AddHTTPHandler ( string  methodName,
GenericHTTPMethod  handler 
)
inline

Add a handler for an HTTP request.

This handler can actually be invoked either as

http://<hostname>:<port>/?method=<methodName>

or

http://<hostname>:<port><method>

if the method name starts with a slash. For example, AddHTTPHandler("/object/", ...) on a standalone region server will register a handler that can be invoked with either

http://localhost:9000/?method=/object/

or

http://localhost:9000/object/

In addition, the handler invoked by the HTTP server for any request is the one when best matches the request URI. So if a handler for "/myapp/" is registered and a request for "/myapp/page" is received, then the "/myapp/" handler is invoked if no "/myapp/page" handler exists.

Parameters
methodName
handler
Returns
true if the handler was successfully registered, false if a handler with the same name already existed.

Implements OpenSim.Framework.Servers.HttpServer.IHttpServer.

Definition at line 287 of file BaseHttpServer.cs.

Here is the caller graph for this function:

bool OpenSim.Framework.Servers.HttpServer.BaseHttpServer.AddJsonRPCHandler ( string  method,
JsonRPCMethod  handler 
)
inline
bool OpenSim.Framework.Servers.HttpServer.BaseHttpServer.AddLLSDHandler ( string  path,
LLSDMethod  handler 
)
inline

Adds a LLSD handler, yay.

Parameters
path/resource/ path
handlerhandle the LLSD response
Returns

Implements OpenSim.Framework.Servers.HttpServer.IHttpServer.

Definition at line 354 of file BaseHttpServer.cs.

bool OpenSim.Framework.Servers.HttpServer.BaseHttpServer.AddPollServiceHTTPHandler ( string  methodName,
PollServiceEventArgs  args 
)
inline
void OpenSim.Framework.Servers.HttpServer.BaseHttpServer.AddStreamHandler ( IRequestHandler  handler)
inline

Add a stream handler to the http server. If the handler already exists, then nothing happens.

Parameters
handler

Implements OpenSim.Framework.Servers.HttpServer.IHttpServer.

Definition at line 176 of file BaseHttpServer.cs.

void OpenSim.Framework.Servers.HttpServer.BaseHttpServer.AddWebSocketHandler ( string  servicepath,
WebSocketRequestDelegate  handler 
)
inline

Definition at line 192 of file BaseHttpServer.cs.

bool OpenSim.Framework.Servers.HttpServer.BaseHttpServer.AddXmlRPCHandler ( string  method,
XmlRpcMethod  handler 
)
inline
bool OpenSim.Framework.Servers.HttpServer.BaseHttpServer.AddXmlRPCHandler ( string  method,
XmlRpcMethod  handler,
bool  keepAlive 
)
inline
string OpenSim.Framework.Servers.HttpServer.BaseHttpServer.GetHTTP404 ( string  host)
inline
string OpenSim.Framework.Servers.HttpServer.BaseHttpServer.GetHTTP500 ( )
inline
List<string> OpenSim.Framework.Servers.HttpServer.BaseHttpServer.GetHTTPHandlerKeys ( )
inline

Definition at line 304 of file BaseHttpServer.cs.

JsonRPCMethod OpenSim.Framework.Servers.HttpServer.BaseHttpServer.GetJsonRPCHandler ( string  method)
inline

Definition at line 266 of file BaseHttpServer.cs.

List<string> OpenSim.Framework.Servers.HttpServer.BaseHttpServer.GetJsonRpcHandlerKeys ( )
inline

Definition at line 281 of file BaseHttpServer.cs.

List<string> OpenSim.Framework.Servers.HttpServer.BaseHttpServer.GetLLSDHandlerKeys ( )
inline

Definition at line 367 of file BaseHttpServer.cs.

List<string> OpenSim.Framework.Servers.HttpServer.BaseHttpServer.GetPollServiceHandlerKeys ( )
inline

Definition at line 324 of file BaseHttpServer.cs.

List<string> OpenSim.Framework.Servers.HttpServer.BaseHttpServer.GetStreamHandlerKeys ( )
inline

Definition at line 208 of file BaseHttpServer.cs.

XmlRpcMethod OpenSim.Framework.Servers.HttpServer.BaseHttpServer.GetXmlRPCHandler ( string  method)
inline

Gets the XML RPC handler for given method name

Parameters
methodName of the method
Returns
Returns null if not found

Implements OpenSim.Framework.Servers.HttpServer.IHttpServer.

Definition at line 235 of file BaseHttpServer.cs.

List<string> OpenSim.Framework.Servers.HttpServer.BaseHttpServer.GetXmlRpcHandlerKeys ( )
inline

Definition at line 250 of file BaseHttpServer.cs.

byte [] OpenSim.Framework.Servers.HttpServer.BaseHttpServer.HandleHTTPRequest ( OSHttpRequest  request,
OSHttpResponse  response 
)
inline

Definition at line 1559 of file BaseHttpServer.cs.

virtual void OpenSim.Framework.Servers.HttpServer.BaseHttpServer.HandleRequest ( OSHttpRequest  request,
OSHttpResponse  response 
)
inlinevirtual

This methods is the start of incoming HTTP request handling.

Parameters
request
response

Definition at line 490 of file BaseHttpServer.cs.

void OpenSim.Framework.Servers.HttpServer.BaseHttpServer.httpServerDisconnectMonitor ( IHttpClientContext  source,
SocketError  err 
)
inline

Definition at line 1996 of file BaseHttpServer.cs.

void OpenSim.Framework.Servers.HttpServer.BaseHttpServer.httpServerException ( object  source,
Exception  exception 
)
inline

Definition at line 2007 of file BaseHttpServer.cs.

void OpenSim.Framework.Servers.HttpServer.BaseHttpServer.OnRequest ( object  source,
RequestEventArgs  args 
)
inline

Definition at line 379 of file BaseHttpServer.cs.

void OpenSim.Framework.Servers.HttpServer.BaseHttpServer.RemoveHTTPHandler ( string  httpMethod,
string  path 
)
inline

Remove an HTTP handler

Parameters
httpMethod
path

Implements OpenSim.Framework.Servers.HttpServer.IHttpServer.

Definition at line 2056 of file BaseHttpServer.cs.

void OpenSim.Framework.Servers.HttpServer.BaseHttpServer.RemoveJsonRPCHandler ( string  method)
inline
bool OpenSim.Framework.Servers.HttpServer.BaseHttpServer.RemoveLLSDHandler ( string  path,
LLSDMethod  handler 
)
inline

Implements OpenSim.Framework.Servers.HttpServer.IHttpServer.

Definition at line 2105 of file BaseHttpServer.cs.

Here is the call graph for this function:

void OpenSim.Framework.Servers.HttpServer.BaseHttpServer.RemovePollServiceHTTPHandler ( string  httpMethod,
string  path 
)
inline
void OpenSim.Framework.Servers.HttpServer.BaseHttpServer.RemoveStreamHandler ( string  httpMethod,
string  path 
)
inline
void OpenSim.Framework.Servers.HttpServer.BaseHttpServer.RemoveWebSocketHandler ( string  servicepath)
inline
void OpenSim.Framework.Servers.HttpServer.BaseHttpServer.RemoveXmlRPCHandler ( string  method)
inline
byte [] OpenSim.Framework.Servers.HttpServer.BaseHttpServer.SendHTML404 ( OSHttpResponse  response,
string  host 
)
inline

Definition at line 1874 of file BaseHttpServer.cs.

byte [] OpenSim.Framework.Servers.HttpServer.BaseHttpServer.SendHTML500 ( OSHttpResponse  response)
inline

Definition at line 1890 of file BaseHttpServer.cs.

Here is the call graph for this function:

bool OpenSim.Framework.Servers.HttpServer.BaseHttpServer.SetDefaultLLSDHandler ( DefaultLLSDMethod  handler)
inline
void OpenSim.Framework.Servers.HttpServer.BaseHttpServer.Start ( )
inline

Definition at line 1907 of file BaseHttpServer.cs.

void OpenSim.Framework.Servers.HttpServer.BaseHttpServer.Start ( bool  performPollResponsesAsync)
inline

Start the http server

Parameters
processPollRequestsAsyncIf true then poll responses are performed asynchronsly. Option exists to allow regression tests to perform processing synchronously.

Definition at line 1919 of file BaseHttpServer.cs.

void OpenSim.Framework.Servers.HttpServer.BaseHttpServer.Stop ( )
inline

Definition at line 2023 of file BaseHttpServer.cs.

delegate void OpenSim.Framework.Servers.HttpServer.BaseHttpServer.WebSocketRequestDelegate ( string  servicepath,
WebSocketHttpServerHandler  handler 
)

This is a pending websocket request before it got an sucessful upgrade response. The consumer must call handler.HandshakeAndUpgrade() to signal to the handler to start the connection and optionally provide an origin authentication method.

Parameters
servicepath
handler

Member Data Documentation

volatile bool OpenSim.Framework.Servers.HttpServer.BaseHttpServer.HTTPDRunning = false

Definition at line 91 of file BaseHttpServer.cs.

Dictionary<string, JsonRPCMethod> OpenSim.Framework.Servers.HttpServer.BaseHttpServer.jsonRpcHandlers = new Dictionary<string, JsonRPCMethod>()
protected

Definition at line 96 of file BaseHttpServer.cs.

DefaultLLSDMethod OpenSim.Framework.Servers.HttpServer.BaseHttpServer.m_defaultLlsdHandler = null
protected

Definition at line 98 of file BaseHttpServer.cs.

bool OpenSim.Framework.Servers.HttpServer.BaseHttpServer.m_firstcaps = true
protected

Definition at line 113 of file BaseHttpServer.cs.

Dictionary<string, GenericHTTPMethod> OpenSim.Framework.Servers.HttpServer.BaseHttpServer.m_HTTPHandlers = new Dictionary<string, GenericHTTPMethod>()
protected

Definition at line 101 of file BaseHttpServer.cs.

CoolHTTPListener OpenSim.Framework.Servers.HttpServer.BaseHttpServer.m_httpListener2
protected

Definition at line 94 of file BaseHttpServer.cs.

IPAddress OpenSim.Framework.Servers.HttpServer.BaseHttpServer.m_listenIPAddress = IPAddress.Any
protected

Definition at line 116 of file BaseHttpServer.cs.

Dictionary<string, LLSDMethod> OpenSim.Framework.Servers.HttpServer.BaseHttpServer.m_llsdHandlers = new Dictionary<string, LLSDMethod>()
protected

Definition at line 99 of file BaseHttpServer.cs.

Dictionary<string, PollServiceEventArgs> OpenSim.Framework.Servers.HttpServer.BaseHttpServer.m_pollHandlers
protected
Initial value:
=
new Dictionary<string, PollServiceEventArgs>()

Definition at line 103 of file BaseHttpServer.cs.

uint OpenSim.Framework.Servers.HttpServer.BaseHttpServer.m_port
protected

Definition at line 109 of file BaseHttpServer.cs.

Dictionary<string, XmlRpcMethod> OpenSim.Framework.Servers.HttpServer.BaseHttpServer.m_rpcHandlers = new Dictionary<string, XmlRpcMethod>()
protected

Definition at line 95 of file BaseHttpServer.cs.

Dictionary<string, bool> OpenSim.Framework.Servers.HttpServer.BaseHttpServer.m_rpcHandlersKeepAlive = new Dictionary<string, bool>()
protected

Definition at line 97 of file BaseHttpServer.cs.

bool OpenSim.Framework.Servers.HttpServer.BaseHttpServer.m_ssl
protected

Definition at line 111 of file BaseHttpServer.cs.

string OpenSim.Framework.Servers.HttpServer.BaseHttpServer.m_SSLCommonName = ""
protected

Definition at line 114 of file BaseHttpServer.cs.

uint OpenSim.Framework.Servers.HttpServer.BaseHttpServer.m_sslport
protected

Definition at line 110 of file BaseHttpServer.cs.

Dictionary<string, IRequestHandler> OpenSim.Framework.Servers.HttpServer.BaseHttpServer.m_streamHandlers = new Dictionary<string, IRequestHandler>()
protected

Definition at line 100 of file BaseHttpServer.cs.

Dictionary<string, WebSocketRequestDelegate> OpenSim.Framework.Servers.HttpServer.BaseHttpServer.m_WebSocketHandlers
protected
Initial value:
=
new Dictionary<string, WebSocketRequestDelegate>()

Definition at line 106 of file BaseHttpServer.cs.

Property Documentation

int OpenSim.Framework.Servers.HttpServer.BaseHttpServer.DebugLevel
getset

Gets or sets the debug level.

See MainServer.DebugLevel.

Definition at line 74 of file BaseHttpServer.cs.

IPAddress OpenSim.Framework.Servers.HttpServer.BaseHttpServer.ListenIPAddress
getset

Definition at line 141 of file BaseHttpServer.cs.

PollServiceRequestManager OpenSim.Framework.Servers.HttpServer.BaseHttpServer.PollServiceRequestManager
getset

Definition at line 118 of file BaseHttpServer.cs.

uint OpenSim.Framework.Servers.HttpServer.BaseHttpServer.Port
get

Definition at line 131 of file BaseHttpServer.cs.

int OpenSim.Framework.Servers.HttpServer.BaseHttpServer.RequestNumber
getset

Request number for diagnostic purposes.

This is an internal number. In some debug situations an external number may also be supplied in the opensim-request-id header but we are not currently logging this.

Definition at line 83 of file BaseHttpServer.cs.

string OpenSim.Framework.Servers.HttpServer.BaseHttpServer.SSLCommonName
get

Definition at line 126 of file BaseHttpServer.cs.

uint OpenSim.Framework.Servers.HttpServer.BaseHttpServer.SSLPort
get

Definition at line 121 of file BaseHttpServer.cs.

bool OpenSim.Framework.Servers.HttpServer.BaseHttpServer.UseSSL
get

Definition at line 136 of file BaseHttpServer.cs.


The documentation for this class was generated from the following file: