@@ -110,18 +110,26 @@ int my_trace(CURL *handle, curl_infotype type,
110110 text = "=> Send header" ;
111111 break ;
112112 case CURLINFO_DATA_OUT :
113+ // temporarily disable output for debugging
114+ return 0 ;
113115 text = "=> Send data" ;
114116 break ;
115117 case CURLINFO_SSL_DATA_OUT :
118+ // temporarily disable output for debugging
119+ return 0 ;
116120 text = "=> Send SSL data" ;
117121 break ;
118122 case CURLINFO_HEADER_IN :
119123 text = "<= Recv header" ;
120124 break ;
121125 case CURLINFO_DATA_IN :
126+ // temporarily disable output for debugging
127+ return 0 ;
122128 text = "<= Recv data" ;
123129 break ;
124130 case CURLINFO_SSL_DATA_IN :
131+ // temporarily disable output for debugging
132+ return 0 ;
125133 text = "<= Recv SSL data" ;
126134 break ;
127135 }
@@ -512,28 +520,49 @@ sf_bool STDCALL http_perform(CURL *curl,
512520 if (curl_error_buffer [0 ] != '\0' ) {
513521 log_error ("curl error buffer: %s" , curl_error_buffer );
514522 }
515- if (res == CURLE_COULDNT_CONNECT && curl_retry_ctx .retry_count <
516- (unsigned )retry_on_curle_couldnt_connect_count )
517- {
518- retry = SF_BOOLEAN_TRUE ;
519- uint32 next_sleep_in_secs = retry_ctx_next_sleep (& curl_retry_ctx );
520- log_error (
521- "curl_easy_perform() failed connecting to server on attempt %d, "
522- "will retry after %d second" ,
523- curl_retry_ctx .retry_count ,
524- next_sleep_in_secs );
525- sf_sleep_ms (next_sleep_in_secs * 1000 );
526- } else if ((res == CURLE_OPERATION_TIMEDOUT ) ||
527- (res == CURLE_PARTIAL_FILE )) {
528- // retry directly without backoff when timeout is triggered by renew
529- if ((res == CURLE_OPERATION_TIMEDOUT ) &&
530- (renew_timeout > 0 ) && (curl_timeout == renew_timeout ))
531- {
532- retry = SF_BOOLEAN_TRUE ;
533- }
534- // otherwise retry with backoff
535- else if (((uint64 )(time (NULL ) - elapsedRetryTime ) < curl_retry_ctx .retry_timeout ) &&
536- ((retry_max_count <= 0 ) || (curl_retry_ctx .retry_count < (unsigned )retry_max_count )))
523+ if (res == CURLE_COULDNT_CONNECT &&
524+ curl_retry_ctx .retry_count < (unsigned )retry_on_curle_couldnt_connect_count )
525+ {
526+ retry = SF_BOOLEAN_TRUE ;
527+ uint32 next_sleep_in_secs = retry_ctx_next_sleep (& curl_retry_ctx );
528+ log_error (
529+ "curl_easy_perform() failed connecting to server on attempt %d, "
530+ "will retry after %d second" ,
531+ curl_retry_ctx .retry_count ,
532+ next_sleep_in_secs );
533+ sf_sleep_ms (next_sleep_in_secs * 1000 );
534+ } else if ((res == CURLE_OPERATION_TIMEDOUT ) &&
535+ ((renew_timeout > 0 ) && (curl_timeout == renew_timeout )))
536+ // retry directly without backoff when timeout is triggered by renew
537+ {
538+ retry = SF_BOOLEAN_TRUE ;
539+ }
540+ // retry with backoff on any other curl error except particular non-retryable ones
541+ else {
542+ char msg [1024 ];
543+ if (res == CURLE_SSL_CACERT_BADFILE ) {
544+ sf_sprintf (msg , sizeof (msg ), "curl_easy_perform() failed. err: %s, CA Cert file: %s" ,
545+ curl_easy_strerror (res ), CA_BUNDLE_FILE ? CA_BUNDLE_FILE : "Not Specified" );
546+ msg [sizeof (msg ) - 1 ] = (char )0 ;
547+ log_error (msg );
548+ SET_SNOWFLAKE_ERROR (error , SF_STATUS_ERROR_CURL ,
549+ msg ,
550+ SF_SQLSTATE_UNABLE_TO_CONNECT );
551+ }
552+ else if (res == CURLE_SSL_INVALIDCERTSTATUS ) {
553+ log_error ("Detected CURLE_SSL_INVALIDCERTSTATUS (91) - likely OCSP/CRL validation failure." );
554+ SET_SNOWFLAKE_ERROR (error , SF_STATUS_ERROR_CURL ,
555+ msg ,
556+ SF_SQLSTATE_UNABLE_TO_CONNECT );
557+ }
558+ // otherwise retry with backoff
559+ else {
560+ sf_sprintf (msg , sizeof (msg ), "curl_easy_perform() failed: %s" , curl_easy_strerror (res ));
561+ msg [sizeof (msg ) - 1 ] = (char )0 ;
562+ log_warn (msg );
563+
564+ if (((uint64 )(time (NULL ) - elapsedRetryTime ) < curl_retry_ctx .retry_timeout ) &&
565+ ((retry_max_count <= 0 ) || (curl_retry_ctx .retry_count < (unsigned )retry_max_count )))
537566 {
538567 uint32 next_sleep_in_secs = retry_ctx_next_sleep (& curl_retry_ctx );
539568 log_debug (
@@ -553,24 +582,7 @@ sf_bool STDCALL http_perform(CURL *curl,
553582 SF_SQLSTATE_UNABLE_TO_CONNECT );
554583 }
555584 }
556- else {
557- char msg [1024 ];
558- if (res == CURLE_SSL_CACERT_BADFILE ) {
559- sf_sprintf (msg , sizeof (msg ), "curl_easy_perform() failed. err: %s, CA Cert file: %s" ,
560- curl_easy_strerror (res ), CA_BUNDLE_FILE ? CA_BUNDLE_FILE : "Not Specified" );
561- }
562- else {
563- sf_sprintf (msg , sizeof (msg ), "curl_easy_perform() failed: %s" , curl_easy_strerror (res ));
564- }
565- msg [sizeof (msg )- 1 ] = (char )0 ;
566- log_error (msg );
567- if (res == CURLE_SSL_INVALIDCERTSTATUS ) {
568- log_error ("Detected CURLE_SSL_INVALIDCERTSTATUS (91) - likely OCSP/CRL validation failure." );
569- }
570- SET_SNOWFLAKE_ERROR (error , SF_STATUS_ERROR_CURL ,
571- msg ,
572- SF_SQLSTATE_UNABLE_TO_CONNECT );
573- }
585+ }
574586 } else {
575587 if (curl_easy_getinfo (curl , CURLINFO_RESPONSE_CODE , & http_code ) !=
576588 CURLE_OK ) {
0 commit comments