diff --git a/configure b/configure index 8d01012f..354e86f9 100755 --- a/configure +++ b/configure @@ -494,9 +494,9 @@ public: if(file.open(QIODevice::WriteOnly | QIODevice::Text)) { QTextStream stream( &file ); - stream << "#define VERSION \\"" << version << "\\"" << endl; - stream << "#define LIBDIR \\"" << libdir << "/pushpin\\"" << endl; - stream << "#define CONFIGDIR \\"" << configdir << "/pushpin\\"" << endl; + stream << "#define VERSION \\"" << version << "\\"" << Qt::endl; + stream << "#define LIBDIR \\"" << libdir << "/pushpin\\"" << Qt::endl; + stream << "#define CONFIGDIR \\"" << configdir << "/pushpin\\"" << Qt::endl; } conf->addDefine("HAVE_CONFIG"); @@ -737,10 +737,15 @@ QStringList qc_pathlist() QStringList list; QString path = qc_getenv("PATH"); if (!path.isEmpty()) { +#if QT_VERSION >= 0x060000 + Qt::SplitBehavior flags = Qt::SkipEmptyParts; +#else + QString::SplitBehavior flags = QString::SkipEmptyParts; +#endif #ifdef Q_OS_WIN - list = path.split(';', QString::SkipEmptyParts); + list = path.split(';', flags); #else - list = path.split(':', QString::SkipEmptyParts); + list = path.split(':', flags); #endif } #ifdef Q_OS_WIN diff --git a/qcm/conf.qcm b/qcm/conf.qcm index 9cdc4a31..20febe75 100644 --- a/qcm/conf.qcm +++ b/qcm/conf.qcm @@ -74,9 +74,9 @@ public: if(file.open(QIODevice::WriteOnly | QIODevice::Text)) { QTextStream stream( &file ); - stream << "#define VERSION \"" << version << "\"" << endl; - stream << "#define LIBDIR \"" << libdir << "/pushpin\"" << endl; - stream << "#define CONFIGDIR \"" << configdir << "/pushpin\"" << endl; + stream << "#define VERSION \"" << version << "\"" << Qt::endl; + stream << "#define LIBDIR \"" << libdir << "/pushpin\"" << Qt::endl; + stream << "#define CONFIGDIR \"" << configdir << "/pushpin\"" << Qt::endl; } conf->addDefine("HAVE_CONFIG"); diff --git a/src/corelib/statsmanager.cpp b/src/corelib/statsmanager.cpp index 43b1f447..1618657d 100644 --- a/src/corelib/statsmanager.cpp +++ b/src/corelib/statsmanager.cpp @@ -35,7 +35,6 @@ #include "log.h" #include "tnetstring.h" #include "httpheaders.h" -#include "packet/statspacket.h" #include "simplehttpserver.h" #include "zutil.h" diff --git a/src/corelib/statsmanager.h b/src/corelib/statsmanager.h index e4af0790..aebcd751 100644 --- a/src/corelib/statsmanager.h +++ b/src/corelib/statsmanager.h @@ -25,12 +25,11 @@ #define STATSMANAGER_H #include +#include "packet/statspacket.h" #include "stats.h" class QHostAddress; -class StatsPacket; - class StatsManager : public QObject { Q_OBJECT diff --git a/src/corelib/zutil.cpp b/src/corelib/zutil.cpp index 35555a54..d5aab23c 100644 --- a/src/corelib/zutil.cpp +++ b/src/corelib/zutil.cpp @@ -22,7 +22,6 @@ #include "zutil.h" -#include #include #include "qzmqsocket.h" diff --git a/src/corelib/zutil.h b/src/corelib/zutil.h index d6fde023..0650cef8 100644 --- a/src/corelib/zutil.h +++ b/src/corelib/zutil.h @@ -23,8 +23,8 @@ #ifndef ZUTIL_H #define ZUTIL_H -class QString; -class QStringList; +#include +#include namespace QZmq { diff --git a/src/handler/engine.cpp b/src/handler/engine.cpp index fd103b14..f7c2822e 100644 --- a/src/handler/engine.cpp +++ b/src/handler/engine.cpp @@ -1078,6 +1078,10 @@ class AcceptWorker : public Deferred // take over responsibility for request ZhttpRequest *httpReq = zhttpIn->createRequestFromState(ss); + QSet implicitChannelsSet; + foreach(const QString &channel, implicitChannels) + implicitChannelsSet += channel; + HttpSession::AcceptData adata; adata.requestData = origRequestData; adata.logicalPeerAddress = rs.logicalPeerAddress; @@ -1090,7 +1094,7 @@ class AcceptWorker : public Deferred adata.route = route; adata.statsRoute = statsRoute; adata.channelPrefix = channelPrefix; - adata.implicitChannels = implicitChannels.toSet(); + adata.implicitChannels = implicitChannelsSet; adata.sid = sid; adata.responseSent = responseSent; adata.trusted = trusted; diff --git a/src/proxy/proxyutil.cpp b/src/proxy/proxyutil.cpp index cfae4af9..ebc06487 100644 --- a/src/proxy/proxyutil.cpp +++ b/src/proxy/proxyutil.cpp @@ -33,7 +33,7 @@ static QByteArray make_token(const QByteArray &iss, const Jwt::EncodingKey &key) { QVariantMap claim; claim["iss"] = QString::fromUtf8(iss); - claim["exp"] = QDateTime::currentDateTimeUtc().toTime_t() + 3600; + claim["exp"] = QDateTime::currentDateTimeUtc().toSecsSinceEpoch() + 3600; return Jwt::encode(claim, key); } @@ -46,7 +46,7 @@ static bool validate_token(const QByteArray &token, const Jwt::DecodingKey &key) QVariantMap claim = claimObj.toMap(); int exp = claim.value("exp").toInt(); - if(exp <= 0 || (int)QDateTime::currentDateTimeUtc().toTime_t() >= exp) + if(exp <= 0 || (int)QDateTime::currentDateTimeUtc().toSecsSinceEpoch() >= exp) return false; return true; diff --git a/src/proxy/routesfile.cpp b/src/proxy/routesfile.cpp index e5c8a28c..23b7b0b2 100644 --- a/src/proxy/routesfile.cpp +++ b/src/proxy/routesfile.cpp @@ -138,7 +138,7 @@ class LineParser else { Token token(Token::Error); - token.value = "unexpected escape character: " + str_[at]; + token.value = QString("unexpected escape character: ") + str_[at]; return token; } } diff --git a/src/proxy/testhttprequest.cpp b/src/proxy/testhttprequest.cpp index bbcf4bb1..83e6bace 100644 --- a/src/proxy/testhttprequest.cpp +++ b/src/proxy/testhttprequest.cpp @@ -110,7 +110,7 @@ public slots: response.reason = StatusReasons::getReason(response.code); response.headers += HttpHeader("Content-Type", "text/plain"); response.headers += HttpHeader("Grip-Hold", "response"); - response.headers += HttpHeader("Grip-Channel", QStringList(channels.toList()).join(", ").toUtf8()); + response.headers += HttpHeader("Grip-Channel", QStringList(channels.values()).join(", ").toUtf8()); responseBody += QByteArray("nothing for now\n"); } else if(path == "/stream") @@ -119,7 +119,7 @@ public slots: response.reason = StatusReasons::getReason(response.code); response.headers += HttpHeader("Content-Type", "text/plain"); response.headers += HttpHeader("Grip-Hold", "stream"); - response.headers += HttpHeader("Grip-Channel", QStringList(channels.toList()).join(", ").toUtf8()); + response.headers += HttpHeader("Grip-Channel", QStringList(channels.values()).join(", ").toUtf8()); responseBody += QByteArray("[stream opened]\n"); } else diff --git a/src/runner/mongrel2service.cpp b/src/runner/mongrel2service.cpp index 7d4bb7c9..694e1202 100644 --- a/src/runner/mongrel2service.cpp +++ b/src/runner/mongrel2service.cpp @@ -186,19 +186,25 @@ QString Mongrel2Service::formatLogLine(const QString &line) const { return filterLogLine(LOG_LEVEL_WARNING, "Can't parse mongrel2 log: " + line); } - if(line.midRef(at + 1, end - at - 1) == "DEBUG") + +#if QT_VERSION >= 0x060000 + QStringView s = QStringView(line).mid(at + 1, end - at - 1); +#else + QStringRef s = line.midRef(at + 1, end - at - 1); +#endif + if(s.compare(QLatin1String("DEBUG")) == 0) { level = LOG_LEVEL_DEBUG; } - else if(line.midRef(at + 1, end - at - 1) == "INFO") + else if(s.compare(QLatin1String("INFO")) == 0) { level = LOG_LEVEL_INFO; } - else if(line.midRef(at + 1, end - at - 1) == "ERROR") + else if(s.compare(QLatin1String("ERROR")) == 0) { level = LOG_LEVEL_ERROR; } - else if(line.midRef(at + 1, end - at - 1) == "WARN") + else if(s.compare(QLatin1String("WARN")) == 0) { level = LOG_LEVEL_WARNING; } diff --git a/src/runner/service.cpp b/src/runner/service.cpp index a63ac6c2..b37cfb7f 100644 --- a/src/runner/service.cpp +++ b/src/runner/service.cpp @@ -32,6 +32,17 @@ #define STOP_TIMEOUT 4000 +static void setupChild() +{ + signal(SIGINT, SIG_IGN); + + // subprocesses hopefully respect SIG_IGN, but are not required + // to. in case subprocess might reinstate a SIGINT handler, + // detach from process group to ensure ctrl-c in a shell + // doesn't cause SIGINT to be sent directly to subprocesses + setpgid(0, 0); +} + class ServiceProcess : public QProcess { Q_OBJECT @@ -40,19 +51,18 @@ class ServiceProcess : public QProcess ServiceProcess(QObject *parent = 0) : QProcess(parent) { +#if QT_VERSION >= 0x060000 + setChildProcessModifier(setupChild); +#endif } +#if QT_VERSION < 0x060000 // reimplemented virtual void setupChildProcess() { - signal(SIGINT, SIG_IGN); - - // subprocesses hopefully respect SIG_IGN, but are not required - // to. in case subprocess might reinstate a SIGINT handler, - // detach from process group to ensure ctrl-c in a shell - // doesn't cause SIGINT to be sent directly to subprocesses - setpgid(0, 0); + setupChild(); } +#endif }; class Service::Private : public QObject