PDA

View Full Version : Html Redirect with wait time!



srazi
22nd May 2012, 15:53
I want download a file using QNetworkAccessManager, I use 'HTTP Client' example from Qt's networking examples.
You can use that for test by yourself.
For example I want to download "http://sourceforge.net/projects/ganjoor/files/gdb/rhi-mEiri.zip" and application recognize first redirect and ask about redirecting.(for this example it redirects to: "http://sourceforge.net/projects/ganjoor/files/gdb/rhi-mEiri.zip/download")
Now, this page contains:


<meta http-equiv="refresh" content="5; url=http://downloads.sourceforge.net/project/ganjoor/gdb/rhi-mEiri.zip?r=&amp;ts=1337697681&amp;use_mirror=garr">

but unfortunately 'HTTP Client' doesn't recognize this one and download that html page!(i.e.: "http://sourceforge.net/projects/ganjoor/files/gdb/rhi-mEiri.zip/download")
Is there a way to recognize the last redirection? (or for example I must read the downloaded data and search for html redirection meta info!)

wysota
22nd May 2012, 23:30
You must read the downloaded data and search for the redirection or use a web browser (such as QWebPage) that will do it for you.