error with http request: 99

Issue #18 resolved
Victor Sklyar created an issue

what is it?

thx

Comments (14)

  1. Matt Broadstone

    @vinnitu well, you haven't given me much to go on here, but I'm guessing it's one of these, and specifically QNetworkReply::UnknownNetworkError

  2. Victor Sklyar reporter

    ok, maybe... but I have question about this snippet

    --- qjsonrpchttpclient.cpp ---

        void networkReplyFinished()
        {
            Q_D(QJsonRpcHttpReply);
            QNetworkReply *reply = qobject_cast<QNetworkReply*>(sender());
            if (!reply) {
                qJsonRpcDebug() << Q_FUNC_INFO << "invalid reply";
                return;
            }
    
            if (reply->error() != QNetworkReply::NoError) {
                // this should be handled by the networkReplyError slot
            } else {
                QByteArray data = reply->readAll();
                QJsonDocument doc = QJsonDocument::fromJson(data);
                if (doc.isEmpty() || doc.isNull() || !doc.isObject()) {
                    d->response =
                        d->request.createErrorResponse(QJsonRpc::ParseError,
                                                       "unable to process incoming JSON data",
                                                       QString::fromUtf8(data));
                } else {
                    qJsonRpcDebug() << "received: " << doc.toJson();
                    QJsonRpcMessage response = QJsonRpcMessage::fromObject(doc.object());
                    Q_EMIT messageReceived(response); // <-------------------- here we emit event without test request.id == response.id
    
                    if (d->request.type() == QJsonRpcMessage::Request &&
                        d->request.id() != response.id()) {
                        d->response =
                            d->request.createErrorResponse(QJsonRpc::InternalError,   // <------------------ called if inside messageResponse() somebody change response.id, am i right?
                                                           "invalid response id", //<---------------------- maybe me need do it before Q_EMIT ?
                                                           QString::fromUtf8(data));
                    } else {
                        d->response = response;
                    }
                }
            }
    
            Q_EMIT finished();
        }
    
  3. Matt Broadstone

    @vinnitu as you can see here, if there is an error it defers it to the networkReplyError. That's where you are getting the error from.

    Can you please try to give an explanation of what you are experiencing. If its indeed a bug I would be interested in helping fix it, but as far as I can tell right now this is a problem with QNetworkAccessManager (maybe the url you are specifying is malformed?). Post some code!

  4. Matt Broadstone

    @vinnitu for instance, you can see here that the reply's errorString is also passed to the error that comes back, can you give me that information?

  5. Victor Sklyar reporter

    can't because app doesn't work on remote pc, but works perfectly on my now I think about debug code to send tester

  6. Matt Broadstone

    @vinnitu if the user is able to send you this message "error with http request: 99", then that is the "message" member of the error object. "code" will be "InternalError"(-32603), and then there is a final member called "data" will which contain the QNetworkReply error that will give you probably everything you need to debug the issue

  7. Victor Sklyar reporter

    I use invokeRemoteMethodBlocking() and receive QJSonRpcMessage as result, what do you interesting to see in this case? message->toString() ?

  8. Matt Broadstone
    QJsonRpcMessage response = client->invokeRemoteMethodBlocking(....);
    if (response.type() == QJsonRpcMessage::Error) {
       qDebug() << "received error:" << endl
                << "\tcode: " << response.errorCode() << endl
                << "\tmessage: " << response.errorMessage() << endl
                << "\tdata: " << response.errorData();
    
        // OR
    
        qDebug() << response.toObject().value("error");
    }
    
  9. Matt Broadstone
  10. Victor Sklyar reporter

    seems it was network trouble after admin hack (I don't known what - something like 'exception in transparent proxy for destination host') it works properly

    BTW, thank You very much for your help

  11. Log in to comment