@@ -49,9 +49,10 @@
|
||||
#include <QSslSocket>
|
||||
#include <QDateTime>
|
||||
|
||||
LocalRedirectServer::LocalRedirectServer(const bool https, QObject *parent)
|
||||
LocalRedirectServer::LocalRedirectServer(QObject *parent)
|
||||
: QTcpServer(parent),
|
||||
https_(https),
|
||||
https_(false),
|
||||
port_(0),
|
||||
socket_(nullptr)
|
||||
{}
|
||||
|
||||
@@ -232,7 +233,7 @@ bool LocalRedirectServer::Listen() {
|
||||
if (https_) {
|
||||
if (!GenerateCertificate()) return false;
|
||||
}
|
||||
if (!listen(QHostAddress::LocalHost)) {
|
||||
if (!listen(QHostAddress::LocalHost, port_)) {
|
||||
error_ = errorString();
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -38,9 +38,11 @@ class LocalRedirectServer : public QTcpServer {
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit LocalRedirectServer(const bool https, QObject* parent = nullptr);
|
||||
explicit LocalRedirectServer(QObject *parent = nullptr);
|
||||
~LocalRedirectServer();
|
||||
|
||||
void set_https(const bool https) { https_ = https; }
|
||||
void set_port(const int port) { port_ = port; }
|
||||
bool Listen();
|
||||
const QUrl &url() const { return url_; }
|
||||
const QUrl &request_url() const { return request_url_; }
|
||||
@@ -65,6 +67,7 @@ class LocalRedirectServer : public QTcpServer {
|
||||
|
||||
private:
|
||||
bool https_;
|
||||
int port_;
|
||||
QUrl url_;
|
||||
QUrl request_url_;
|
||||
QSslCertificate ssl_certificate_;
|
||||
|
||||
Reference in New Issue
Block a user