Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Downloadproblem because of meta refresh
Qt 6.11 is out! See what's new in the release blog

Downloadproblem because of meta refresh

Scheduled Pinned Locked Moved General and Desktop
7 Posts 2 Posters 3.0k Views 1 Watching
  • 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.
  • D Offline
    D Offline
    d4ex
    wrote on last edited by
    #1

    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 :)

    1 Reply Last reply
    0
    • raven-worxR Offline
      raven-worxR Offline
      raven-worx
      Moderators
      wrote on last edited by
      #2

      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.

      --- SUPPORT REQUESTS VIA CHAT WILL BE IGNORED ---
      If you have a question please use the forum so others can benefit from the solution in the future

      1 Reply Last reply
      0
      • D Offline
        D Offline
        d4ex
        wrote on last edited by
        #3

        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);
        @

        1 Reply Last reply
        0
        • D Offline
          D Offline
          d4ex
          wrote on last edited by
          #4

          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 :(

          1 Reply Last reply
          0
          • raven-worxR Offline
            raven-worxR Offline
            raven-worx
            Moderators
            wrote on last edited by
            #5

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

            --- SUPPORT REQUESTS VIA CHAT WILL BE IGNORED ---
            If you have a question please use the forum so others can benefit from the solution in the future

            1 Reply Last reply
            0
            • D Offline
              D Offline
              d4ex
              wrote on last edited by
              #6

              I think thats the Problem and i will check it.

              For now, thanks for the help :)

              1 Reply Last reply
              0
              • D Offline
                D Offline
                d4ex
                wrote on last edited by
                #7

                Got it! :)

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

                1 Reply Last reply
                0

                • Login

                • Login or register to search.
                • First post
                  Last post
                0
                • Categories
                • Recent
                • Tags
                • Popular
                • Users
                • Groups
                • Search
                • Get Qt Extensions
                • Unsolved