You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@felix.apache.org by "Holger Hoffstätte (Commented JIRA)" <ji...@apache.org> on 2011/10/27 16:12:32 UTC

[jira] [Commented] (FELIX-3191) OBR cannot install JARs which have been encoded for transfer

    [ https://issues.apache.org/jira/browse/FELIX-3191?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13137165#comment-13137165 ] 

Holger Hoffstätte commented on FELIX-3191:
------------------------------------------

As someone who is currently working on a related problem (a remote repository for the new OBR spec) I'd like to point out that turning off compression for resources is probably fine (as they are likely already compressed), but should really be turned *on* for repository indexes themselves. Not sure if this FileUtil class is used for retrieval of both types.

                
> OBR cannot install JARs which have been encoded for transfer
> ------------------------------------------------------------
>
>                 Key: FELIX-3191
>                 URL: https://issues.apache.org/jira/browse/FELIX-3191
>             Project: Felix
>          Issue Type: Bug
>          Components: Bundle Repository (OBR)
>         Environment: Debian Testing, 64-bit
>            Reporter: Lionel Debroux
>
> I recently had trouble installing bundles through the OBR: the JAR handling code would spit errors about not being able to open the ZIP file.
> With Wireshark, I tracked the problem down to the JAR file having been gzipped, but not having been uncompressed on the computer side.
> Even if they're not explicitly asked for it (which is the case when downloading a bundle through the OBR), servers are allowed by the HTTP/1.1 spec to return encoded content:
> "If no Accept-Encoding field is present in a request, the server MAY assume that the client will accept any content coding."
> ( http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.3 )
> I worked around the problem the following way:
> Index: bundlerepository/src/main/java/org/apache/felix/bundlerepository/impl/FileUtil.java
> ===================================================================
> --- bundlerepository/src/main/java/org/apache/felix/bundlerepository/impl/FileUtil.java    (revision 1189686)
> +++ bundlerepository/src/main/java/org/apache/felix/bundlerepository/impl/FileUtil.java    (working copy)
> @@ -204,6 +204,14 @@
>          // Do it the manual way to have a chance to
>          // set request properties as proxy auth (EW).
>          setProxyAuth(conn);
> +
> +        // Force identity encoding
> +        if ("http".equals(conn.getURL().getProtocol())
> +            || "https".equals(conn.getURL().getProtocol()))
> +        {
> +            conn.setRequestProperty("Accept-Encoding", "");
> +        }
> +
>          try
>          {
>              return conn.getInputStream();
> But I'm not sure whether that this is a proper fix, which is why I had posted it to felix-users :)

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira