c++ - 从 Windows PC 向 https url 发布 json 请求时出现 SSL 连接错误的原因可能是什么?
问题描述
我在 Visual Studio 中将 libcurl.dll 版本 7.72.0.0 用于 C++ 应用程序。
当我在一台带有 Service Pack 1 的 Windows 7 PC 上向 HTTPS url 发布 JSON 请求时,请求已成功发布。但是在与 Windows 7 Service Pack 1 具有相同操作系统的其他 PC 上,我从以下位置获得响应代码 35 curl_easy_perform()
:SSL 连接错误。
相同的 C++ 代码在一台 Windows 7 PC 上运行而在另一台 Windows 7 PC 上出现错误的原因可能是什么?两台电脑都在同一个网络上。
以下是 C++ 代码:
curl_easy_setopt(curl, CURLOPT_URL, Url.c_str());
curl_easy_setopt(curl, CURLOPT_HTTPHEADER, header);
// send all data to this function
curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, WriteMemoryCallback);
// we pass our 'chunk' struct to the callback function
curl_easy_setopt(curl, CURLOPT_WRITEDATA, (void *)&sResponse);
//some servers don't like requests that are made without a user-agent
// field, so we provide one
curl_easy_setopt(curl, CURLOPT_USERAGENT, "libcurl-agent/1.0");
curl_easy_setopt(curl, CURLOPT_POSTFIELDS, postthis);
printf("\npostthisData=%s\n", postthis);
if (itsHTTPSRequest)
curl_easy_setopt(curl, CURLOPT_SSL_VERIFYPEER, 0);
// if we don't provide POSTFIELDSIZE, libcurl will strlen() by
// itself
curl_easy_setopt(curl, CURLOPT_POSTFIELDSIZE, (long)strlen(postthis));
curl_easy_setopt( curl, CURLOPT_CONNECTTIMEOUT, m_RWTimeOut );
curl_easy_setopt( curl, CURLOPT_LOW_SPEED_TIME, m_RWTimeOut);
curl_easy_setopt( curl, CURLOPT_LOW_SPEED_LIMIT, 30L);
解决方案
推荐阅读
- android - Android Studio kotlin 应用程序“不断停止”错误
- c# - 为什么 Entity Framework Core 试图将我的字符串键转换为整数?
- google-chrome - Blazor Set-Cookie 无效
- javascript - npm run build 不起作用,而 npm run dev 起作用,NuxtJS
- python - Pytorch affine_grid 在图像和地标上的行为不同
- android - Create Zip file where the contents are a bitmaps for Android Kotlin
- pandas - 按日期对数据框进行分组并创建一个新的平均分数数据框
- c# - 使用数据绑定,如何将包含表情符号的文本绑定到标签并使其正确显示?
- ios - 如何在导航栏下显示侧边菜单?
- c - C中的阿姆斯特朗数