我正在尝试编写一个使用libCurl将SOAP请求发布到安全Web服务的应用程序.此Windows应用程序是针对libCurl版本7.19.0构建的,而后者又是针对openssl-0.9.8i构建的.相关的卷曲相关代码如下:
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上下文失败有关.有没有其他人遇到过这个问题?
我有同样的问题,只是想我添加注释,而不是直接调用OpenSsl导出SSL_library_init它可以通过添加标志CURL_GLOBAL_SSL到curl_global_init来修复