MCPcopy Index your code
hub / github.com/git/git / normalize_curl_result

Function normalize_curl_result

http.c:1895–1918  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1893}
1894
1895void normalize_curl_result(CURLcode *result, long http_code,
1896 char *errorstr, size_t errorlen)
1897{
1898 /*
1899 * If we see a failing http code with CURLE_OK, we have turned off
1900 * FAILONERROR (to keep the server's custom error response), and should
1901 * translate the code into failure here.
1902 *
1903 * Likewise, if we see a redirect (30x code), that means we turned off
1904 * redirect-following, and we should treat the result as an error.
1905 */
1906 if (*result == CURLE_OK && http_code >= 300) {
1907 *result = CURLE_HTTP_RETURNED_ERROR;
1908 /*
1909 * Normally curl will already have put the "reason phrase"
1910 * from the server into curl_errorstr; unfortunately without
1911 * FAILONERROR it is lost, so we can give only the numeric
1912 * status code.
1913 */
1914 xsnprintf(errorstr, errorlen,
1915 "The requested URL returned error: %ld",
1916 http_code);
1917 }
1918}
1919
1920static int handle_curl_result(struct slot_results *results)
1921{

Callers 4

process_object_responseFunction · 0.85
fetch_objectFunction · 0.85
handle_curl_resultFunction · 0.85

Calls 1

xsnprintfFunction · 0.85

Tested by

no test coverage detected