/** * Check if a Git client has the known push status bug. * <p> * These buggy clients do not display the status report from a failed push * over HTTP. * * @param version * parsed version of the Git client software. * @return true if the bug is present. */ 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. }
/** * Parse a Git client User-Agent header value. * * @param version * git client version string, of the form "git/1.7.9". * @return components of the version string. {@link #invalidVersion()} if * the version string cannot be parsed. */ public static int[] parseVersion(String version) { if (version != null && version.startsWith("git/")) return splitVersion(version.substring("git/".length())); return invalidVersion(); }
int[] version = parseVersion(req.getHeader(HDR_USER_AGENT)); if (hasChunkedEncodingRequestBug(version, req)) { GitSmartHttpTools.sendError(req, rsp, SC_BAD_REQUEST, "\n\n" + HttpServerText.get().clientHas175ChunkedEncodingBug); try { rp.setBiDirectionalPipe(false); rp.setEchoCommandFailures(hasPushStatusBug(version)); rsp.setContentType(RECEIVE_PACK_RESULT_TYPE);
int[] version = parseVersion(req.getHeader(HDR_USER_AGENT)); if (hasChunkedEncodingRequestBug(version, req)) { GitSmartHttpTools.sendError(req, rsp, SC_BAD_REQUEST, "\n\n" + HttpServerText.get().clientHas175ChunkedEncodingBug);
int[] version = parseVersion(req.getHeader(HDR_USER_AGENT)); if (hasChunkedEncodingRequestBug(version, req)) { GitSmartHttpTools.sendError(req, rsp, SC_BAD_REQUEST, "\n\n" + HttpServerText.get().clientHas175ChunkedEncodingBug); try { rp.setBiDirectionalPipe(false); rp.setEchoCommandFailures(hasPushStatusBug(version)); rsp.setContentType(RECEIVE_PACK_RESULT_TYPE);
int[] version = parseVersion(req.getHeader(HDR_USER_AGENT)); if (hasChunkedEncodingRequestBug(version, req)) { GitSmartHttpTools.sendError(req, rsp, SC_BAD_REQUEST, "\n\n" + HttpServerText.get().clientHas175ChunkedEncodingBug);
/** * Parse a Git client User-Agent header value. * * @param version * git client version string, of the form "git/1.7.9". * @return components of the version string. {@link #invalidVersion()} if * the version string cannot be parsed. */ public static int[] parseVersion(String version) { if (version != null && version.startsWith("git/")) return splitVersion(version.substring("git/".length())); return invalidVersion(); }
/** * Check if a Git client has the known push status bug. * <p> * These buggy clients do not display the status report from a failed push * over HTTP. * * @param version * parsed version of the Git client software. * @return true if the bug is present. */ 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. }
/** * Check if a Git client has the known chunked request body encoding bug. * <p> * Git 1.7.5 contains a unique bug where chunked requests are malformed. * This applies to both fetch and push. * * @param version * parsed version of the Git client software. * @param request * incoming HTTP request. * @return true if the client has the chunked encoding bug. */ public static boolean hasChunkedEncodingRequestBug( int[] version, HttpServletRequest request) { return compare(version, v1_7_5) == 0 && isChunked(request); }
/** * Check if a Git client has the known chunked request body encoding bug. * <p> * Git 1.7.5 contains a unique bug where chunked requests are malformed. * This applies to both fetch and push. * * @param version * parsed version of the Git client software. * @param request * incoming HTTP request. * @return true if the client has the chunked encoding bug. */ public static boolean hasChunkedEncodingRequestBug( int[] version, HttpServletRequest request) { return compare(version, v1_7_5) == 0 && isChunked(request); }