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. FollowRedirectsAttribute does not work with POST requests

FollowRedirectsAttribute does not work with POST requests

Scheduled Pinned Locked Moved General and Desktop
6 Posts 2 Posters 1.7k 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.
  • W Offline
    W Offline
    Wallboy
    wrote on last edited by
    #1

    Not sure if it's a bug or intended. But I've been trying to use the QNetworkRequest::FollowRedirectsAttribute where the original request is a POST using multipart/form-data and QHttp* classes. The response is a 302 redirect and what browsers do is convert that to a GET request (Post-Get-Redirect)

    However, when making this request, the last signal that gets called is redirected() and my finished slot never gets called. It works fine with a GET request handling the redirects cleanly.

    And my final concern is if FollowRedirectsAttribute would automatically handle Set-Cookie headers on the 30X redirects and pass the cookie along to the next "Location: redirectedurl"?

    Or will I just have to use the old fashioned way of handling redirects myself using QNetworkRequest::RedirectionTargetAttribute in the finished slot?

    Thanks

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi,

      What version of Qt are you using ? On which OS ?

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      0
      • W Offline
        W Offline
        Wallboy
        wrote on last edited by
        #3

        PyQt 5.7
        Windows 7

        1 Reply Last reply
        0
        • SGaistS Offline
          SGaistS Offline
          SGaist
          Lifetime Qt Champion
          wrote on last edited by
          #4

          Looks recent enough.

          You should take a look to the bug report system to see if there's something related.

          You should also bring that to the interest mailing list. You'll find there Qt's developers/maintainers. This forum is more user oriented.

          Interested in AI ? www.idiap.ch
          Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

          1 Reply Last reply
          0
          • W Offline
            W Offline
            Wallboy
            wrote on last edited by Wallboy
            #5

            I figured out what is likely going on as I was having a related issue here: https://forum.qt.io/topic/73843/re-using-qnetworkrequest-in-finished-slot-issue

            Basically, it does seem like it will be a bug when using POST requests and FollowRedirects, because I'm guessing Qt is trying to convert the POST request to a GET request, but not removing the POST specific headers: Content-Type, Content-Length, MIME-Version and is getting confused.

            I just submitted a BUG report as well. Thanks.

            1 Reply Last reply
            0
            • SGaistS Offline
              SGaistS Offline
              SGaist
              Lifetime Qt Champion
              wrote on last edited by
              #6

              Don't forget to post the link. It will make it easier to find.

              Interested in AI ? www.idiap.ch
              Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

              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