|
|
| version 1.76, 2025/05/26 00:52:15 | version 1.79, 2026/07/13 21:42:16 |
|---|---|
| Line 1 | Line 1 |
| /** @file | /** @file |
| Parser: @b curl parser class. | 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 <moko@design.ru> | Authors: Konstantin Morshnev <moko@design.ru> |
| */ | */ |
| Line 176 static void _curl_session(Request& r, Me | Line 176 static void _curl_session(Request& r, Me |
| } | } |
| static void _curl_version_action(Request& r, MethodParams& ){ | 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){ | static void _curl_version(Request& r, MethodParams& params){ |
| Line 644 static Value *curl_getinfo(const String: | Line 644 static Value *curl_getinfo(const String: |
| case CurlInfo::CURL_HTTP_VERSION:{ | case CurlInfo::CURL_HTTP_VERSION:{ |
| long l=0; | long l=0; |
| CURL_GETINFO(l); | 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(); | return VVoid::get(); |
| Line 739 static void _curl_load_action(Request& r | Line 739 static void _curl_load_action(Request& r |
| CURL_SETOPT(CURLOPT_WRITEFUNCTION, curl_writer, "curl writer function"); | CURL_SETOPT(CURLOPT_WRITEFUNCTION, curl_writer, "curl writer function"); |
| CURL_SETOPT(CURLOPT_WRITEDATA, &body, "curl write buffer"); | 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){ | if(options().is_post && !options().has_content_length){ |
| // libcurl bug walkaround. Prior to 7.38 (Debian Jessie) curl passed Content-length: -1 | // 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. | // after that no Content-length header is passed, that hangs request to nginx. |
| Line 767 static void _curl_load_action(Request& r | Line 770 static void _curl_load_action(Request& r |
| check_file_size(response.content_length, new String(options().url)); break; | check_file_size(response.content_length, new String(options().url)); break; |
| default: 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 | // assure trailing zero |