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 <matthias.sohn@sap.com>
This commit is contained in:
Matthias Sohn 2020-05-11 10:36:54 +02:00
parent 0642e49f97
commit a379d007db
3 changed files with 14 additions and 1 deletions

View File

@ -133,7 +133,8 @@ public static Collection<Path> 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(),

View File

@ -7,5 +7,11 @@
<message_argument value="HTTP_11_MOVED_PERM"/>
</message_arguments>
</filter>
<filter id="403767336">
<message_arguments>
<message_argument value="org.eclipse.jgit.transport.http.HttpConnection"/>
<message_argument value="HTTP_NOT_AUTHORITATIVE"/>
</message_arguments>
</filter>
</resource>
</component>

View File

@ -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