Adding SSL flag and client certificate to web request object

This commit is contained in:
Dee Holtsclaw 2011-03-01 11:48:32 -05:00
parent 2556552e09
commit a11d78befe
3 changed files with 18 additions and 1 deletions

View File

@ -62,6 +62,9 @@ posting events. It is reentrant for all other functionality.
#include <QThread>
#include <qxtmetaobject.h>
#include <QTcpSocket>
#ifndef QT_NO_OPENSSL
#include <QSslSocket>
#endif
#ifndef QXT_DOXYGEN_RUN
class QxtHttpSessionManagerPrivate : public QxtPrivate<QxtHttpSessionManager>
@ -366,6 +369,13 @@ void QxtHttpSessionManager::incomingRequest(quint32 requestID, const QHttpReques
if (socket)
{
event->remoteAddress = socket->peerAddress().toString();
#ifndef QT_NO_OPENSSL
QSslSocket *sslsock = qobject_cast<QSslSocket*>(socket);
if(sslsock){
event->ssl = true;
event->clientCertificate = sslsock->peerCertificate();
}
#endif
}
event->method = header.method();
event->cookies = cookies;

View File

@ -90,7 +90,7 @@ browser.
* Constructs a QxtWebRequestEvent for the specified \a sessionID, \a requestID and \a url.
*/
QxtWebRequestEvent::QxtWebRequestEvent(int sessionID, int requestID, const QUrl& url)
: QxtWebEvent(QxtWebEvent::Request, sessionID), requestID(requestID), url(url), originalUrl(url) {}
: QxtWebEvent(QxtWebEvent::Request, sessionID), requestID(requestID), url(url), originalUrl(url), ssl(false) {}
/*!
* Destroys the event and any content that may still be associated with it.

View File

@ -34,6 +34,9 @@
#include <QUrl>
#include <QMultiHash>
#include <QDateTime>
#ifndef QT_NO_OPENSSL
#include <QSslCertificate>
#endif
QT_FORWARD_DECLARE_CLASS(QIODevice)
class QxtWebContent;
@ -78,6 +81,10 @@ public:
QPointer<QxtWebContent> content;
QString method;
QString remoteAddress;
#ifndef QT_NO_OPENSSL
QSslCertificate clientCertificate;
#endif
bool ssl;
QMultiHash<QString, QString> cookies;
QMultiHash<QString, QString> headers;