[Interest] Can't download file with QNetworkAccessManager: "connection closed"

Thiago Macieira thiago.macieira at intel.com
Sun Jun 8 01:57:47 CEST 2014


Em dom 08 jun 2014, às 02:49:53, Nikos Chantziaras escreveu:
> I have a weird problem. I am unable to download a file from a specific 
> server (ran by sourceforge) using QNetworkAccessManager and 
> QNetworkRequest. Example:
> 
> 
>    this->fNetManager = new QNetworkAccessManager(this);
>    connect(this->fNetManager, SIGNAL(finished(QNetworkReply*)),
>            SLOT(fReplyFinished(QNetworkReply*)));
> 
>    QNetworkRequest request(QUrl("http://qtads.sf.net/COPYING"));
> 
>    this->fReply = this->fNetManager->get(request);
>    connect(this->fReply, SIGNAL(error(QNetworkReply::NetworkError)),
>            SLOT(fErrorOccurred(QNetworkReply::NetworkError)));

How are you handling the redirection?

$ curl -D - http://qtads.sf.net/COPYING
HTTP/1.1 302 Found
Server: Apache/2.2.15 (CentOS)
Location: http://qtads.sourceforge.net/COPYING
Cache-Control: max-age=172800
Expires: Mon, 09 Jun 2014 23:57:35 GMT
Content-Type: text/html; charset=iso-8859-1
Content-Length: 298
Date: Sat, 07 Jun 2014 23:57:35 GMT
X-Varnish: 1237204318
Age: 0
Via: 1.1 varnish
Connection: keep-alive

<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html><head>
<title>302 Found</title>
</head><body>
<h1>Found</h1>
<p>The document has moved <a 
href="http://qtads.sourceforge.net/COPYING">here</a>.</p>
<hr>
<address>Apache/2.2.15 (CentOS) Server at qtads.sf.net Port 80</address>
</body></html>

-- 
Thiago Macieira - thiago.macieira (AT) intel.com
  Software Architect - Intel Open Source Technology Center




More information about the Interest mailing list