void SeafileApiClient::httpRequestFinished() { int code = reply_->attribute(QNetworkRequest::HttpStatusCodeAttribute).toInt(); if (code == 0 && reply_->error() != QNetworkReply::NoError) { if (!shouldIgnoreRequestError(reply_)) { qDebug("[api] network error: %s\n", reply_->errorString().toUtf8().data()); } emit networkError(reply_->error(), reply_->errorString()); return; } if (handleHttpRedirect()) { return; } if ((code / 100) == 4 || (code / 100) == 5) { if (!shouldIgnoreRequestError(reply_)) { qDebug("request failed for %s: status code %d\n", reply_->url().toString().toUtf8().data(), code); } emit requestFailed(code); return; } emit requestSuccess(*reply_); }
void SeafileApiClient::httpRequestFinished() { int code = reply_->attribute(QNetworkRequest::HttpStatusCodeAttribute).toInt(); if (code == 0 && reply_->error() != QNetworkReply::NoError) { if (NetworkManager::instance()->shouldRetry(reply_->error())) { qWarning("[api] network proxy error, retrying\n"); resendRequest(reply_->url()); return; } if (!shouldIgnoreRequestError(reply_)) { qWarning("[api] network error for %s: %s\n", toCStr(reply_->url().toString()), reply_->errorString().toUtf8().data()); } emit networkError(reply_->error(), reply_->errorString()); return; } if (handleHttpRedirect()) { return; } if ((code / 100) == 4 || (code / 100) == 5) { if (!shouldIgnoreRequestError(reply_)) { QByteArray content = reply_->readAll(); qWarning("request failed for %s: %s\n", reply_->url().toString().toUtf8().data(), content.left(kMaxHttpErrorLogLen).data()); if (content.length() > kMaxHttpErrorLogLen) { qDebug("request failed for %s: %s\n", reply_->url().toString().toUtf8().data(), content.data()); } } emit requestFailed(code); return; } emit requestSuccess(*reply_); }