PDA

View Full Version : How to redirect to a URL in Qt



xyz
12th August 2010, 12:47
Hi

If the url you give redirects to some other URL then how to fetch the redirected URL.
Please provide some Qt Apis to be used on Linux

bmesing
12th August 2010, 20:18
The QNetworkReply/QNetworkRequest seems to help you there (use it together with the QNetworkAccessManager):

"QNetworkReply::NoError 0 no error condition. Note: When the HTTP protocol returns a redirect no error will be reported. You can check if there is a redirect with the QNetworkRequest::RedirectionTargetAttribute attribute."

Hope you can figure the rest out by yourself (I have never used it..)

Talei
12th August 2010, 21:10
I assume You use QTcpSocket
302 reply aka redirection contains new URL, simply paresout that information close current connection and connect to the new host or simply do new GET request if it is same host.

zgulser
29th March 2012, 22:26
Is it possible to do this through QtWebKit module?

wysota
29th March 2012, 22:48
QtWebKit uses QNetworkAccessManager for its networking capabilities. It should handle redirects automatically.

zgulser
29th March 2012, 23:28
Well I have implementing interfaces to fetch gmail and msn accounts.

Gmail interface works ok and loadFinished(ok) ok is true.

MSN interface is a bit problematic.. It's loadFinished(ok) ok is false.

I checked from the browser that the msn link is redirected.

Moreover does the problem could be from cookies(disabled/enabled stuff)?

Note: Oh by the way, i'm using qt 4.4.

wysota
29th March 2012, 23:33
Redirection seems to work fine for me on bare QWebView dragged to a form in Designer (using http://doc.qt.nokia.com/latest as a URL which redirects to a different page).

zgulser
30th March 2012, 00:11
Do cookie enabling/disabling have anything to do with this stuff?

By the way in designer it worked fro me either. But from the source I just couldn't. It may be queuing signal-slot issue perhaps.

Added after 34 minutes:

I explored the web and found something like the following link refers to.

https://bugreports.qt-project.org/browse/QTBUG-18275?page=com.atlassian.streams.streams-jira-plugin:activity-stream-issue-tab

it didn't mention the version t

zgulser
30th March 2012, 08:39
the url that's nor loading is;

http://192.168.20.44:8080/thirdpartyconnector/ASNGW/LoginServlet?uri=alper.ozdamar@turktelekom.com.tr&community=messenger.live.com&action=oauth