@@ -439,9 +439,7 @@ static struct ref *get_refs_via_curl(struct transport *transport, int for_push)
439439 char * ref_name ;
440440 char * refs_url ;
441441 int i = 0 ;
442-
443- struct active_request_slot * slot ;
444- struct slot_results results ;
442+ int http_ret ;
445443
446444 struct ref * refs = NULL ;
447445 struct ref * ref = NULL ;
@@ -461,25 +459,16 @@ static struct ref *get_refs_via_curl(struct transport *transport, int for_push)
461459 refs_url = xmalloc (strlen (transport -> url ) + 11 );
462460 sprintf (refs_url , "%s/info/refs" , transport -> url );
463461
464- slot = get_active_slot ();
465- slot -> results = & results ;
466- curl_easy_setopt (slot -> curl , CURLOPT_FILE , & buffer );
467- curl_easy_setopt (slot -> curl , CURLOPT_WRITEFUNCTION , fwrite_buffer );
468- curl_easy_setopt (slot -> curl , CURLOPT_URL , refs_url );
469- curl_easy_setopt (slot -> curl , CURLOPT_HTTPHEADER , NULL );
470-
471- if (start_active_slot (slot )) {
472- run_active_slot (slot );
473- if (results .curl_result != CURLE_OK ) {
474- strbuf_release (& buffer );
475- if (missing_target (& results ))
476- die ("%s not found: did you run git update-server-info on the server?" , refs_url );
477- else
478- die ("%s download error - %s" , refs_url , curl_errorstr );
479- }
480- } else {
481- strbuf_release (& buffer );
482- die ("Unable to start HTTP request" );
462+ http_ret = http_get_strbuf (refs_url , & buffer , HTTP_NO_CACHE );
463+ switch (http_ret ) {
464+ case HTTP_OK :
465+ break ;
466+ case HTTP_MISSING_TARGET :
467+ die ("%s not found: did you run git update-server-info on the"
468+ " server?" , refs_url );
469+ default :
470+ http_error (refs_url , http_ret );
471+ die ("HTTP request failed" );
483472 }
484473
485474 data = buffer .buf ;
@@ -519,6 +508,7 @@ static struct ref *get_refs_via_curl(struct transport *transport, int for_push)
519508 free (ref );
520509 }
521510
511+ strbuf_release (& buffer );
522512 free (refs_url );
523513 return refs ;
524514}
0 commit comments