diff options
author | Tay Ray Chuan <rctay89@gmail.com> | 2009-02-14 17:52:14 +0800 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2009-02-15 00:57:43 -0800 |
commit | dfab7c144eb2f02fc1481173422ecc416a060155 (patch) | |
tree | 5969a39c8fb87bee085cc97c9345b539d04e5dcf /t/t5540-http-push.sh | |
parent | 2d20b7ebf672c28b18da4558d96f100613e4e4ca (diff) | |
download | git-dfab7c144eb2f02fc1481173422ecc416a060155.tar.gz |
use a hash of the lock token as the suffix for PUT/MOVE
After 753bc91 ("Remove the requirement opaquelocktoken uri scheme"),
lock tokens are in the URI forms in which they are received from the
server, eg. 'opaquelocktoken:', 'urn:uuid:'.
However, "start_put" (and consequently "start_move"), which attempts to
create a unique temporary file using the UUID of the lock token,
inadvertently uses the lock token in its URI form. These file
operations on the server may not be successful (specifically, in
Windows), due to the colon ':' character from the URI form of the lock
token in the file path.
This patch uses a hash of the lock token instead, guaranteeing only
"safe" characters (a-f, 0-9) are used in the file path.
The token's hash is generated when the lock token is received from the
server in handle_new_lock_ctx, minimizing the number of times of
hashing.
Signed-off-by: Tay Ray Chuan <rctay89@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/t5540-http-push.sh')
-rwxr-xr-x | t/t5540-http-push.sh | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/t/t5540-http-push.sh b/t/t5540-http-push.sh index c236b5e83b..11b343274f 100755 --- a/t/t5540-http-push.sh +++ b/t/t5540-http-push.sh @@ -94,6 +94,13 @@ test_expect_success 'MKCOL sends directory names with trailing slashes' ' ' +test_expect_success 'PUT and MOVE sends object to URLs with SHA-1 hash suffix' ' + + grep -P "\"(?:PUT|MOVE) .+objects/[\da-z]{2}/[\da-z]{38}_[\da-z\-]{40} HTTP/[0-9.]+\" 20\d" \ + < "$HTTPD_ROOT_PATH"/access.log + +' + stop_httpd test_done |