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 613361 - Libsoup unpack tar.gz files
Libsoup unpack tar.gz files
Status: RESOLVED FIXED
Product: libsoup
Classification: Core
Component: Misc
2.29.x
Other Linux
: Normal normal
: ---
Assigned To: libsoup-maint@gnome.bugs
libsoup-maint@gnome.bugs
: 650360 (view as bug list)
Depends on:
Blocks:
 
 
Reported: 2010-03-19 20:43 UTC by Priit Laes (IRC: plaes)
Modified: 2011-05-22 14:05 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description Priit Laes (IRC: plaes) 2010-03-19 20:43:09 UTC
When I tried to download theme packages from http://www.claws-mail.org/themes.php with ephy-webkit (2.29.92 / 1.1.90), the tar.gz file ended up as unpacked tar file (though the name was still tar.gz).

As saving these files with firefox went without a hitch, I'm considering this a bug :P
Comment 1 Gustavo Noronha (kov) 2010-03-23 01:48:12 UTC
The site sends the tar.gz file saying it is gzip encoded. Firefox is likely handling this specially.
Comment 2 Dan Winship 2010-03-23 01:55:58 UTC
Yeah, I need to dig through the mozilla sources, but I'm guessing the fix here is going to be that if webkit/ephy is going to download the file rather than displaying it, then we don't want to decode it. Of course, you don't decide whether to display or download it until after seeing the headers, and by that point it's too late to call soup_message_disable_feature(), so we'll need some libsoup work either way.

(Actually, you probably don't decide for sure until after sniffing the file, which would happen after we'd already started ungzipping it... Hm... maybe it is just a special case for tar...)
Comment 3 Gustavo Noronha (kov) 2010-03-24 12:21:59 UTC
(In reply to comment #2)
> (Actually, you probably don't decide for sure until after sniffing the file,
> which would happen after we'd already started ungzipping it... Hm... maybe it
> is just a special case for tar...)

Yeah... without having looked at the mozilla code yet, I think what we may end up doing is to disregard the Content-Encoding header (by disabling the soup feature in the message) based on the file name, assuming a false-positive by the server.
Comment 4 Dan Winship 2011-05-17 10:13:24 UTC
*** Bug 650360 has been marked as a duplicate of this bug. ***
Comment 5 Dan Winship 2011-05-17 10:54:31 UTC
void
nsHttpChannel::ClearBogusContentEncodingIfNeeded()
{
    // For .gz files, apache sends both a Content-Type: application/x-gzip
    // as well as Content-Encoding: gzip, which is completely wrong.  In
    // this case, we choose to ignore the rogue Content-Encoding header. We
    // must do this early on so as to prevent it from being seen up stream.
    // The same problem exists for Content-Encoding: compress in default
    // Apache installs.
    if (mResponseHead->HasHeaderValue(nsHttp::Content_Encoding, "gzip") && (
        mResponseHead->ContentType().EqualsLiteral(APPLICATION_GZIP) ||
        mResponseHead->ContentType().EqualsLiteral(APPLICATION_GZIP2) ||
        mResponseHead->ContentType().EqualsLiteral(APPLICATION_GZIP3))) {
        // clear the Content-Encoding header
        mResponseHead->ClearHeader(nsHttp::Content_Encoding);
    }
    else if (mResponseHead->HasHeaderValue(nsHttp::Content_Encoding, "compress") && (
             mResponseHead->ContentType().EqualsLiteral(APPLICATION_COMPRESS) ||
             mResponseHead->ContentType().EqualsLiteral(APPLICATION_COMPRESS2))) {
        // clear the Content-Encoding header
        mResponseHead->ClearHeader(nsHttp::Content_Encoding);
    }
}
Comment 6 Dan Winship 2011-05-22 14:05:41 UTC
fixed in master. might go into 3.0.2...