The server builds a framework for the handlers. More...
#include <http.h>
Public Member Functions | |
virtual Sint32 | start (const char *listen_address)=0 |
Starts the server listening on the given address. More... | |
virtual Sint32 | start_ssl (const char *listen_address, const char *cert_file, const char *private_key_file, const char *password)=0 |
Starts the server in SSL mode listening on the given address. More... | |
virtual void | shutdown ()=0 |
Shuts down a server that has been previously started. More... | |
virtual Sint32 | set_default_mime_type (const char *mime_type)=0 |
Sets the default MIME type to be used when no MIME type was found. More... | |
virtual void | add_mime_type (const char *extension, const char *mime_type)=0 |
Adds a new MIME type to the server. More... | |
virtual const char * | lookup_mime_type (const char *extension)=0 |
Returns the MIME type registered for a certain extension. More... | |
virtual void | install (IRequest_handler *handler)=0 |
Adds a new request handler to the server. More... | |
virtual void | remove (IRequest_handler *handler)=0 |
Removes a previously installed request handler from the server. More... | |
virtual void | install (IWeb_socket_handler *handler)=0 |
Adds a new WebSocket request handler to the server. More... | |
virtual void | remove (IWeb_socket_handler *handler)=0 |
Removes a previously installed WebSocket request handler from the server. More... | |
virtual void | install (ICGIRequest_handler *handler)=0 |
Adds a new CGI request handler to the server. More... | |
virtual void | remove (ICGIRequest_handler *handler)=0 |
Removes a previously installed CGI request handler from the server. More... | |
virtual void | install (IResponse_handler *handler)=0 |
Adds a new response handler to the server. More... | |
virtual void | remove (IResponse_handler *handler)=0 |
Removes a previously installed response handler from the server. More... | |
virtual void | set_identification (const char *id_string)=0 |
Sets the identification string of the server. More... | |
virtual const char * | get_listen_address ()=0 |
Returns the listen address of the server. More... | |
virtual const char * | get_ssl_listen_address ()=0 |
Returns the SSL listen address of the server. More... | |
virtual Size | get_nr_of_connections ()=0 |
Returns the number of existing HTTP connections in this server. More... | |
virtual Size | get_nr_of_active_connections ()=0 |
Returns the number of HTTP connections in this server which actually handle requests. More... | |
virtual void | set_keep_alive_timeout (Uint32 nr_of_seconds)=0 |
Sets the idle timeout for keep-alive connections. More... | |
virtual Uint32 | get_keep_alive_timeout () const =0 |
Returns the idle timeout for keep-alive connections. More... | |
virtual void | set_send_buffer_size (Uint32 send_buffer_size)=0 |
Sets the send buffer size of the socket. More... | |
virtual Uint32 | get_send_buffer_size () const =0 |
Returns the send buffer size of the socket. More... | |
virtual void | set_http_post_body_limit (Uint32 http_post_body_limit)=0 |
Sets the size limit for the body of HTTP POST requests. More... | |
virtual Uint32 | get_http_post_body_limit () const =0 |
Returns the size limit for the body of HTTP POST requests. More... | |
virtual void | set_concurrent_connection_limit (Uint32 limit)=0 |
Sets the maximum number of concurrent connections this server will accept. More... | |
virtual Uint32 | get_concurrent_connection_limit ()=0 |
Returns the current concurrent connection limit. More... | |
Public Member Functions inherited from mi::base::IInterface | |
virtual Uint32 | retain () const =0 |
Increments the reference count. More... | |
virtual Uint32 | release () const =0 |
Decrements the reference count. More... | |
virtual const IInterface * | get_interface (const Uuid &interface_id) const =0 |
Acquires a const interface from another. More... | |
template<class T> | |
const T * | get_interface () const |
Acquires a const interface from another. More... | |
virtual IInterface * | get_interface (const Uuid &interface_id)=0 |
Acquires a mutable interface from another. More... | |
template<class T> | |
T * | get_interface () |
Acquires a mutable interface from another. More... | |
virtual Uuid | get_iid () const =0 |
Returns the interface ID of the most derived interface. More... | |
Additional Inherited Members | |
Public Types inherited from mi::base::Interface_declare< 0x9923b273, ... > | |
typedef Interface_declare< id1, ... > | Self |
Own type. More... | |
typedef Uuid_t< id1, ... > | IID |
Declares the interface ID (IID) of this interface. More... | |
Public Types inherited from mi::base::IInterface | |
typedef Uuid_t<0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0> | IID |
Declares the interface ID (IID) of this interface. More... | |
Static Public Member Functions inherited from mi::base::Interface_declare< 0x9923b273, ... > | |
static bool | compare_iid (const Uuid &iid) |
Compares the interface ID iid against the interface ID of this interface and of its ancestors. More... | |
Static Public Member Functions inherited from mi::base::IInterface | |
static bool | compare_iid (const Uuid &iid) |
Compares the interface ID iid against the interface ID of this interface. More... | |
The server builds a framework for the handlers.
|
pure virtual |
Adds a new MIME type to the server.
The server will use the given extension
/ mime_type
pairs to set the content-type header in the response based on the extension of the requested URL. Note that a handler may overwrite the MIME type (as any header field), if necessary.
extension | The extension identifying the MIME type. |
mime_type | The MIME type to be set when the extension was found. |
|
pure virtual |
Returns the current concurrent connection limit.
|
pure virtual |
Returns the size limit for the body of HTTP POST requests.
|
pure virtual |
Returns the idle timeout for keep-alive connections.
|
pure virtual |
Returns the listen address of the server.
|
pure virtual |
Returns the number of HTTP connections in this server which actually handle requests.
|
pure virtual |
Returns the number of existing HTTP connections in this server.
|
pure virtual |
Returns the send buffer size of the socket.
|
pure virtual |
Returns the SSL listen address of the server.
|
pure virtual |
Adds a new CGI request handler to the server.
handler | The handler to be installed. |
|
pure virtual |
Adds a new request handler to the server.
handler | The handler to be installed. |
|
pure virtual |
Adds a new response handler to the server.
handler | The handler to be installed. |
|
pure virtual |
Adds a new WebSocket request handler to the server.
handler | The handler to be installed. |
|
pure virtual |
Returns the MIME type registered for a certain extension.
extension | The file extension to lookup. |
NULL
.
|
pure virtual |
Removes a previously installed CGI request handler from the server.
handler | The handler to be removed. |
|
pure virtual |
Removes a previously installed request handler from the server.
handler | The handler to be removed. |
|
pure virtual |
Removes a previously installed response handler from the server.
handler | The handler to be removed. |
|
pure virtual |
Removes a previously installed WebSocket request handler from the server.
handler | The handler to be removed. |
|
pure virtual |
Sets the maximum number of concurrent connections this server will accept.
Defaults to 256.
Further connections will be put on the OS backlog and serviced only after the number of current connections drops below this value.
Note that when even the OS backlog is full things works a bit differently depending on OS:
Linux: Further connections will be ignored by the server, client will time out and Windows: Further connections will be rejected by the server and fail.
limit | The new limit. |
|
pure virtual |
Sets the default MIME type to be used when no MIME type was found.
mime_type | The default MIME type. |
|
pure virtual |
Sets the size limit for the body of HTTP POST requests.
http_post_body_limit | The new size limit. |
|
pure virtual |
Sets the identification string of the server.
This string is automatically put in the "Server" header of each response. A handler might overwrite it, if necessary on a per URL basis.
id_string | The identification string. |
|
pure virtual |
Sets the idle timeout for keep-alive connections.
The default is not to timeout.
nr_of_seconds | Seconds of idleness allowed before the server closes the connection. |
|
pure virtual |
Sets the send buffer size of the socket.
Increasing the buffer size can be useful in the case of high latency connections.
send_buffer_size | Size of socket send buffer. |
|
pure virtual |
Shuts down a server that has been previously started.
The server will stop accepting new requests and shut down as fast as possible. However, requests currently being handled will be served until they are done.
|
pure virtual |
Starts the server listening on the given address.
This method can be called at most once. Additionally, the method start_ssl() can also be called for secure connections.
The server will run within a separate thread; all requests will be handled in their own threads as well.
listen_address | The address to listen on. |
listen_address
already in use.
|
pure virtual |
Starts the server in SSL mode listening on the given address.
This method can be called at most once. Additionally, the method start() can also be called for insecure connections.
The server will run within a separate thread; all requests will be handled in their own threads as well.
listen_address | The address to listen on. |
cert_file | The file containing the server's certificate. The certificate needs to be in PEM format. The DER format is not supported. |
private_key_file | The file containing the server's private key. |
password | The password for decrypting the private key. |
listen_address
already in use.