File tree Expand file tree Collapse file tree 1 file changed +5
-2
lines changed
Expand file tree Collapse file tree 1 file changed +5
-2
lines changed Original file line number Diff line number Diff line change @@ -543,9 +543,12 @@ static void send_error_to_erlang(CURLcode curl_code, ConnInfo *conn) {
543543 ei_x_buff result ;
544544 size_t error_msg_len ;
545545 const char * error_code ;
546+ const char * error_msg ;
546547
547548 error_code = curl_error_code (curl_code );
548- error_msg_len = strlen (conn -> error );
549+ /* Use ERRORBUFFER if available, otherwise fall back to curl_easy_strerror */
550+ error_msg = conn -> error [0 ] ? conn -> error : curl_easy_strerror (curl_code );
551+ error_msg_len = strlen (error_msg );
549552
550553 if (ei_x_new_with_version (& result ) ||
551554 ei_x_encode_tuple_header (& result , 2 ) ||
@@ -556,7 +559,7 @@ static void send_error_to_erlang(CURLcode curl_code, ConnInfo *conn) {
556559 ei_x_encode_ref (& result , conn -> ref ) ||
557560 ei_x_encode_tuple_header (& result , 3 ) ||
558561 ei_x_encode_atom (& result , error_code ) ||
559- ei_x_encode_binary (& result , conn -> error , error_msg_len )) {
562+ ei_x_encode_binary (& result , error_msg , error_msg_len )) {
560563 errx (2 , "Failed to encode result" );
561564 }
562565
You can’t perform that action at this time.
0 commit comments