After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 690226 - Incorrect total number of bytes reported
Incorrect total number of bytes reported
Status: RESOLVED OBSOLETE
Product: gvfs
Classification: Core
Component: http backend
git master
Other Linux
: Normal normal
: ---
Assigned To: gvfs-maint
gvfs-maint
: 725782 (view as bug list)
Depends on: 664620
Blocks:
 
 
Reported: 2012-12-14 21:56 UTC by Zeeshan Ali
Modified: 2018-09-21 17:19 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Test vala app to demonstrate the issue (581 bytes, application/octet-stream)
2012-12-14 21:56 UTC, Zeeshan Ali
  Details
More usable C testcase (1.10 KB, text/plain)
2012-12-14 23:02 UTC, Christophe Fergeau
  Details
http: report correct size if partical content message is recieved (1.62 KB, patch)
2014-11-24 13:30 UTC, Ondrej Holy
reviewed Details | Review
http: Report correct size for partical content msg (1.62 KB, patch)
2014-12-01 14:13 UTC, Ondrej Holy
needs-work Details | Review
http: Report correct size for partial content msg (1.62 KB, patch)
2014-12-01 16:03 UTC, Ondrej Holy
committed Details | Review

Description Zeeshan Ali 2012-12-14 21:56:16 UTC
Created attachment 231595 [details]
Test vala app to demonstrate the issue

The attached test app demonstrates an issue in gio/gvfs, where incorrect total_num_bytes are reported in GFileProgressCallback passed to g_file_copy():

current: 1689, total: 4982
current: 7996, total: 4982
current: 7996, total: 4982

I have verified that the HTTP server sends correct 'Content-Length' header through wget:

  Content-Length: 7996
Comment 1 Christophe Fergeau 2012-12-14 23:02:39 UTC
Created attachment 231596 [details]
More usable C testcase
Comment 2 Christophe Fergeau 2012-12-14 23:34:55 UTC
gvfs-info
http://zeenix.fedorapeople.org/drivers/win-tools/preinst/winxp/amd64/viostor.cat
gives this in wireshark:


HEAD /drivers/win-tools/preinst/winxp/amd64/viostor.cat HTTP/1.1
Host: zeenix.fedorapeople.org
Accept-Encoding: gzip, deflate
User-Agent: gvfs/1.14.2
Accept-Language: fr-fr, fr;q=0.9
Connection: Keep-Alive

HTTP/1.1 200 OK
Date: Fri, 14 Dec 2012 23:31:50 GMT
Server: Apache/2.2.15
Last-Modified: Mon, 26 Nov 2012 21:55:29 GMT
ETag: "1f3c-4cf6cfdddd5bf"
Accept-Ranges: bytes
Vary: Accept-Encoding,User-Agent
Content-Encoding: gzip
Content-Length: 4982
Connection: close
Content-Type: text/plain; charset=UTF-8
Comment 3 Marc-Andre Lureau 2012-12-15 00:42:46 UTC
Looks like it's the gzip size vs the raw size.
Comment 4 Dan Winship 2012-12-15 14:11:38 UTC
Yeah, file_info_from_message() can't call call g_file_info_set_size() if SOUP_MESSAGE_CONTENT_DECODED is set in soup_message_get_flags().

But bug 664620 suggests adding some API to get the decoded body length for gzip at least, which would let you be able to fill in the correct size, which would be a better long-term fix.
Comment 5 Ross Lagerwall 2014-03-06 07:08:50 UTC
*** Bug 725782 has been marked as a duplicate of this bug. ***
Comment 6 Ondrej Holy 2014-11-24 13:30:21 UTC
Created attachment 291360 [details] [review]
http: report correct size if partical content message is recieved

Also query_info_on_read reports wrong size if partial content is received (e.g. after seek). See:

< HTTP/1.1 206 Partial Content
< Soup-Debug-Timestamp: 1416834309
< Soup-Debug: SoupMessage 6 (0xfdb580)
< Date: Mon, 24 Nov 2014 13:05:09 GMT
< Server: Apache/2.4.10 (Fedora) OpenSSL/1.0.1j-fips
< Last-Modified: Mon, 24 Nov 2014 07:51:06 GMT
< ETag: "6f3a-508960e93c39f"
< Accept-Ranges: bytes
< Content-Length: 1458
< Content-Range: bytes 27016-28473/28474
< Keep-Alive: timeout=5, max=100
< Connection: Keep-Alive
< Content-Type: application/vnd.oasis.opendocument.text

Therefor value from content range header should be used instead...
Comment 7 Dan Winship 2014-11-24 14:07:02 UTC
Comment on attachment 291360 [details] [review]
http: report correct size if partical content message is recieved

>Content length is wrong for partical content messages (e.g. after seek),

It's not *wrong*, it's just not the information you're looking for. (Content-Length gives the size of the response, not the size of the underlying resource.)
Comment 8 Dan Winship 2014-11-29 19:43:12 UTC
Comment on attachment 291360 [details] [review]
http: report correct size if partical content message is recieved

other than my nitpick about the commit message, the patch looks right to me
Comment 9 Zeeshan Ali 2014-12-01 12:01:49 UTC
Review of attachment 291360 [details] [review]:

Also if you could please also keep the shortlog short as per the guidelines: https://wiki.gnome.org/Git/CommitMessages , that would be wonderful.
Comment 10 Ondrej Holy 2014-12-01 13:11:57 UTC
(In reply to comment #9)
> Review of attachment 291360 [details] [review]:
> 
> Also if you could please also keep the shortlog short as per the guidelines:
> https://wiki.gnome.org/Git/CommitMessages , that would be wonderful.

What is wrong with my log? Summary has 65 chars (yes, it is more then 50, but it is less then 72) and longest line in description has 72 chars (it is less then 74)...
Comment 11 Ondrej Holy 2014-12-01 13:13:05 UTC
(In reply to comment #8)
> (From update of attachment 291360 [details] [review])
> other than my nitpick about the commit message, the patch looks right to me

I will fix the message, thanks for review!
Comment 12 Zeeshan Ali 2014-12-01 13:37:19 UTC
(In reply to comment #10)
> (In reply to comment #9)
> > Review of attachment 291360 [details] [review] [details]:
> > 
> > Also if you could please also keep the shortlog short as per the guidelines:
> > https://wiki.gnome.org/Git/CommitMessages , that would be wonderful.
> 
> What is wrong with my log? Summary has 65 chars (yes, it is more then 50, but
> it is less then 72)

Nothing "wrong" per say but I believe in this case its easily possible to not exceed 50 chars recommendation so why not follow it? E.g how about "http: Report correct size for partical content msg"?

> and longest line in description has 72 chars (it is less
> then 74)...

Yeah, thats fine. I was only talking about shortlog.
Comment 13 Ondrej Holy 2014-12-01 14:13:11 UTC
Created attachment 291887 [details] [review]
http: Report correct size for partical content msg

Is everything ok now?
Comment 14 Zeeshan Ali 2014-12-01 15:29:19 UTC
Review of attachment 291887 [details] [review]:

Thanks, unfortunately you ended up copy&pasting my typo: partical -> partial. Sorry about that.
Comment 15 Ondrej Holy 2014-12-01 16:03:08 UTC
Created attachment 291931 [details] [review]
http: Report correct size for partial content msg

You copy&pasted my typo from the first commit message probably and I copy&pasted it again in short log :-D So hopefully now it is time to look on the code also :-D
Comment 16 Ross Lagerwall 2014-12-02 22:19:02 UTC
Review of attachment 291931 [details] [review]:

Looks good!
Comment 17 Ondrej Holy 2014-12-03 07:58:01 UTC
Comment on attachment 291931 [details] [review]
http: Report correct size for partial content msg

Thanks for reviews! Pushed to master and gnome-3-14:
commit 38f093cfc0144972adda956320f5f968f7e1220a
commit 643498c51747d2b0ff2290352afdac97a9771e02
Comment 18 GNOME Infrastructure Team 2018-09-21 17:19:31 UTC
-- GitLab Migration Automatic Message --

This bug has been migrated to GNOME's GitLab instance and has been closed from further activity.

You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.gnome.org/GNOME/gvfs/issues/195.