summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--org.eclipse.jgit.http.server/src/org/eclipse/jgit/http/server/ClientVersionUtil.java22
-rw-r--r--org.eclipse.jgit.http.server/src/org/eclipse/jgit/http/server/ReceivePackServlet.java12
-rw-r--r--org.eclipse.jgit.http.server/src/org/eclipse/jgit/http/server/UploadPackServlet.java10
-rw-r--r--org.eclipse.jgit.http.test/tst/org/eclipse/jgit/http/server/ClientVersionUtilTest.java15
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/transport/ReceivePack.java20
5 files changed, 9 insertions, 70 deletions
diff --git a/org.eclipse.jgit.http.server/src/org/eclipse/jgit/http/server/ClientVersionUtil.java b/org.eclipse.jgit.http.server/src/org/eclipse/jgit/http/server/ClientVersionUtil.java
index 38a9ea75e7..18b9b2a484 100644
--- a/org.eclipse.jgit.http.server/src/org/eclipse/jgit/http/server/ClientVersionUtil.java
+++ b/org.eclipse.jgit.http.server/src/org/eclipse/jgit/http/server/ClientVersionUtil.java
@@ -43,18 +43,12 @@
package org.eclipse.jgit.http.server;
-import static org.eclipse.jgit.http.server.ServletUtils.isChunked;
-
import javax.servlet.http.HttpServletRequest;
/**
* Parses Git client User-Agent strings.
*/
public class ClientVersionUtil {
- private static final int[] v1_7_5 = { 1, 7, 5 };
- private static final int[] v1_7_8_6 = { 1, 7, 8, 6 };
- private static final int[] v1_7_9 = { 1, 7, 9 };
-
/**
* An invalid version of Git
*
@@ -174,17 +168,11 @@ public class ClientVersionUtil {
* @param version
* parsed version of the Git client software.
* @return true if the bug is present.
+ * @deprecated no widely used Git versions need this any more
*/
+ @Deprecated
public static boolean hasPushStatusBug(int[] version) {
- int cmp = compare(version, v1_7_8_6);
- if (cmp < 0)
- return true; // Everything before 1.7.8.6 is known broken.
- else if (cmp == 0)
- return false; // 1.7.8.6 contained the bug fix.
-
- if (compare(version, v1_7_9) <= 0)
- return true; // 1.7.9 shipped before 1.7.8.6 and has the bug.
- return false; // 1.7.9.1 and later are fixed.
+ return false;
}
/**
@@ -198,10 +186,12 @@ public class ClientVersionUtil {
* @param request
* incoming HTTP request.
* @return true if the client has the chunked encoding bug.
+ * @deprecated no widely used Git versions need this any more
*/
+ @Deprecated
public static boolean hasChunkedEncodingRequestBug(
int[] version, HttpServletRequest request) {
- return compare(version, v1_7_5) == 0 && isChunked(request);
+ return false;
}
private ClientVersionUtil() {
diff --git a/org.eclipse.jgit.http.server/src/org/eclipse/jgit/http/server/ReceivePackServlet.java b/org.eclipse.jgit.http.server/src/org/eclipse/jgit/http/server/ReceivePackServlet.java
index a46652ee42..aed36560a8 100644
--- a/org.eclipse.jgit.http.server/src/org/eclipse/jgit/http/server/ReceivePackServlet.java
+++ b/org.eclipse.jgit.http.server/src/org/eclipse/jgit/http/server/ReceivePackServlet.java
@@ -43,14 +43,10 @@
package org.eclipse.jgit.http.server;
-import static javax.servlet.http.HttpServletResponse.SC_BAD_REQUEST;
import static javax.servlet.http.HttpServletResponse.SC_FORBIDDEN;
import static javax.servlet.http.HttpServletResponse.SC_INTERNAL_SERVER_ERROR;
import static javax.servlet.http.HttpServletResponse.SC_UNAUTHORIZED;
import static javax.servlet.http.HttpServletResponse.SC_UNSUPPORTED_MEDIA_TYPE;
-import static org.eclipse.jgit.http.server.ClientVersionUtil.hasChunkedEncodingRequestBug;
-import static org.eclipse.jgit.http.server.ClientVersionUtil.hasPushStatusBug;
-import static org.eclipse.jgit.http.server.ClientVersionUtil.parseVersion;
import static org.eclipse.jgit.http.server.GitSmartHttpTools.RECEIVE_PACK;
import static org.eclipse.jgit.http.server.GitSmartHttpTools.RECEIVE_PACK_REQUEST_TYPE;
import static org.eclipse.jgit.http.server.GitSmartHttpTools.RECEIVE_PACK_RESULT_TYPE;
@@ -174,13 +170,6 @@ class ReceivePackServlet extends HttpServlet {
return;
}
- int[] version = parseVersion(req.getHeader(HDR_USER_AGENT));
- if (hasChunkedEncodingRequestBug(version, req)) {
- GitSmartHttpTools.sendError(req, rsp, SC_BAD_REQUEST, "\n\n"
- + HttpServerText.get().clientHas175ChunkedEncodingBug);
- return;
- }
-
SmartOutputStream out = new SmartOutputStream(req, rsp, false) {
@Override
public void flush() throws IOException {
@@ -191,7 +180,6 @@ class ReceivePackServlet extends HttpServlet {
ReceivePack rp = (ReceivePack) req.getAttribute(ATTRIBUTE_HANDLER);
try {
rp.setBiDirectionalPipe(false);
- rp.setEchoCommandFailures(hasPushStatusBug(version));
rsp.setContentType(RECEIVE_PACK_RESULT_TYPE);
rp.receive(getInputStream(req), out, null);
diff --git a/org.eclipse.jgit.http.server/src/org/eclipse/jgit/http/server/UploadPackServlet.java b/org.eclipse.jgit.http.server/src/org/eclipse/jgit/http/server/UploadPackServlet.java
index ca6b749e75..0f4037144a 100644
--- a/org.eclipse.jgit.http.server/src/org/eclipse/jgit/http/server/UploadPackServlet.java
+++ b/org.eclipse.jgit.http.server/src/org/eclipse/jgit/http/server/UploadPackServlet.java
@@ -43,13 +43,10 @@
package org.eclipse.jgit.http.server;
-import static javax.servlet.http.HttpServletResponse.SC_BAD_REQUEST;
import static javax.servlet.http.HttpServletResponse.SC_FORBIDDEN;
import static javax.servlet.http.HttpServletResponse.SC_INTERNAL_SERVER_ERROR;
import static javax.servlet.http.HttpServletResponse.SC_UNAUTHORIZED;
import static javax.servlet.http.HttpServletResponse.SC_UNSUPPORTED_MEDIA_TYPE;
-import static org.eclipse.jgit.http.server.ClientVersionUtil.hasChunkedEncodingRequestBug;
-import static org.eclipse.jgit.http.server.ClientVersionUtil.parseVersion;
import static org.eclipse.jgit.http.server.GitSmartHttpTools.UPLOAD_PACK;
import static org.eclipse.jgit.http.server.GitSmartHttpTools.UPLOAD_PACK_REQUEST_TYPE;
import static org.eclipse.jgit.http.server.GitSmartHttpTools.UPLOAD_PACK_RESULT_TYPE;
@@ -193,13 +190,6 @@ class UploadPackServlet extends HttpServlet {
return;
}
- int[] version = parseVersion(req.getHeader(HDR_USER_AGENT));
- if (hasChunkedEncodingRequestBug(version, req)) {
- GitSmartHttpTools.sendError(req, rsp, SC_BAD_REQUEST, "\n\n"
- + HttpServerText.get().clientHas175ChunkedEncodingBug);
- return;
- }
-
SmartOutputStream out = new SmartOutputStream(req, rsp, false) {
@Override
public void flush() throws IOException {
diff --git a/org.eclipse.jgit.http.test/tst/org/eclipse/jgit/http/server/ClientVersionUtilTest.java b/org.eclipse.jgit.http.test/tst/org/eclipse/jgit/http/server/ClientVersionUtilTest.java
index c7260e325b..9dca279912 100644
--- a/org.eclipse.jgit.http.test/tst/org/eclipse/jgit/http/server/ClientVersionUtilTest.java
+++ b/org.eclipse.jgit.http.test/tst/org/eclipse/jgit/http/server/ClientVersionUtilTest.java
@@ -43,11 +43,8 @@
package org.eclipse.jgit.http.server;
-import static org.eclipse.jgit.http.server.ClientVersionUtil.hasPushStatusBug;
import static org.eclipse.jgit.http.server.ClientVersionUtil.invalidVersion;
import static org.eclipse.jgit.http.server.ClientVersionUtil.parseVersion;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertTrue;
import org.junit.Assert;
import org.junit.Test;
@@ -67,18 +64,6 @@ public class ClientVersionUtilTest {
assertEquals(ClientVersionUtil.toString(invalidVersion()), parseVersion("foo"));
}
- @Test
- public void testPushStatusBug() {
- assertTrue(hasPushStatusBug(parseVersion("git/1.6.6")));
- assertTrue(hasPushStatusBug(parseVersion("git/1.6.6.1")));
- assertTrue(hasPushStatusBug(parseVersion("git/1.7.9")));
-
- assertFalse(hasPushStatusBug(parseVersion("git/1.7.8.6")));
- assertFalse(hasPushStatusBug(parseVersion("git/1.7.9.1")));
- assertFalse(hasPushStatusBug(parseVersion("git/1.7.9.2")));
- assertFalse(hasPushStatusBug(parseVersion("git/1.7.10")));
- }
-
private static void assertEquals(String exp, int[] act) {
Assert.assertEquals(exp, ClientVersionUtil.toString(act));
}
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/transport/ReceivePack.java b/org.eclipse.jgit/src/org/eclipse/jgit/transport/ReceivePack.java
index d4bf81230b..577aaf4e9e 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/transport/ReceivePack.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/transport/ReceivePack.java
@@ -76,8 +76,6 @@ public class ReceivePack extends BaseReceivePack {
/** If {@link BasePackPushConnection#CAPABILITY_REPORT_STATUS} is enabled. */
private boolean reportStatus;
- private boolean echoCommandFailures;
-
/** Whether the client intends to use push options. */
private boolean usePushOptions;
private List<String> pushOptions;
@@ -191,9 +189,11 @@ public class ReceivePack extends BaseReceivePack {
* messages before sending the command results. This is usually
* not necessary, but may help buggy Git clients that discard the
* errors when all branches fail.
+ * @deprecated no widely used Git versions need this any more
*/
+ @Deprecated
public void setEchoCommandFailures(boolean echo) {
- echoCommandFailures = echo;
+ // No-op.
}
/**
@@ -291,20 +291,6 @@ public class ReceivePack extends BaseReceivePack {
}
if (reportStatus) {
- if (echoCommandFailures && msgOut != null) {
- sendStatusReport(false, unpackError, new Reporter() {
- @Override
- void sendString(String s) throws IOException {
- msgOut.write(Constants.encode(s + "\n")); //$NON-NLS-1$
- }
- });
- msgOut.flush();
- try {
- Thread.sleep(500);
- } catch (InterruptedException wakeUp) {
- // Ignore an early wake up.
- }
- }
sendStatusReport(true, unpackError, new Reporter() {
@Override
void sendString(String s) throws IOException {