Explorar el Código

TransportHttp: support HTTP response 308 Permanent Redirect

RFC 7538[1] added HTTP response code 308, signifying a permanent
redirect that, contrary to the older 301, does not allow changing
the request method from POST to GET.

[1] https://tools.ietf.org/html/rfc7538

Bug: 560936
Change-Id: Ib65f3a3ed75db51d74d1fe81d4abe6fe92b0ca12
Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
tags/v5.8.0.202005061305-m2
Thomas Wolf hace 4 años
padre
commit
04e16afb05

+ 11
- 0
org.eclipse.jgit/.settings/.api_filters Ver fichero

@@ -0,0 +1,11 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<component id="org.eclipse.jgit" version="2">
<resource path="src/org/eclipse/jgit/transport/http/HttpConnection.java" type="org.eclipse.jgit.transport.http.HttpConnection">
<filter id="403767336">
<message_arguments>
<message_argument value="org.eclipse.jgit.transport.http.HttpConnection"/>
<message_argument value="HTTP_11_MOVED_PERM"/>
</message_arguments>
</filter>
</resource>
</component>

+ 2
- 0
org.eclipse.jgit/src/org/eclipse/jgit/transport/TransportHttp.java Ver fichero

@@ -549,6 +549,7 @@ public class TransportHttp extends HttpTransport implements WalkTransport,
case HttpConnection.HTTP_MOVED_PERM:
case HttpConnection.HTTP_MOVED_TEMP:
case HttpConnection.HTTP_SEE_OTHER:
case HttpConnection.HTTP_11_MOVED_PERM:
case HttpConnection.HTTP_11_MOVED_TEMP:
// SEE_OTHER should actually never be sent by a git server,
// and in general should occur only on POST requests. But it
@@ -1412,6 +1413,7 @@ public class TransportHttp extends HttpTransport implements WalkTransport,

case HttpConnection.HTTP_MOVED_PERM:
case HttpConnection.HTTP_MOVED_TEMP:
case HttpConnection.HTTP_11_MOVED_PERM:
case HttpConnection.HTTP_11_MOVED_TEMP:
// SEE_OTHER after a POST doesn't make sense for a git
// server, so we don't handle it here and thus we'll

+ 13
- 1
org.eclipse.jgit/src/org/eclipse/jgit/transport/http/HttpConnection.java Ver fichero

@@ -59,13 +59,25 @@ public interface HttpConnection {
int HTTP_SEE_OTHER = java.net.HttpURLConnection.HTTP_SEE_OTHER;

/**
* HTTP 1.1 additional MOVED_TEMP status code; value = 307.
* HTTP 1.1 additional "temporary redirect" status code; value = 307.
*
* @see #HTTP_MOVED_TEMP
* @see <a href="https://tools.ietf.org/html/rfc7231#section-6.4.7">RFC
* 7231, section 6.4.7: 307 Temporary Redirect</a>
* @since 4.9
*/
int HTTP_11_MOVED_TEMP = 307;

/**
* HTTP 1.1 additional "permanent redirect" status code; value = 308.
*
* @see #HTTP_MOVED_TEMP
* @see <a href="https://tools.ietf.org/html/rfc7538#section-3">RFC 7538,
* section 3: 308 Permanent Redirect</a>
* @since 5.8
*/
int HTTP_11_MOVED_PERM = 308;

/**
* @see HttpURLConnection#HTTP_NOT_FOUND
*/

Cargando…
Cancelar
Guardar