" CURLE_OUT_OF_MEMORY"通过https发布时出错 [英] "CURLE_OUT_OF_MEMORY" error when posting via https
问题描述
我正在尝试编写一个使用libCurl将肥皂请求发布到安全Web服务的应用程序.此Windows应用程序是基于libCurl 7.19.0版构建的,而libCurl版本是7.1opens-0.9.8i构建的.与curl相关的相关代码如下:
I am attempting to write an application that uses libCurl to post soap requests to a secure web service. This Windows application is built against libCurl version 7.19.0 which, in turn, is built against openssl-0.9.8i. The pertinent curl related code follows:
FILE *input_file = fopen(current->post_file_name.c_str(), "rb");
FILE *output_file = fopen(current->results_file_name.c_str(), "wb");
if(input_file && output_file)
{
struct curl_slist *header_opts = 0;
CURLcode rcd;
header_opts = curl_slist_append(header_opts, "Content-Type: application/soap+xml; charset=utf8");
curl_easy_reset(curl_handle);
curl_easy_setopt(curl_handle, CURLOPT_NOPROGRESS, 1);
curl_easy_setopt(curl_handle, CURLOPT_WRITEDATA, output_file);
curl_easy_setopt(curl_handle, CURLOPT_READDATA, input_file);
curl_easy_setopt(curl_handle, CURLOPT_URL, fs_service_url);
curl_easy_setopt(curl_handle, CURLOPT_POST, 1);
curl_easy_setopt(curl_handle, CURLOPT_HTTPHEADER, header_opts);
rcd = curl_easy_perform(curl_handle);
if(rcd != 0)
{
current->curl_result = rcd;
current->curl_error = curl_easy_strerror(rcd);
}
curl_slist_free_all(header_opts);
}
当我尝试执行URL时,curl返回一个CURLE_OUT_OF_MEMORY错误,该错误似乎与分配SSL上下文失败有关.有人遇到过这个问题吗?
When I attempt to execute the URL, curl returns an CURLE_OUT_OF_MEMORY error which appears to be related to a failure to allocate an SSL context. Has anyone else encountered this problem before?
推荐答案
经过进一步调查,我发现此错误是由于无法通过调用SSL_library_init()初始化openSSL库而引起的.
After further investigation, I found that this error was due to a failure to initialise the openSSL library by calling SSL_library_init().
这篇关于" CURLE_OUT_OF_MEMORY"通过https发布时出错的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!