diff --git a/frameworks/native/http/http_client/http_client_task.cpp b/frameworks/native/http/http_client/http_client_task.cpp index 2924cad5ee6d688dc788d58d5acedc55cb5391d6..50e8fa340707d6e0595f2d4b9e5129066b708b8d 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);