Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

QNetworkAccessManager SSL display request content



  • Hello,

    does anyone knows how to display the raw content that is being sent to the server using let's say a GET or POST request via the QNetworkAccessManager? the traffic is encrypted and I cannot use a protocol analyzer. For some reason the server is complaining that it is missing some cookies, but I can pull the cookies and see that they are there. This code used to work before, and it stopped working, not sure where the issue is.

    I can see the cookie with this snippet of code:

      QList<QNetworkCookie> cs = mHttpHelper->getCookiesForUrl(url);
        qInfo() << "These are the cookies that we should are sending with this request:"<< url;
        foreach (QNetworkCookie c, cs ) {
            qInfo() << "cookieName="<< c.name()<<"="<<c.value();
        }
    

    but then if I print the raw headers:

    qDebug() << mNetworkRequest.url().toString();
    const QList<QByteArray>& rawHeaderList(mNetworkRequest.rawHeaderList());
     foreach (QByteArray rawHeader, rawHeaderList) {
       qDebug() << mNetworkRequest.rawHeader(rawHeader);
     }
    

    all it prints is these two lines (I changed the agent on purpose):
    "https://mytargetsite/blabla"
    "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/61.0.3163.100 Safari/537.36"

    If I could display the content that gets submitted, then I could figure out what the problem is....

    Thank you!!


  • Lifetime Qt Champion

    Hi @alex94102, Wireshark can decode SSL content, just google for it.

    Regards



  • This post is deleted!


  • This post is deleted!


  • @aha_1980 I want to be able to visualize the request from the QT site, there should be no reason why that shouldn't be available. Also SSL traffic cannot be decrypted unless you get a hold of the key. That would be a different problem that I shouldn't have to get into. Reasonable?


Log in to reply