Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8473227
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T17:17:29+00:00 2026-06-10T17:17:29+00:00

I’m writing a C++ application using Qt framework that needs to download a file

  • 0

I’m writing a C++ application using Qt framework that needs to download a file from SourceForge.

I have to download this file https://sourceforge.net/projects/meshlab/files/updates/1.3.3/updates.xml

I wrote the following code using Qt and the QHttp class:

QFile tmpfile;
int hostreqid;
int checkreqid;
...
...
tmpfile.setFileName("updates.xml");
hostreqid = http.setHost("sourceforge.net",QHttp::ConnectionModeHttp);
checkreqid = http.get(QString(QUrl::toPercentEncoding("/projects/meshlab/files/updates/1.3.3/updates.xml")),&tmpfile);
...
...
void parseAnswer( int id,bool error )
{
    if (!error && (id == checkreqid))
    {
            ...
        tmpfile.close();
    }
    if (error)
    {
        QHttp::Error err = http.error();
        QString errstrg = http.errorString();
    }
}

Both QHttp::setHost and QHttp::get are not blocking functions returning immediately an int id. When the http file transfer completed the parseAnswer function is automatically called.
The problem is that inside the updates.xml file I got, instead the data I was expecting I received an html file from SouceForge reporting an “Invalid Project” error.

I noticed that when I access the https://sourceforge.net/projects/meshlab/files/updates/1.3.3/updates.xml from browser I have been redirected to https://sourceforge.net/projects/meshlab/files/updates/1.3.3/updates.xml/download page. I tried also this other address but nothing changed.

Please, notice that I’m using Http protocol (QHttp::ConnectionModeHttp) instead of the https. If I could I would wish to avoid to use the https. Can be the source of the problem?

Thanks a lot!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-10T17:17:31+00:00Added an answer on June 10, 2026 at 5:17 pm

    I got the answer in another forum (thanks to AcerExtensa…I don’t know his real name). Looks like the problem was that I missed to handle the sourceforge redirection.
    I posted here his reply:

    #ifndef SFORGE_H
    #define SFORGE_H
    
    #include <QNetworkAccessManager>
    #include <QNetworkReply>
    
    class SForge : public QNetworkAccessManager
    {
        Q_OBJECT
    public:
        explicit SForge(QObject *parent = 0);
    
    
    private slots:
        void fin(QNetworkReply *);
    
    };
    
    #endif // SFORGE_H
    code:
    #include "sforge.h"
    #include <QDateTime>
    #include <QUrl>
    #include <QNetworkRequest>
    #include <QDebug>
    
    SForge::SForge(QObject *parent):QNetworkAccessManager(parent)
    {
        QUrl url("http://downloads.sourceforge.net/project/meshlab/updates/1.3.3/updates.xml?r=&ts="+QString::number(QDateTime::currentDateTime().toTime_t())+"&use_mirror=heanet");
    
        connect(this, SIGNAL(finished(QNetworkReply*)), this, SLOT(fin(QNetworkReply*)));
    
        QNetworkRequest req(url);
        this->get(req);
    }
    
    void SForge::fin(QNetworkReply * reply)
    {
        if(reply->error() != QNetworkReply::NoError)
            qDebug() << reply->errorString();
    
        if(reply->attribute(QNetworkRequest::HttpStatusCodeAttribute).toInt() == 307 || reply->rawHeaderList().contains("Location"))
        {
            QNetworkRequest req(reply->header(QNetworkRequest::LocationHeader).toString());
            this->get(req);
            return;
        }
    
        qDebug() << __LINE__ << reply->bytesAvailable() << reply->readAll();
    }
    

    Thanks a lot to the ones who tried to help me!

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I have a .ini file as follows: [playlist] numberofentries=2 File1=http://87.230.82.17:80 Title1=(#1 - 365/1400) Example
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I have just tried to save a simple *.rtf file with some websites and
For some reason, after submitting a string like this Jack’s Spindle from a text
this is what i have right now Drawing an RSS feed into the php,
I have this code to decode numeric html entities to the UTF8 equivalent character.
I have a French site that I want to parse, but am running into
I have this code: - (void)parser:(NSXMLParser *)parser foundCDATA:(NSData *)CDATABlock { NSString *someString = [[NSString

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.