tufao  1.3.0
An asynchronous web framework for C++ built on top of Qt
Tufao::HttpsServer Class Reference

Tufao::HttpsServer is a subclass of Tufao::HttpServer that provides secure communication with the client. More...

+ Inheritance diagram for Tufao::HttpsServer:
+ Collaboration diagram for Tufao::HttpsServer:

Public Member Functions

 HttpsServer (QObject *parent=0)
 
 ~HttpsServer ()
 Destroys the object.
 
void setLocalCertificate (const QSslCertificate &certificate)
 Sets the local certificate to certificate. More...
 
void setPrivateKey (const QSslKey &key)
 Sets the private key to key. More...
 
- Public Member Functions inherited from Tufao::HttpServer
 HttpServer (QObject *parent=0)
 Constructs a Tufao::HttpServer object. More...
 
 ~HttpServer ()
 Destroys the object.
 
bool listen (const QHostAddress &address=QHostAddress::Any, quint16 port=0)
 Tells the server to listen for incoming connections on address address and port port. More...
 
bool isListening () const
 Returns true if the server is listening for incoming connections.
 
quint16 serverPort () const
 Returns the server's port if the server is listening; otherwise returns 0. More...
 
void setTimeout (int msecs=0)
 Sets the timeout of new connections to msecs miliseconds. More...
 
int timeout () const
 Returns the current set timeout.
 
void setUpgradeHandler (UpgradeHandler functor)
 This method sets the handler that will be called to handle http upgrade requests. More...
 

Protected Member Functions

void incomingConnection (qintptr socketDescriptor) override
 
- Protected Member Functions inherited from Tufao::HttpServer
void handleConnection (QAbstractSocket *connection)
 Call this function will make Tufao::HttpServer handle the connection connection. More...
 
virtual void checkContinue (HttpServerRequest &request, HttpServerResponse &response)
 This virtual function is called by HttpServer when a client do a request with the HTTP header "Expect: 100-continue". More...
 

Additional Inherited Members

- Public Types inherited from Tufao::HttpServer
typedef std::function< void(HttpServerRequest &request, const QByteArray &)> UpgradeHandler
 A typedef to http upgrade request handler. More...
 
- Public Slots inherited from Tufao::HttpServer
void close ()
 Closes the server. More...
 
- Signals inherited from Tufao::HttpServer
void requestReady (Tufao::HttpServerRequest &request, Tufao::HttpServerResponse &response)
 This signal is emitted each time there is request. More...
 
- Static Public Member Functions inherited from Tufao::HttpServer
static UpgradeHandler defaultUpgradeHandler ()
 Returns the default http upgrade request's handler. More...
 

Detailed Description

Tufao::HttpsServer is a subclass of Tufao::HttpServer that provides secure communication with the client.

It does this using socket streams over TLS connections.

This combination (HTTP + SSL/TLS) is know as HTTP Secure and provides encrypted communication.

To use HTTPS in Tufão, just set the local certficate and private key before call Tufao::HttpsServer::listen. The default port for this protocol is 443.

Note
You should also pay to a trusted certificate authority to sign your certificate if you are willing to provide secure identification also.
The use of HTTPS implies an extra overhead in the software, limiting the number of requests that can be served per time and should be moderated. It's common to use it only in pages that handles more sensitive information, such as login pages and payment transactions.
See also
HttpsServer::setLocalCertificate HttpsServer::setPrivateKey

Member Function Documentation

void Tufao::HttpsServer::setLocalCertificate ( const QSslCertificate &  certificate)

Sets the local certificate to certificate.

Note
This member function should be called before Tufao::HttpsServer::listen
void Tufao::HttpsServer::setPrivateKey ( const QSslKey &  key)

Sets the private key to key.

Warning
Remember that encryption security relies on the fact that no one knows your private key.
Note
This member function should be called before Tufao::HttpsServer::listen

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