Loading client/publishclient.cpp +9 −4 Changes for client/publishclient.cpp: 9 added lines, 4 removed lines. Original line number Diff line number Diff line Loading @@ -79,13 +79,18 @@ void PublishClient::testConnection(Callback cb) { connect(reply, &QNetworkReply::finished, this, [this, reply, cb]() { if (_activeReply == reply) _activeReply = nullptr; reply->deleteLater(); int status = reply->attribute(QNetworkRequest::HttpStatusCodeAttribute).toInt(); if (reply->error() == QNetworkReply::OperationCanceledError) { cb(false, "Aborted"); } else if (reply->error() != QNetworkReply::NoError && status == 0) { cb(false, reply->errorString()); return; } /* Any HTTP response (even 401/403) means the server is reachable. Only true network errors (DNS, refused, timeout) with no HTTP status should be treated as failures. */ int status = reply->attribute(QNetworkRequest::HttpStatusCodeAttribute).toInt(); if (reply->error() == QNetworkReply::NoError || status > 0) { cb(true, "Server reachable (HTTP " + QString::number(status) + ")"); } else { cb(true, "Server reachable"); cb(false, reply->errorString()); } }); } Loading Loading
client/publishclient.cpp +9 −4 Changes for client/publishclient.cpp: 9 added lines, 4 removed lines. Original line number Diff line number Diff line Loading @@ -79,13 +79,18 @@ void PublishClient::testConnection(Callback cb) { connect(reply, &QNetworkReply::finished, this, [this, reply, cb]() { if (_activeReply == reply) _activeReply = nullptr; reply->deleteLater(); int status = reply->attribute(QNetworkRequest::HttpStatusCodeAttribute).toInt(); if (reply->error() == QNetworkReply::OperationCanceledError) { cb(false, "Aborted"); } else if (reply->error() != QNetworkReply::NoError && status == 0) { cb(false, reply->errorString()); return; } /* Any HTTP response (even 401/403) means the server is reachable. Only true network errors (DNS, refused, timeout) with no HTTP status should be treated as failures. */ int status = reply->attribute(QNetworkRequest::HttpStatusCodeAttribute).toInt(); if (reply->error() == QNetworkReply::NoError || status > 0) { cb(true, "Server reachable (HTTP " + QString::number(status) + ")"); } else { cb(true, "Server reachable"); cb(false, reply->errorString()); } }); } Loading