[Interest] Debugging tip for QNetworkReply

Mandeep Sandhu mandeepsandhu.chd at gmail.com
Mon May 5 09:40:41 CEST 2014

So there's a sizable difference between the file that works (600KB)
and the one that doesn't (55MB).

* Could it be a memory issue on your system? Have you tested higher
sizes after which it starts failing?
* What does reply->error() return when this problem occurs (you had
mentioned the error 'string', but not the exact error code)?
* Does the webserver run on the same machine or is it over the network?
* What HTTP status code does the webserver respond with for the failed
request (it'll probably be there in the logs)

If it's possible, you could run a packet sniffer and check which side
(client or server) closes the connection first.

Also, it's best to check reply->error() before proceeding to write the file.


On Mon, May 5, 2014 at 1:12 AM, Jason Kretzer <Jason at gocodigo.com> wrote:
> Windows 7 Professional
> Qt V5.2.1
> Mime is application/zip
> -- will check on the logs and get back
> Size of the zip that works is ~600kb.
> -Jason
> -----Original Message-----
> From: Mandeep Sandhu [mailto:mandeepsandhu.chd at gmail.com]
> Sent: Sunday, May 04, 2014 3:25 AM
> To: Jason Kretzer
> Cc: Thiago Macieira; interest at qt-project.org
> Subject: Re: [Interest] Debugging tip for QNetworkReply
> A couple of questions to help debug further.
> * What platform are you running this on and what's the version of Qt?
> * What is the MIME type set by the webserver when responding to your request (you can check it by dumping the headers received)
> * According to the webserver logs, how much data was returned for the problematic zip file?
> * Whats the size of the zip that works?
> -mandeep
> On Sat, May 3, 2014 at 11:47 PM, Jason Kretzer <Jason at gocodigo.com> wrote:
>> The zip that fails and is unreadable is a 1k file.  The zip that I am attempting to download is ~55MB.  The 1k zip also cannot be opened by a zip program nor a text editor.  Is there a way I can tell what the failure is?  Perhaps, I can use wireshark to see the traffic and see the http response codes from the server. They should be 200, I would think since I can use a browser and get the zip(s) that way.  Perhaps a way to look through the request/reply objects to see what is going on?
>> -Jason
>> -----Original Message-----
>> From: interest-bounces+jason=gocodigo.com at qt-project.org
>> [mailto:interest-bounces+jason=gocodigo.com at qt-project.org] On Behalf
>> Of Thiago Macieira
>> Sent: Friday, May 02, 2014 5:05 PM
>> To: interest at qt-project.org
>> Subject: Re: [Interest] Debugging tip for QNetworkReply
>> Em sex 02 maio 2014, às 10:45:16, Jason Kretzer escreveu:
>>> I am using the following code to download zip files from a url.  The
>>> only thing that changes is the “id” in the url(one for each zip).
>>> Anyway, the code always works on one of the zip files, but never
>>> works on the other.  Both zips are on the server.  Both zips are
>>> downloadable, if I access the url(s) from a web browser.  What I am
>>> looking for is primarily direction on how to go about effectively
>>> debugging this.  I tried using
>>> reply->errorString() right after loop.exec() — but it returns only
>>> reply->“Unknown
>>> Error” whether the download is successful or not.  It should also be
>>> noted that on failure a file is created but is not a readable zip file.
>> Why is it not readable? Is the file too short? Is it corrupted? Please compare the result with what was supposed to be there.
>> --
>> Thiago Macieira - thiago.macieira (AT) intel.com
>>   Software Architect - Intel Open Source Technology Center
>> _______________________________________________
>> Interest mailing list
>> Interest at qt-project.org
>> http://lists.qt-project.org/mailman/listinfo/interest
>> _______________________________________________
>> Interest mailing list
>> Interest at qt-project.org
>> http://lists.qt-project.org/mailman/listinfo/interest

More information about the Interest mailing list