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. Help in debugging QNetworkReply::ProtocolInvalidOperationError

Help in debugging QNetworkReply::ProtocolInvalidOperationError

Scheduled Pinned Locked Moved Solved General and Desktop
3 Posts 1 Posters 181 Views 1 Watching
  • 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.
  • R Offline
    R Offline
    Robert Hairgrove
    wrote on last edited by Robert Hairgrove
    #1

    I have been using the QtNetwork classes successfully for a few years now to forward error data from the end-user of an application I have written through the internet as an email with attached ZIP file through a small PHP script installed on the web hosting server I subscribe to. As mentioned, there were no problems until recently.

    What the script does is to recognize HEAD, GET and POST requests. The HEAD request is used only to ensure that there is a working internet connection. Then a GET request is issued which returns a small captcha quiz consisting of a trivial arithmetic operation involving three numbers separated by the pipe symbol. The PHP file sets some session variables including the expected result of the captcha quiz.

    The client, upon receiving the captcha quiz, emits a POST request containing form upload data including the ZIP file, the text of the email message, an MD5 hash of the ZIP file, and between one and five CC addresses. This has been working fine until some time this year.

    Now I am getting the error mentioned in the subject of the thread. I assume that I need to set the correct protocol for the QNetworkRequest object before submitting the POST request. For HEAD and GET, setting this to QSsl::SecureProtocols (== 4) has been working; setting it to QSsl::TlsV1_2OrLater also works for HEAD and GET, but in both cases it raises the same error mentioned for POST.

    I don't get any other output from the server. In the PHP script, I have error_reporting(E_ALL) and display_errors is turned on, so if there were a PHP error, I would expect to see something. But maybe the server has turned this off?

    Also, since I am using Qt 6.10 by now, I don't see anything of interest when I call QNetworkReply::headers(). I also connect a slot to the QNetworkManager::sslErrors() and display anything in a QMessageBox, but this slot is never called.

    Any hints as to how I can fix this?

    1 Reply Last reply
    0
    • R Offline
      R Offline
      Robert Hairgrove
      wrote on last edited by Robert Hairgrove
      #2

      Forgot to mention that the HTTP status code was 400 (Bad Request). Same thing when I don't try to set the SSL configuration manually, but just use the QNAM default.

      1 Reply Last reply
      0
      • R Offline
        R Offline
        Robert Hairgrove
        wrote on last edited by
        #3

        No wonder, there was a formatting error in the form upload data -- mea culpa! Problem solved.

        1 Reply Last reply
        1
        • R Robert Hairgrove has marked this topic as solved on

        • Login

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