From fe97aad6754da72fcd776273b058d319ea0a1904 Mon Sep 17 00:00:00 2001 From: houjiahui Date: Tue, 10 Jun 2025 08:20:39 +0000 Subject: [PATCH] opt ipv6 create netchain Signed-off-by: houjiahui --- frameworks/native/http/http_client/http_client_task.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/frameworks/native/http/http_client/http_client_task.cpp b/frameworks/native/http/http_client/http_client_task.cpp index 2924cad5e..50e8fa340 100644 --- a/frameworks/native/http/http_client/http_client_task.cpp +++ b/frameworks/native/http/http_client/http_client_task.cpp @@ -31,6 +31,7 @@ #include "timing.h" #if HAS_NETMANAGER_BASE #include "http_client_network_message.h" +#include "netsys_client.h" #endif #include "netstack_hisysevent.h" @@ -467,7 +468,11 @@ bool HttpClientTask::SetCurlOptions() NETSTACK_CURL_EASY_SET_OPTION(curlHandle_, CURLOPT_POSTFIELDSIZE, request_.GetBody().size()); } } - +#if HAS_NETMANAGER_BASE + if (!NetSysIsIpv6Enable(0)) { + NETSTACK_CURL_EASY_SET_OPTION(curl, CURLOPT_IPRESOLVE, CURL_IPRESOLVE_V4, context); + } +#endif NETSTACK_CURL_EASY_SET_OPTION(curlHandle_, CURLOPT_XFERINFOFUNCTION, ProgressCallback); NETSTACK_CURL_EASY_SET_OPTION(curlHandle_, CURLOPT_XFERINFODATA, this); NETSTACK_CURL_EASY_SET_OPTION(curlHandle_, CURLOPT_NOPROGRESS, 0L); -- Gitee