QHttpEngine  1.0.0
Simple and secure HTTP server for Qt applications
 All Classes Functions Typedefs Enumerations Enumerator Pages
Public Member Functions | Protected Member Functions | Friends | List of all members
QHttpEngine::Server Class Reference

TCP server for HTTP requests. More...

#include <qhttpengine/server.h>

Inheritance diagram for QHttpEngine::Server:

Public Member Functions

 Server (QObject *parent=0)
 Create an HTTP server.
 
 Server (Handler *handler, QObject *parent=0)
 Create an HTTP server with the specified handler.
 
void setHandler (Handler *handler)
 Set the root handler for all new requests.
 
void setSslConfiguration (const QSslConfiguration &configuration)
 Set the SSL configuration for the server. More...
 

Protected Member Functions

void incomingConnection (qintptr socketDescriptor)
 Implementation of QTcpServer::incomingConnection()
 

Friends

class ServerPrivate
 

Detailed Description

This class provides a TCP server that listens for HTTP requests on the specified address and port. When a new request is received, a Socket is created for the QTcpSocket which abstracts a TCP server socket. Once the request headers are received, the root handler is invoked and the request processed. The server assumes ownership of the QTcpSocket.

Because Server derives from QTcpServer, instructing the server to listen on an available port is as simple as invoking listen() with no parameters:

* if (!server.listen()) {
* // error handling
* }
*

Before passing the socket to the handler, the QTcpSocket's disconnected() signal is connected to the Socket's deleteLater() slot to ensure that the socket is deleted when the client disconnects.

Member Function Documentation

void QHttpEngine::Server::setSslConfiguration ( const QSslConfiguration &  configuration)

If the configuration is not NULL, the server will begin negotiating connections using SSL/TLS.


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