FollowRedirectsAttribute does not work with POST requests
-
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
-
Hi,
What version of Qt are you using ? On which OS ?
-
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.
-
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.
-
Don't forget to post the link. It will make it easier to find.