This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 201738 - isGZip method should use Content-Encoding header instead of check the update center URL file extension
Summary: isGZip method should use Content-Encoding header instead of check the update ...
Status: RESOLVED FIXED
Alias: None
Product: platform
Classification: Unclassified
Component: Autoupdate (show other bugs)
Version: 7.0.1
Hardware: PC Linux
: P3 normal (vote)
Assignee: Jiri Rechtacek
URL:
Keywords: NETFIX
Depends on:
Blocks:
 
Reported: 2011-09-07 12:05 UTC by matteodg
Modified: 2011-10-25 14:28 UTC (History)
0 users

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
Proposed patch (1.94 KB, patch)
2011-09-08 11:43 UTC, matteodg
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description matteodg 2011-09-07 12:05:25 UTC
We are publishing our update center using a ColdFusion script (updates.cfm) instead of directly using the updates.xml file created by the "nbms" Ant target.
We would also like to gzip the XML content of the page.

But this does not work with NB Autoupdate code, since it does not understand that the stream output by our ColdFusion script is really a gzipped XML content.
We tried to put a "Content-Encoding: gzip" HTTP header, but without success.

THen I checked the code and it seems that the result of isGzip() method is true only if the URL path ends with ".gz".

Can this be changed to check the Content-Encoding header?
I will provide a patch with the code to implement this enhancement.
Comment 1 Jiri Rechtacek 2011-09-07 12:34:48 UTC
Makes sense, a patch will be welcome. Thanks
Comment 2 matteodg 2011-09-08 11:43:05 UTC
Created attachment 110526 [details]
Proposed patch

I open the connection to URL and I check for Content-Type HTTP header to be equals to "application/x-gzip".
Comment 3 Jiri Rechtacek 2011-10-17 07:36:35 UTC
Thanks for your patch, I'm going to review and push ASAP.
Comment 4 Jiri Rechtacek 2011-10-19 12:54:05 UTC
Thanks for your patch, was applied by core-main/rev/6259ed23bf45
Comment 5 Quality Engineering 2011-10-20 14:27:53 UTC
Integrated into 'main-golden'
Changeset: http://hg.netbeans.org/main-golden/rev/6259ed23bf45
User: Jiri Rechtacek <jrechtacek@netbeans.org>
Log: #201738: isGZip method should use Content-Encoding header instead of check the update center URL file extension;
applied matteodg's patch, thanks
Comment 6 dlipin 2011-10-20 15:57:11 UTC
BTW, this patch brakes AU work on file URLs (file:/something).

At least, on Windows it does not throw IOException and doesn't fall into the catch block. For me it returns different values of contentType for different files (e.g. text/plain for .xml). For *.gz it returns (for me) "application/octet-stream" (like for many other binaries).
Comment 7 Jiri Rechtacek 2011-10-21 08:41:41 UTC
Dima, thanks for catching this. I'm going to improve the patch to work in both cases. Thanks
Comment 8 Jiri Rechtacek 2011-10-24 08:09:02 UTC
the corrected patch - core-main/rev/27f384c1d0fa
Comment 9 matteodg 2011-10-24 16:05:48 UTC
That corrected patch does not allow to use a non .gz extension for the page: we are using a dynamic page (.cfm, .php, etc.) in order to track how many users are downloading the updates. So that's why we needed to check the Content-Type in NetBeans for understanding if the stream is gzipped or not.
Comment 10 Jiri Rechtacek 2011-10-25 09:09:19 UTC
(In reply to comment #9)
> That corrected patch does not allow to use a non .gz extension for the page: we
It does. If not, reopen with a test-case which doesn't work. Thanks
Comment 11 Quality Engineering 2011-10-25 14:28:52 UTC
Integrated into 'main-golden'
Changeset: http://hg.netbeans.org/main-golden/rev/27f384c1d0fa
User: Jiri Rechtacek <jrechtacek@netbeans.org>
Log: correction of impl #201738; previous impl. breaks reading .gz from local file