aboutsummaryrefslogtreecommitdiff
path: root/t/t5563-simple-http-auth.sh
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2026-02-05 15:41:58 -0800
committerJunio C Hamano <gitster@pobox.com>2026-02-05 15:41:58 -0800
commit4ae96a4c0e494f5fdb7ae38ea00f6afc71fd5e6f (patch)
tree54d78fd75a32581b3cac37107df0ce1a03a9c1a9 /t/t5563-simple-http-auth.sh
parentc3a5261dc0e726b5d8ee6309afcad9d431a4b50c (diff)
parented0f7a62f75232896eccb622bfaf9fe56903a261 (diff)
downloadgit-4ae96a4c0e494f5fdb7ae38ea00f6afc71fd5e6f.tar.xz
Merge branch 'ap/http-probe-rpc-use-auth'
HTTP transport failed to authenticate in some code paths, which has been corrected. * ap/http-probe-rpc-use-auth: remote-curl: use auth for probe_rpc() requests too
Diffstat (limited to 't/t5563-simple-http-auth.sh')
-rwxr-xr-xt/t5563-simple-http-auth.sh45
1 files changed, 45 insertions, 0 deletions
diff --git a/t/t5563-simple-http-auth.sh b/t/t5563-simple-http-auth.sh
index c1febbae9d..0063581615 100755
--- a/t/t5563-simple-http-auth.sh
+++ b/t/t5563-simple-http-auth.sh
@@ -605,6 +605,51 @@ test_expect_success 'access using bearer auth with invalid credentials' '
EOF
'
+test_expect_success 'clone with bearer auth and probe_rpc' '
+ test_when_finished "per_test_cleanup" &&
+ test_when_finished "rm -rf large.git" &&
+
+ # Set up a repository large enough to trigger probe_rpc
+ git init large.git &&
+ (
+ cd large.git &&
+ git config set maintenance.auto false &&
+ git commit --allow-empty --message "initial" &&
+ # Create many refs to trigger probe_rpc, which is called when
+ # the request body is larger than http.postBuffer.
+ #
+ # In the test later, http.postBuffer is set to 70000. Each
+ # "want" line is ~45 bytes, so we need at least 70000/45 = ~1600
+ # refs
+ test_seq -f "create refs/heads/branch-%d @" 2000 |
+ git update-ref --stdin
+ ) &&
+ git clone --bare large.git "$HTTPD_DOCUMENT_ROOT_PATH/large.git" &&
+
+ # Clone it through HTTP with a Bearer token
+ set_credential_reply get <<-EOF &&
+ capability[]=authtype
+ authtype=Bearer
+ credential=YS1naXQtdG9rZW4=
+ EOF
+
+ # Bearer token
+ cat >"$HTTPD_ROOT_PATH/custom-auth.valid" <<-EOF &&
+ id=1 creds=Bearer YS1naXQtdG9rZW4=
+ EOF
+
+ cat >"$HTTPD_ROOT_PATH/custom-auth.challenge" <<-EOF &&
+ id=1 status=200
+ id=default response=WWW-Authenticate: Bearer authorize_uri="id.example.com"
+ EOF
+
+ # Set a small buffer to force probe_rpc to be called
+ # Must be > LARGE_PACKET_MAX (65520)
+ test_config_global http.postBuffer 70000 &&
+ test_config_global credential.helper test-helper &&
+ git clone "$HTTPD_URL/custom_auth/large.git" partial-auth-clone 2>clone-error
+'
+
test_expect_success 'access using three-legged auth' '
test_when_finished "per_test_cleanup" &&