diff options
author | Grégoire Barbier <gb@gbarbier.org> | 2008-01-19 16:22:50 +0100 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2008-01-20 15:18:34 -0800 |
commit | 3057ded057f17add305cd38fe0b73173e94c540e (patch) | |
tree | 2c8a5ec604c07cc23a60c1521ae5cbf83bcbb175 /http-push.c | |
parent | 325ce3959ccee623eb973136f41741ca4e0ca56e (diff) | |
download | git-3057ded057f17add305cd38fe0b73173e94c540e.tar.gz |
http-push and http-fetch: handle URLs without trailing /
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>
Diffstat (limited to 'http-push.c')
-rw-r--r-- | http-push.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/http-push.c b/http-push.c index c221dce62c..b2b410df90 100644 --- a/http-push.c +++ b/http-push.c @@ -2169,6 +2169,7 @@ int main(int argc, char **argv) int i; int new_refs; struct ref *ref; + char *rewritten_url = NULL; setup_git_directory(); @@ -2236,6 +2237,14 @@ int main(int argc, char **argv) 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; @@ -2416,6 +2425,8 @@ int main(int argc, char **argv) } cleanup: + if (rewritten_url) + free(rewritten_url); if (info_ref_lock) unlock_remote(info_ref_lock); free(remote); |