--- parser3/src/classes/curl.C 2025/05/26 00:52:15 1.76 +++ parser3/src/classes/curl.C 2026/07/13 21:42:16 1.79 @@ -1,7 +1,7 @@ /** @file Parser: @b curl parser class. - Copyright (c) 2001-2024 Art. Lebedev Studio (http://www.artlebedev.com) + Copyright (c) 2001-2026 Art. Lebedev Studio (https://www.artlebedev.com) Authors: Konstantin Morshnev */ @@ -18,7 +18,7 @@ #include "pa_http.h" #include "ltdl.h" -volatile const char * IDENT_CURL_C="$Id: curl.C,v 1.76 2025/05/26 00:52:15 moko Exp $"; +volatile const char * IDENT_CURL_C="$Id: curl.C,v 1.79 2026/07/13 21:42:16 moko Exp $"; class MCurl: public Methoded { public: @@ -176,7 +176,7 @@ static void _curl_session(Request& r, Me } static void _curl_version_action(Request& r, MethodParams& ){ - r.write(*new VString(*new String(f_curl_version(), String::L_TAINTED))); + r.write(*new VString(f_curl_version())); } static void _curl_version(Request& r, MethodParams& params){ @@ -644,7 +644,7 @@ static Value *curl_getinfo(const String: case CurlInfo::CURL_HTTP_VERSION:{ long l=0; CURL_GETINFO(l); - return new VString(*new String(curl_http_version_name(l), String::L_TAINTED)); + return new VString(curl_http_version_name(l)); } } return VVoid::get(); @@ -739,6 +739,9 @@ static void _curl_load_action(Request& r CURL_SETOPT(CURLOPT_WRITEFUNCTION, curl_writer, "curl writer function"); CURL_SETOPT(CURLOPT_WRITEDATA, &body, "curl write buffer"); + char error[CURL_ERROR_SIZE+1]=""; + CURL_SETOPT(CURLOPT_ERRORBUFFER, error, "curl error buffer"); + if(options().is_post && !options().has_content_length){ // libcurl bug walkaround. Prior to 7.38 (Debian Jessie) curl passed Content-length: -1 // after that no Content-length header is passed, that hangs request to nginx. @@ -767,7 +770,7 @@ static void _curl_load_action(Request& r check_file_size(response.content_length, new String(options().url)); break; default: break; } - throw Exception( PA_DEFAULT(ex_type, "curl.fail"), new String(options().url), "%s", f_curl_easy_strerror(res)); + throw Exception( PA_DEFAULT(ex_type, "curl.fail"), new String(options().url), "%s", error[0] ? error : f_curl_easy_strerror(res)); } // assure trailing zero