diff options
author | Masaya Suzuki <masayasuzuki@google.com> | 2018-11-11 12:31:22 -0800 |
---|---|---|
committer | Masaya Suzuki <masayasuzuki@google.com> | 2018-11-19 13:37:28 -0800 |
commit | 49befd84d759501ef45942055eac1c743cb0c5ec (patch) | |
tree | 3a17475f2b69c1f749410b3cb260b7db7a69e63f /org.eclipse.jgit.http.server/src/org/eclipse/jgit | |
parent | c567b6ecde6b055441f52f0f36dcf8b9d0fe5068 (diff) | |
download | jgit-49befd84d759501ef45942055eac1c743cb0c5ec.tar.gz jgit-49befd84d759501ef45942055eac1c743cb0c5ec.zip |
Revert C Git 1.7.5 bug workaround
This reverts the workaround introduced by
1c6c73c5a9b8dd700be45d658f165a464265dba7, which is a patch for dealing
with a buggy C Git client v1.7.5 in 2012. We'll stop supporting very old
C Git clients.
Change-Id: I94999a39101c96f210b5eca3c2f620c15eb1ac1b
Signed-off-by: Masaya Suzuki <masayasuzuki@google.com>
Diffstat (limited to 'org.eclipse.jgit.http.server/src/org/eclipse/jgit')
3 files changed, 6 insertions, 38 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 { |