Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'org.eclipse.jgit.http.server/src/org')
-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/GitSmartHttpTools.java7
-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.server/src/org/eclipse/jgit/http/server/glue/ServletBinder.java4
5 files changed, 12 insertions, 43 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/GitSmartHttpTools.java b/org.eclipse.jgit.http.server/src/org/eclipse/jgit/http/server/GitSmartHttpTools.java
index b9ca12bf3d..ee4b32efb7 100644
--- a/org.eclipse.jgit.http.server/src/org/eclipse/jgit/http/server/GitSmartHttpTools.java
+++ b/org.eclipse.jgit.http.server/src/org/eclipse/jgit/http/server/GitSmartHttpTools.java
@@ -63,6 +63,7 @@ import java.util.List;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
+import org.eclipse.jgit.internal.transport.parser.FirstWant;
import org.eclipse.jgit.lib.Constants;
import org.eclipse.jgit.transport.PacketLineIn;
import org.eclipse.jgit.transport.PacketLineOut;
@@ -246,9 +247,9 @@ public class GitSmartHttpTools {
// not have an UploadPack, or it might not have read any of the request.
// So, cheat and read the first line.
String line = new PacketLineIn(req.getInputStream()).readString();
- UploadPack.FirstLine parsed = new UploadPack.FirstLine(line);
- return (parsed.getOptions().contains(OPTION_SIDE_BAND)
- || parsed.getOptions().contains(OPTION_SIDE_BAND_64K));
+ FirstWant parsed = FirstWant.fromLine(line);
+ return (parsed.getCapabilities().contains(OPTION_SIDE_BAND)
+ || parsed.getCapabilities().contains(OPTION_SIDE_BAND_64K));
} catch (IOException e) {
// Probably the connection is closed and a subsequent write will fail, but
// try it just in case.
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.server/src/org/eclipse/jgit/http/server/glue/ServletBinder.java b/org.eclipse.jgit.http.server/src/org/eclipse/jgit/http/server/glue/ServletBinder.java
index b2b4748989..2a03633580 100644
--- a/org.eclipse.jgit.http.server/src/org/eclipse/jgit/http/server/glue/ServletBinder.java
+++ b/org.eclipse.jgit.http.server/src/org/eclipse/jgit/http/server/glue/ServletBinder.java
@@ -57,7 +57,7 @@ public interface ServletBinder {
* the filter to trigger while processing the path.
* @return {@code this}.
*/
- public ServletBinder through(Filter filter);
+ ServletBinder through(Filter filter);
/**
* Set the servlet to execute on this path
@@ -65,5 +65,5 @@ public interface ServletBinder {
* @param servlet
* the servlet to execute on this path.
*/
- public void with(HttpServlet servlet);
+ void with(HttpServlet servlet);
}

Back to the top