summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 2064280)
raw | patch | inline | side by side (parent: 2064280)
author | Johannes Schindelin <Johannes.Schindelin@gmx.de> | |
Sat, 17 Jan 2009 15:11:51 +0000 (16:11 +0100) | ||
committer | Junio C Hamano <gitster@pobox.com> | |
Sun, 18 Jan 2009 02:19:46 +0000 (18:19 -0800) |
The function lock_remote() sends MKCOL requests to make leading
directories; However, if it does not put a forward slash '/' at the end of
the path, the server sends a 301 redirect.
By leaving the '/' in place, we can avoid this additional step.
Incidentally, at least one version of Curl (7.16.3) does not resend
credentials when it follows a 301 redirect, so this commit also fixes
a bug.
Original patch by Tay Ray Chuan <rctay89@gmail.com>.
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
directories; However, if it does not put a forward slash '/' at the end of
the path, the server sends a 301 redirect.
By leaving the '/' in place, we can avoid this additional step.
Incidentally, at least one version of Curl (7.16.3) does not resend
credentials when it follows a 301 redirect, so this commit also fixes
a bug.
Original patch by Tay Ray Chuan <rctay89@gmail.com>.
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
http-push.c | patch | blob | history | |
t/lib-httpd/apache.conf | patch | blob | history | |
t/t5540-http-push.sh | patch | blob | history |
diff --git a/http-push.c b/http-push.c
index 2f2099570077dcff20e217fd6b5b2bdcbdb80368..6ad853e2d01b4ee3b3ee282b30b8b7f374ae3d47 100644 (file)
--- a/http-push.c
+++ b/http-push.c
/* Make sure leading directories exist for the remote ref */
ep = strchr(url + strlen(remote->url) + 1, '/');
while (ep) {
- *ep = 0;
+ char saved_character = ep[1];
+ ep[1] = '\0';
slot = get_active_slot();
slot->results = &results;
curl_easy_setopt(slot->curl, CURLOPT_HTTPGET, 1);
free(url);
return NULL;
}
- *ep = '/';
+ ep[1] = saved_character;
ep = strchr(ep + 1, '/');
}
index 4717c2d33b70af6527f8951ec8a414e8caf87095..fdb19a50f11c8c71c9f7addcceeab8847558cc49 100644 (file)
--- a/t/lib-httpd/apache.conf
+++ b/t/lib-httpd/apache.conf
ServerName dummy
PidFile httpd.pid
DocumentRoot www
+LogFormat "%h %l %u %t \"%r\" %>s %b" common
+CustomLog access.log common
ErrorLog error.log
<IfDefine SSL>
diff --git a/t/t5540-http-push.sh b/t/t5540-http-push.sh
index da9588645cd9d0054440e5ed3ba14f630c44f506..22cfbb6a2d5ec6d274a19fa716e834138411caa5 100755 (executable)
--- a/t/t5540-http-push.sh
+++ b/t/t5540-http-push.sh
test_must_fail git show-ref --verify refs/remotes/origin/dev
'
+test_expect_success 'MKCOL sends directory names with trailing slashes' '
+
+ ! grep "\"MKCOL.*[^/] HTTP/[^ ]*\"" < "$HTTPD_ROOT_PATH"/access.log
+
+'
+
stop_httpd
test_done