From a379d007dbf5eefbe8c93738755582586eb835b1 Mon Sep 17 00:00:00 2001 From: Matthias Sohn Date: Mon, 11 May 2020 10:36:54 +0200 Subject: [PATCH] Fix downloading LFS Object fails behind proxy When downloading LFS objects also accept response code 203 as successful download. This response may be seen when downloading via a proxy. Bug: 563022 Change-Id: Iee85fdb451b33369d08859872e5bfc2a67dffa6d Signed-off-by: Matthias Sohn --- .../src/org/eclipse/jgit/lfs/SmudgeFilter.java | 3 ++- org.eclipse.jgit/.settings/.api_filters | 6 ++++++ .../src/org/eclipse/jgit/transport/http/HttpConnection.java | 6 ++++++ 3 files changed, 14 insertions(+), 1 deletion(-) diff --git a/org.eclipse.jgit.lfs/src/org/eclipse/jgit/lfs/SmudgeFilter.java b/org.eclipse.jgit.lfs/src/org/eclipse/jgit/lfs/SmudgeFilter.java index 23ece3e48..2f80d5b9a 100644 --- a/org.eclipse.jgit.lfs/src/org/eclipse/jgit/lfs/SmudgeFilter.java +++ b/org.eclipse.jgit.lfs/src/org/eclipse/jgit/lfs/SmudgeFilter.java @@ -133,7 +133,8 @@ public static Collection downloadLfsResource(Lfs lfs, Repository db, .toRequest(Protocol.OPERATION_DOWNLOAD, res)) .getBytes(UTF_8)); int responseCode = lfsServerConn.getResponseCode(); - if (responseCode != HttpConnection.HTTP_OK) { + if (!(responseCode == HttpConnection.HTTP_OK + || responseCode == HttpConnection.HTTP_NOT_AUTHORITATIVE)) { throw new IOException( MessageFormat.format(LfsText.get().serverFailure, lfsServerConn.getURL(), diff --git a/org.eclipse.jgit/.settings/.api_filters b/org.eclipse.jgit/.settings/.api_filters index c8b7bf799..2d860f59d 100644 --- a/org.eclipse.jgit/.settings/.api_filters +++ b/org.eclipse.jgit/.settings/.api_filters @@ -7,5 +7,11 @@ + + + + + + diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/transport/http/HttpConnection.java b/org.eclipse.jgit/src/org/eclipse/jgit/transport/http/HttpConnection.java index c4d086d4b..98c231a46 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/transport/http/HttpConnection.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/transport/http/HttpConnection.java @@ -40,6 +40,12 @@ public interface HttpConnection { */ int HTTP_OK = java.net.HttpURLConnection.HTTP_OK; + /** + * @see HttpURLConnection#HTTP_NOT_AUTHORITATIVE + * @since 5.8 + */ + int HTTP_NOT_AUTHORITATIVE = java.net.HttpURLConnection.HTTP_NOT_AUTHORITATIVE; + /** * @see HttpURLConnection#HTTP_MOVED_PERM * @since 4.7