Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. QNetworkAccessManager SSL display request content
QtWS25 Last Chance

QNetworkAccessManager SSL display request content

Scheduled Pinned Locked Moved Unsolved General and Desktop
5 Posts 2 Posters 368 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • Alex94102A Offline
    Alex94102A Offline
    Alex94102
    wrote on last edited by
    #1

    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!!

    aha_1980A 1 Reply Last reply
    0
    • Alex94102A Alex94102

      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!!

      aha_1980A Offline
      aha_1980A Offline
      aha_1980
      Lifetime Qt Champion
      wrote on last edited by
      #2

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

      Regards

      Qt has to stay free or it will die.

      Alex94102A 1 Reply Last reply
      0
      • Alex94102A Offline
        Alex94102A Offline
        Alex94102
        wrote on last edited by
        #3
        This post is deleted!
        Alex94102A 1 Reply Last reply
        0
        • Alex94102A Alex94102

          This post is deleted!

          Alex94102A Offline
          Alex94102A Offline
          Alex94102
          wrote on last edited by
          #4
          This post is deleted!
          1 Reply Last reply
          0
          • aha_1980A aha_1980

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

            Regards

            Alex94102A Offline
            Alex94102A Offline
            Alex94102
            wrote on last edited by
            #5

            @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?

            1 Reply Last reply
            0

            • Login

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • Users
            • Groups
            • Search
            • Get Qt Extensions
            • Unsolved