@@ -605,6 +605,51 @@ test_expect_success 'access using bearer auth with invalid credentials' '
605605 EOF
606606'
607607
608+ test_expect_success ' clone with bearer auth and probe_rpc' '
609+ test_when_finished "per_test_cleanup" &&
610+ test_when_finished "rm -rf large.git" &&
611+
612+ # Set up a repository large enough to trigger probe_rpc
613+ git init large.git &&
614+ (
615+ cd large.git &&
616+ git config set maintenance.auto false &&
617+ git commit --allow-empty --message "initial" &&
618+ # Create many refs to trigger probe_rpc, which is called when
619+ # the request body is larger than http.postBuffer.
620+ #
621+ # In the test later, http.postBuffer is set to 70000. Each
622+ # "want" line is ~45 bytes, so we need at least 70000/45 = ~1600
623+ # refs
624+ test_seq -f "create refs/heads/branch-%d @" 2000 |
625+ git update-ref --stdin
626+ ) &&
627+ git clone --bare large.git "$HTTPD_DOCUMENT_ROOT_PATH/large.git" &&
628+
629+ # Clone it through HTTP with a Bearer token
630+ set_credential_reply get <<-EOF &&
631+ capability[]=authtype
632+ authtype=Bearer
633+ credential=YS1naXQtdG9rZW4=
634+ EOF
635+
636+ # Bearer token
637+ cat >"$HTTPD_ROOT_PATH/custom-auth.valid" <<-EOF &&
638+ id=1 creds=Bearer YS1naXQtdG9rZW4=
639+ EOF
640+
641+ cat >"$HTTPD_ROOT_PATH/custom-auth.challenge" <<-EOF &&
642+ id=1 status=200
643+ id=default response=WWW-Authenticate: Bearer authorize_uri="id.example.com"
644+ EOF
645+
646+ # Set a small buffer to force probe_rpc to be called
647+ # Must be > LARGE_PACKET_MAX (65520)
648+ test_config_global http.postBuffer 70000 &&
649+ test_config_global credential.helper test-helper &&
650+ git clone "$HTTPD_URL/custom_auth/large.git" partial-auth-clone 2>clone-error
651+ '
652+
608653test_expect_success ' access using three-legged auth' '
609654 test_when_finished "per_test_cleanup" &&
610655
0 commit comments