return;\r
}\r
\r
+ // TODO: Maybe checking for clone bundle should be done somewhere else? Like other stuff?\r
+ // In any way, the access to the constant from here is messed up an needs some cleaning up.\r
+ if (GitFilter.CLONE_BUNDLE.equalsIgnoreCase(urlRequestType)) {\r
+ logger.info(MessageFormat.format("ARF: Rejecting request for {0}, clone bundle is not implemented.", repository));\r
+ httpResponse.sendError(HttpServletResponse.SC_NOT_IMPLEMENTED, "The 'clone.bundle' command is currently not implemented. " +\r
+ "Please use a normal clone command.");\r
+ return;\r
+ }\r
+\r
UserModel user = getUser(httpRequest);\r
\r
// Load the repository model\r
static final String GIT_RECEIVE_PACK = "/git-receive-pack";\r
\r
static final String GIT_UPLOAD_PACK = "/git-upload-pack";\r
+\r
+ static final String CLONE_BUNDLE = "/clone.bundle";\r
\r
static final String GIT_LFS = "/info/lfs";\r
\r
static final String[] SUFFIXES = {GIT_RECEIVE_PACK, GIT_UPLOAD_PACK, "/info/refs", "/HEAD",\r
- "/objects", GIT_LFS};\r
+ "/objects", GIT_LFS, CLONE_BUNDLE};\r
\r
private IStoredSettings settings;\r
\r
return GIT_UPLOAD_PACK;\r
} else if (suffix.startsWith(GIT_LFS)) {\r
return GIT_LFS;\r
+ } else if (suffix.startsWith(CLONE_BUNDLE)) {\r
+ return CLONE_BUNDLE;\r
} else {\r
return GIT_UPLOAD_PACK;\r
}\r
if (GIT_LFS.equals(action)) {\r
return false;\r
}\r
- \r
+ // Action is not implemened.\r
+ if (CLONE_BUNDLE.equals(action)) {\r
+ return false;\r
+ }\r
+\r
return settings.getBoolean(Keys.git.allowCreateOnPush, true);\r
}\r
\r
HttpGet request = new HttpGet(testURL);\r
\r
HttpResponse response = client.execute(request);\r
-\r
assertEquals(400, response.getStatusLine().getStatusCode());\r
}\r
\r
+ @Test\r
+ public void testInvalidURLCloneBundle() throws IOException {\r
+ final String testURL = GitBlitSuite.gitServletUrl + "/helloworld.git/clone.bundle";\r
+\r
+ HttpClient client = HttpClientBuilder.create().build();\r
+ HttpGet request = new HttpGet(testURL);\r
+\r
+ HttpResponse response = client.execute(request);\r
+ assertEquals(501, response.getStatusLine().getStatusCode());\r
+ String content = IOUtils.toString(response.getEntity().getContent(), "UTF-8");\r
+ assertNotNull(content);\r
+ }\r
+\r
}\r