Bug 393847 - Authentication fails for jar:http urls
Summary: Authentication fails for jar:http urls
Status: NEW
Alias: None
Product: z_Archived
Classification: Eclipse Foundation
Component: Tycho (show other bugs)
Version: unspecified   Edit
Hardware: All All
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Project Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-11-08 06:08 EST by Kai Kreuzer CLA
Modified: 2021-04-28 16:55 EDT (History)
4 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Kai Kreuzer CLA 2012-11-08 06:08:51 EST
I am using an p2 repository archive on a Nexus server, which is referenced with a jar:http url like this:

<repository>
      <id>p2-repo</id>
      <url>jar:http://nexus-server/nexus/content/repositories/snapshots/x/y/z/1.0.0-SNAPSHOT/z-1.0.0-SNAPSHOT-bin.zip!/</url>
      <layout>p2</layout>
</repository>

This works well for unsecured access. But when basic auth is enabled on the Nexus server, I get a 

[ERROR] Internal error: java.lang.RuntimeException: org.eclipse.equinox.p2.core.ProvisionException: Authentication failed for jar:http://nexus-server/nexus/content/repositories/snapshots/x/y/z/1.0.0-SNAPSHOT/z-1.0.0-SNAPSHOT-bin.zip!/

It seems that Tycho is not even trying to authenticate, possibly because it does not recognise jar:http to be a protocol where authentication might be necessary as well.
Comment 1 Igor Fedorenko CLA 2012-11-08 09:19:28 EST
I do not think Tycho ever claimed to support jar:http p2 repositories. Unless there is a trivial fix, I recommend to close this as WONTFIX.
Comment 2 Jan Sievers CLA 2012-11-08 09:37:32 EST
(In reply to comment #1)
> I do not think Tycho ever claimed to support jar:http p2 repositories.
> Unless there is a trivial fix, I recommend to close this as WONTFIX.

agreed. 

- there is no support in the JDK for jar:http: URLs and that's for a reason
- even if p2 / ECF has (some) support for it, by design the client needs to 
  loop over *all* contents of the zip stream to find a zip entry
- this means there is potentially a full download of the zip for each entry requested
Comment 3 Kai Kreuzer CLA 2012-11-08 09:46:35 EST
Hm, you guys yourself suggested this to me at ECE...

Who says that there is no support in the JDK? What about http://docs.oracle.com/javase/6/docs/api/java/net/JarURLConnection.html?
Comment 4 Jan Sievers CLA 2012-11-09 04:12:16 EST
(In reply to comment #3)
> Hm, you guys yourself suggested this to me at ECE...

not sure who you were talking to. Anyway I would suggest to wait for the nexus unzip plugin (bug 393309) which solves this problem on the server side.

> Who says that there is no support in the JDK? What about
> http://docs.oracle.com/javase/6/docs/api/java/net/JarURLConnection.html?

I stand corrected. My performance concerns above still apply.
Comment 5 Kai Kreuzer CLA 2012-11-09 04:42:39 EST
> Anyway I would suggest to wait for the nexus unzip plugin (bug 393309)
> which solves this problem on the server side.

Thanks for the reference, this is indeed what I really need.

Regarding the performance, I fully agree with you - this is a good reason not to use jar:http urls for p2 repos.
Comment 6 Tobias Oberlies CLA 2012-11-09 10:14:31 EST
Despite the performance penalties, I would be applying a patch for this. I don't see why this shouldn't work. If anyone wants to debug this, org.eclipse.tycho.p2.remote.RemoteRepositoryHelper is probably a good starting point.
Comment 7 Alex Blewitt CLA 2013-01-07 04:55:32 EST
Does auth work if you put it in the http url, such as

jar:http://user:password@host.name/path/to/the.zip!/
Comment 8 Mickael Istria CLA 2021-04-08 18:07:37 EDT
Eclipse Tycho is moving away from this bugs.eclipse.org issue tracker to https://github.com/eclipse/tycho/issues/ instead. If this issue is relevant to you, your action is required.
0. Verify this issue is still happening with latest Tycho 2.4.0-SNAPSHOT
  if issue has disappeared, please change status of this issue to "CLOSED WORKFORME" with some details about your testing environment and how you did verify the issue; and you're done
  if issue is still present when latest release:
* Create a new issue at https://github.com/eclipse/tycho/issues/
  ** Use as title in GitHub the title of this Bugzilla ticket (may include the bug number or not, at your own convenience)
  ** In the GitHub description, start with a link to this bugzilla ticket
  ** Optionally add new content to the description if it can helps towards resolution
  ** Submit GitHub issue
* Update bugzilla ticket
  ** Add to "See also" property (up right column) the link to the newly created GitHub issue
  ** Add a comment "Migrated to <link-to-newly-created-GitHub-issue>"
  ** Set status as CLOSED MOVED
  ** Submit

All issues that remain open will be automatically closed next week or so. Then the Bugzilla component for Tycho will be archived and made read-only.