mirror of
https://github.com/ading2210/libcurl.js.git
synced 2025-05-13 14:30:02 -04:00
fix tls sockets
This commit is contained in:
parent
1748ca7dd9
commit
45b0084c79
8 changed files with 29 additions and 25 deletions
|
@ -8,7 +8,7 @@
|
|||
#include "util.h"
|
||||
|
||||
void http_set_options(CURL* http_handle, const char* json_params, const char* body, int body_length) {
|
||||
struct RequestInfo *request_info = get_handle_info(http_handle);
|
||||
struct RequestInfo *request_info = get_request_info(http_handle);
|
||||
|
||||
//some default options
|
||||
curl_easy_setopt(http_handle, CURLOPT_FOLLOWLOCATION, 1);
|
||||
|
@ -18,7 +18,7 @@ void http_set_options(CURL* http_handle, const char* json_params, const char* bo
|
|||
//parse json options
|
||||
cJSON* request_json = cJSON_Parse(json_params);
|
||||
cJSON* item = NULL;
|
||||
struct curl_slist* headers_list = malloc(sizeof(struct curl_slist));
|
||||
struct curl_slist* headers_list = NULL;
|
||||
|
||||
cJSON_ArrayForEach(item, request_json) {
|
||||
char* key = item->string;
|
||||
|
@ -27,13 +27,6 @@ void http_set_options(CURL* http_handle, const char* json_params, const char* bo
|
|||
curl_easy_setopt(http_handle, CURLOPT_VERBOSE, 1L);
|
||||
}
|
||||
|
||||
if (strcmp(key, "_connect_only") == 0) {
|
||||
curl_easy_setopt(http_handle, CURLOPT_CONNECT_ONLY, 1L);
|
||||
curl_easy_setopt(http_handle, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_1);
|
||||
curl_easy_setopt(http_handle, CURLOPT_SSL_ENABLE_ALPN, 0L);
|
||||
request_info->prevent_cleanup = 1;
|
||||
}
|
||||
|
||||
if (strcmp(key, "method") == 0 && cJSON_IsString(item)) {
|
||||
curl_easy_setopt(http_handle, CURLOPT_CUSTOMREQUEST, item->valuestring);
|
||||
}
|
||||
|
@ -73,7 +66,7 @@ void http_set_options(CURL* http_handle, const char* json_params, const char* bo
|
|||
}
|
||||
|
||||
char* http_get_info(CURL* http_handle) {
|
||||
struct RequestInfo *request_info = get_handle_info(http_handle);
|
||||
struct RequestInfo *request_info = get_request_info(http_handle);
|
||||
|
||||
//create new json object with response info
|
||||
cJSON* response_json = cJSON_CreateObject();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue