From fb3104680a9fe120286e7ff55fe3bd42cfe18415 Mon Sep 17 00:00:00 2001 From: Khairul Azhar Kasmiran Date: Fri, 15 Nov 2024 21:51:06 +0800 Subject: [PATCH] socket_http.c: Show curl error on failure --- librz/socket/socket_http.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/librz/socket/socket_http.c b/librz/socket/socket_http.c index 0682d9b236b..e8ed020f491 100644 --- a/librz/socket/socket_http.c +++ b/librz/socket/socket_http.c @@ -199,12 +199,17 @@ static char *socket_http_get_recursive(const char *url, int *code, int *rlen, ut if (!RZ_STR_ISEMPTY(curl_env) && atoi(curl_env)) { int len; char *escaped_url = rz_str_escape_sh(url); - char *command = rz_str_newf("curl -sfL -o - \"%s\"", escaped_url); - char *res = rz_sys_cmd_str(command, NULL, &len); + char *command = rz_str_newf("curl -sSfL -o - \"%s\"", escaped_url); + char *res = NULL; + char *err = NULL; + int ret = rz_sys_cmd_str_full(command, NULL, &res, &len, &err); free(escaped_url); free(command); free(curl_env); - if (!res) { + if (err) { + eprintf("%s", err); + } + if (!ret || !res) { return NULL; } if (res) {