MCPcopy Create free account
hub / github.com/git/git / probe_rpc

Function probe_rpc

remote-curl.c:879–907  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

877}
878
879static int probe_rpc(struct rpc_state *rpc, struct slot_results *results)
880{
881 struct active_request_slot *slot;
882 struct curl_slist *headers = http_copy_default_headers();
883 struct strbuf buf = STRBUF_INIT;
884 int err;
885
886 slot = get_active_slot();
887
888 headers = curl_slist_append(headers, rpc->hdr_content_type);
889 headers = curl_slist_append(headers, rpc->hdr_accept);
890 headers = http_append_auth_header(&http_auth, headers);
891
892 curl_easy_setopt(slot->curl, CURLOPT_NOBODY, 0L);
893 curl_easy_setopt(slot->curl, CURLOPT_POST, 1L);
894 curl_easy_setopt(slot->curl, CURLOPT_URL, rpc->service_url);
895 curl_easy_setopt(slot->curl, CURLOPT_ENCODING, NULL);
896 curl_easy_setopt(slot->curl, CURLOPT_POSTFIELDS, "0000");
897 curl_easy_setopt(slot->curl, CURLOPT_POSTFIELDSIZE, 4L);
898 curl_easy_setopt(slot->curl, CURLOPT_HTTPHEADER, headers);
899 curl_easy_setopt(slot->curl, CURLOPT_WRITEFUNCTION, fwrite_buffer);
900 curl_easy_setopt(slot->curl, CURLOPT_WRITEDATA, &buf);
901
902 err = run_slot(slot, results);
903
904 curl_slist_free_all(headers);
905 strbuf_release(&buf);
906 return err;
907}
908
909/*
910 * If flush_received is true, do not attempt to read any more; just use what's

Callers 1

post_rpcFunction · 0.85

Calls 5

get_active_slotFunction · 0.85
http_append_auth_headerFunction · 0.85
run_slotFunction · 0.85
strbuf_releaseFunction · 0.85

Tested by

no test coverage detected