Merge branch 'ap/http-probe-rpc-use-auth' into jch
HTTP transport failed to authenticate in some code pahts, which has been corrected. * ap/http-probe-rpc-use-auth: remote-curl: Use auth for probe_rpc() requests tooseen
commit
096c70570f
|
|
@ -877,6 +877,8 @@ static int probe_rpc(struct rpc_state *rpc, struct slot_results *results)
|
|||
headers = curl_slist_append(headers, rpc->hdr_content_type);
|
||||
headers = curl_slist_append(headers, rpc->hdr_accept);
|
||||
|
||||
headers = http_append_auth_header(&http_auth, headers);
|
||||
|
||||
curl_easy_setopt(slot->curl, CURLOPT_NOBODY, 0L);
|
||||
curl_easy_setopt(slot->curl, CURLOPT_POST, 1L);
|
||||
curl_easy_setopt(slot->curl, CURLOPT_URL, rpc->service_url);
|
||||
|
|
|
|||
|
|
@ -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
|
||||
printf "create refs/heads/branch-%d @\n" $(test_seq 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" &&
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue