From d5fd324fe9e5344569eb9277a7e02d4885dcc35e Mon Sep 17 00:00:00 2001
From: Petr Shumilov
Date: Thu, 27 Nov 2025 11:45:01 +0300
Subject: [PATCH] Mark CURLOPT_USERPWD as unsupported but available option
Signed-off-by: Petr Shumilov
---
builtin-functions/kphp-light/stdlib/curl-functions.txt | 2 +-
runtime-light/stdlib/curl/curl-easy-functions.h | 4 +++-
runtime-light/stdlib/curl/defs.h | 2 +-
3 files changed, 5 insertions(+), 3 deletions(-)
diff --git a/builtin-functions/kphp-light/stdlib/curl-functions.txt b/builtin-functions/kphp-light/stdlib/curl-functions.txt
index a967f582eb..0a98fc3efd 100644
--- a/builtin-functions/kphp-light/stdlib/curl-functions.txt
+++ b/builtin-functions/kphp-light/stdlib/curl-functions.txt
@@ -148,7 +148,7 @@ define('CURLOPT_SSL_CIPHER_LIST', 10083);
define('CURLOPT_URL', 10002);
define('CURLOPT_USERAGENT', 10018);
define('CURLOPT_USERNAME', 10173);
-// define('CURLOPT_USERPWD', 10005);
+define('CURLOPT_USERPWD', 10005);
// define('CURLOPT_HTTP200ALIASES', 10104);
define('CURLOPT_HTTPHEADER', 10023);
// define('CURLOPT_POSTQUOTE', 10039);
diff --git a/runtime-light/stdlib/curl/curl-easy-functions.h b/runtime-light/stdlib/curl/curl-easy-functions.h
index bbee15c61e..33c5211ef3 100644
--- a/runtime-light/stdlib/curl/curl-easy-functions.h
+++ b/runtime-light/stdlib/curl/curl-easy-functions.h
@@ -182,7 +182,6 @@ inline auto f$curl_setopt(kphp::web::curl::easy_type easy_id, int64_t option, co
case kphp::web::curl::CURLOPT::URL:
case kphp::web::curl::CURLOPT::USERAGENT:
case kphp::web::curl::CURLOPT::USERNAME:
- // case kphp::web::curl::CURLOPT::USERPWD:
case kphp::web::curl::CURLOPT::ACCEPT_ENCODING: {
auto res{kphp::web::set_transfer_property(st, option, kphp::web::property_value::as_string(value.to_string()))};
if (!res.has_value()) [[unlikely]] {
@@ -383,6 +382,9 @@ inline auto f$curl_setopt(kphp::web::curl::easy_type easy_id, int64_t option, co
easy_ctx.set_errno(kphp::web::curl::CURLE::OK);
return true;
}
+ case kphp::web::curl::CURLOPT::USERPWD: {
+ kphp::log::error("Unsupported CURL options");
+ }
default:
easy_ctx.set_errno(kphp::web::curl::CURLE::UNKNOWN_OPTION);
return false;
diff --git a/runtime-light/stdlib/curl/defs.h b/runtime-light/stdlib/curl/defs.h
index 8add88083a..451bc86026 100644
--- a/runtime-light/stdlib/curl/defs.h
+++ b/runtime-light/stdlib/curl/defs.h
@@ -173,7 +173,7 @@ enum class CURLOPT : uint64_t {
URL = 10002,
USERAGENT = 10018,
USERNAME = 10173,
- // USERPWD = 10005,
+ USERPWD = 10005,
// HTTP200ALIASES = 10104,
HTTPHEADER = 10023,