Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Make ignoring SSL errors an option.

webkit_server takes an --ignore-ssl-errors argument.
  • Loading branch information...
commit f57b3a3d151e18da88ae61885b266c2bcf091f62 1 parent 9cfc6b1
@rectalogic rectalogic authored halogenandtoast committed
View
3  src/Server.cpp
@@ -4,9 +4,10 @@
#include <QTcpServer>
-Server::Server(QObject *parent) : QObject(parent) {
+Server::Server(QObject *parent, bool ignoreSslErrors) : QObject(parent) {
m_tcp_server = new QTcpServer(this);
m_page = new WebPage(this);
+ m_page->setIgnoreSslErrors(ignoreSslErrors);
}
bool Server::start() {
View
2  src/Server.h
@@ -7,7 +7,7 @@ class Server : public QObject {
Q_OBJECT
public:
- Server(QObject *parent = 0);
+ Server(QObject *parent, bool ignoreSslErrors);
bool start();
quint16 server_port() const;
View
12 src/WebPage.cpp
@@ -194,9 +194,19 @@ void WebPage::replyFinished(QNetworkReply *reply) {
}
void WebPage::ignoreSslErrors(QNetworkReply *reply, const QList<QSslError> &errors) {
- reply->ignoreSslErrors(errors);
+ if (m_ignoreSslErrors)
+ reply->ignoreSslErrors(errors);
}
+void WebPage::setIgnoreSslErrors(bool ignore) {
+ m_ignoreSslErrors = ignore;
+}
+
+bool WebPage::ignoreSslErrors() {
+ return m_ignoreSslErrors;
+}
+
+
int WebPage::getLastStatus() {
return m_lastStatus;
}
View
3  src/WebPage.h
@@ -15,6 +15,8 @@ class WebPage : public QWebPage {
void setCustomNetworkAccessManager();
bool render(const QString &fileName);
virtual bool extension (Extension extension, const ExtensionOption *option=0, ExtensionReturn *output=0);
+ void setIgnoreSslErrors(bool ignore);
+ bool ignoreSslErrors();
public slots:
bool shouldInterruptJavaScript();
@@ -47,5 +49,6 @@ class WebPage : public QWebPage {
void setUserStylesheet();
int m_lastStatus;
QString m_pageHeaders;
+ bool m_ignoreSslErrors;
};
View
7 src/main.cpp
@@ -18,10 +18,15 @@ int main(int argc, char **argv) {
app.setOrganizationName("thoughtbot, inc");
app.setOrganizationDomain("thoughtbot.com");
- Server server;
+ QStringList args = app.arguments();
+ bool ignoreSslErrors = args.contains("--ignore-ssl-errors");
+
+ Server server(0, ignoreSslErrors);
if (server.start()) {
std::cout << "Capybara-webkit server started, listening on port: " << server.server_port() << std::endl;
+ if (ignoreSslErrors)
+ std::cout << "Ignoring SSL errors" << std::endl;
return app.exec();
} else {
std::cerr << "Couldn't start capybara-webkit server" << std::endl;
Please sign in to comment.
Something went wrong with that request. Please try again.