Downloadproblem because of meta refresh



  • Hello.

    I have a Problem with downloading in qt via QNetworkAccessManager.

    I successfully login. After that i request a Filelist in xml. But what i get back is this:
    @
    <html>
    <head>
    <title>Extranet Filetransfer</title>
    <meta http-equiv="refresh" content="1;url=Startup.do" />
    <meta http-equiv="content-type" content="text/html; charset=ISO-8859-1">
    <meta http-equiv="Content-Style-Type" content="text/css">
    <link rel="shortcut icon" href="/FT/navigation/extranet/images/favicon.ico" type="image/x-icon">
    <link rel="icon" href="/FT/navigation/extranet/images/favicon.ico" type="image/x-icon">
    <!-- Frameset definieren -->
    </head>

    <frameset rows="80,20,*" border="0" frameborder="no" framespacing="0">
    <frame src="startup/navigationHead.html" name="navi_head" noresize="noresize" marginheight="0" marginwidth="0" scrolling="no">
    <frame src="startup/navigationSubHead.htm" name="navi_subhead" noresize="noresize" marginheight="0" marginwidth="0" scrolling="no">

    <frameset cols="190, *">
    <frame src="startup/navigationBar.html" name="navi_bar" noresize="noresize" marginwidth="0" marginheight="0" scrolling="auto">
    <frame src="startup/navigationContent.html" name="content" noresize="noresize" marginwidth="0" marginheight="0" scrolling="auto">
    </frameset>
    </frameset>
    </html>
    @

    The Site refresh and goes to https://... /Startup.do. Now I dont know what to do. I make a Request to https://.../Startup.do but i get nothing back. What is the ".do" extension?

    Thank's for help :)


  • Moderators

    Are you using the same QNetworkAccessManager instance for all requests?

    Also make sure that you have a Qt version compiled with OpenSSL support and that the OpenSSL libraries are available and loaded by the application.
    And check the ssl errors of the response.



  • Yes i use the same QNetworkAccessManager for all Requests...

    OpenSSL is not the Problem it works fine.

    This is the code i use to make a request to Startup.do:

    @
    QNetworkRequest Request(reply->url().toString().append("Startup.do"));

    Request.setHeader(QNetworkRequest::ContentTypeHeader,"application/x-www-form-urlencoded");
    Request.setHeader(QNetworkRequest::CookieHeader, VCookies);

    NetworkAccessManager()->get(Request);
    @



  • Then i get a reply and i use this Method to download the file:
    @
    bool Download::SaveToDisk(const QString& QSFileName, QIODevice* data) const
    {
    QFile File(QSFileName);

    QFileInfo Info(File);
    qDebug() << Info.absoluteFilePath();

    if (!File.open(QIODevice::WriteOnly))
    {
    qCritical() << QString("[DownloadManager] Could not open file %1. Error: %2")
    .arg(QSFileName)
    .arg(File.errorString());
    return false;
    }

    File.write(data->readAll());
    File.close();

    qDebug() << QString("[DownloadManager] File %1 written").arg(QSFileName);

    return true;
    }
    @

    But the file is empty :(


  • Moderators

    did you check if
    @reply->url().toString().append("Startup.do")@
    results in a correct url?



  • I think thats the Problem and i will check it.

    For now, thanks for the help :)



  • Got it! :)

    You were right the url was wrong. Hours of my life wasted :/


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.