summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 325ce39)
raw | patch | inline | side by side (parent: 325ce39)
author | Grégoire Barbier <gb@gbarbier.org> | |
Sat, 19 Jan 2008 15:22:50 +0000 (16:22 +0100) | ||
committer | Junio C Hamano <gitster@pobox.com> | |
Sun, 20 Jan 2008 23:18:34 +0000 (15:18 -0800) |
The URL to a repository http-push and http-fetch takes should
have a trailing slash. Instead of failing the request, add it
ourselves before attempting such a request.
Signed-off-by: Junio C Hamano <gitster@pobox.com>
have a trailing slash. Instead of failing the request, add it
ourselves before attempting such a request.
Signed-off-by: Junio C Hamano <gitster@pobox.com>
builtin-http-fetch.c | patch | blob | history | |
http-push.c | patch | blob | history |
diff --git a/builtin-http-fetch.c b/builtin-http-fetch.c
index 4a50dbd95ba65b471a0e26f0b46bb8b60fda1ecb..7f450c61d95945862fc44bec99859a229269b224 100644 (file)
--- a/builtin-http-fetch.c
+++ b/builtin-http-fetch.c
const char **write_ref = NULL;
char **commit_id;
const char *url;
+ char *rewritten_url = NULL;
int arg = 1;
int rc = 0;
int get_tree = 0;
commits = 1;
}
url = argv[arg];
+ if (url && url[strlen(url)-1] != '/') {
+ rewritten_url = malloc(strlen(url)+2);
+ strcpy(rewritten_url, url);
+ strcat(rewritten_url, "/");
+ url = rewritten_url;
+ }
walker = get_http_walker(url);
walker->get_tree = get_tree;
walker_free(walker);
+ if (rewritten_url)
+ free(rewritten_url);
+
return rc;
}
diff --git a/http-push.c b/http-push.c
index c221dce62c16254c40c8c2a1f2d18dc3b55f20d9..b2b410df902f2a4f2bca634d82cf103d288c9042 100644 (file)
--- a/http-push.c
+++ b/http-push.c
int i;
int new_refs;
struct ref *ref;
+ char *rewritten_url = NULL;
setup_git_directory();
no_pragma_header = curl_slist_append(no_pragma_header, "Pragma:");
+ if (remote->url && remote->url[strlen(remote->url)-1] != '/') {
+ rewritten_url = malloc(strlen(remote->url)+2);
+ strcpy(rewritten_url, remote->url);
+ strcat(rewritten_url, "/");
+ remote->url = rewritten_url;
+ ++remote->path_len;
+ }
+
/* Verify DAV compliance/lock support */
if (!locking_available()) {
rc = 1;
}
cleanup:
+ if (rewritten_url)
+ free(rewritten_url);
if (info_ref_lock)
unlock_remote(info_ref_lock);
free(remote);