QGIS API Documentation  3.6.0-Noosa (5873452)
Public Member Functions | List of all members
QgsSslErrorHandler Class Reference

SSL error handler, used for responding to SSL errors encountered during network requests. More...

#include <qgsnetworkaccessmanager.h>

Public Member Functions

virtual ~QgsSslErrorHandler ()=default
 
virtual void handleSslErrors (QNetworkReply *reply, const QList< QSslError > &errors)
 Called whenever SSL errors are encountered during a network reply. More...
 

Detailed Description

SSL error handler, used for responding to SSL errors encountered during network requests.

QgsSslErrorHandler responds to SSL errors encountered during network requests. The base QgsSslErrorHandler class responds to SSL errors only by logging the errors, and uses the default Qt response, which is to abort the request.

Subclasses can override this behavior by implementing their own handleSslErrors() method. QgsSslErrorHandlers are ONLY ever called from the main thread, so it is safe to utilize gui widgets and dialogs during handleSslErrors (e.g. to present prompts to users notifying them of the errors and asking them to choose the appropriate response.).

If a reply is coming from background thread, that thread is blocked while handleSslErrors() is running.

If the errors should be ignored and the request allowed to proceed, the subclasses' handleSslErrors() method MUST call QNetworkReply::ignoreSslErrors() on the specified QNetworkReply object.

An application instance can only have a single SSL error handler. The current SSL error handler is set by calling QgsNetworkAccessManager::setSslErrorHandler(). By default an instance of the logging-only QgsSslErrorHandler base class is used.

Since
QGIS 3.6

Definition at line 169 of file qgsnetworkaccessmanager.h.

Constructor & Destructor Documentation

◆ ~QgsSslErrorHandler()

virtual QgsSslErrorHandler::~QgsSslErrorHandler ( )
virtualdefault

Member Function Documentation

◆ handleSslErrors()

void QgsSslErrorHandler::handleSslErrors ( QNetworkReply *  reply,
const QList< QSslError > &  errors 
)
virtual

Called whenever SSL errors are encountered during a network reply.

Subclasses should reimplement this method to implement their own logic regarding whether or not these SSL errors should be ignored, and how to present them to users.

The base class method just logs errors and leaves the default Qt response to SSL errors, which is to abort the network request on any errors.

Definition at line 659 of file qgsnetworkaccessmanager.cpp.


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