Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Unsolved

    Update: Forum Guidelines & Code of Conduct


    Qt World Summit: Early-Bird Tickets

    FollowRedirectsAttribute does not work with POST requests

    General and Desktop
    2
    6
    1367
    Loading More Posts
    • 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
      Wallboy last edited by

      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 Reply Quote 0
      • SGaist
        SGaist Lifetime Qt Champion last edited by

        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 Reply Quote 0
        • W
          Wallboy last edited by

          PyQt 5.7
          Windows 7

          1 Reply Last reply Reply Quote 0
          • SGaist
            SGaist Lifetime Qt Champion last edited by

            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 Reply Quote 0
            • W
              Wallboy last edited by Wallboy

              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 Reply Quote 0
              • SGaist
                SGaist Lifetime Qt Champion last edited by

                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 Reply Quote 0
                • First post
                  Last post