@@ -77,7 +77,8 @@ static size_t ReceiveResponseHeader(char *buffer, size_t size, size_t nmemb, voi
7777HTTPRequestContext::HTTPRequestContext (const ke::AString &method, const ke::AString &url, json_t *data,
7878 struct curl_slist *headers, IChangeableForward *forward, cell_t value,
7979 long connectTimeout, long followLocation, long timeout)
80- : request(method, url, data), headers(headers), forward(forward), value(value), connectTimeout(connectTimeout), followLocation(followLocation), timeout(timeout)
80+ : request(data), method(method), url(url), headers(headers), forward(forward), value(value),
81+ connectTimeout(connectTimeout), followLocation(followLocation), timeout(timeout)
8182{}
8283
8384HTTPRequestContext::~HTTPRequestContext ()
@@ -99,22 +100,22 @@ void HTTPRequestContext::InitCurl()
99100 return ;
100101 }
101102
102- if (request. method .compare (" POST" ) == 0 )
103+ if (method.compare (" POST" ) == 0 )
103104 {
104105 curl_easy_setopt (curl, CURLOPT_POST, 1L );
105106 }
106- else if (request. method .compare (" PUT" ) == 0 )
107+ else if (method.compare (" PUT" ) == 0 )
107108 {
108109 curl_easy_setopt (curl, CURLOPT_UPLOAD, 1L );
109110 }
110- else if (request. method .compare (" PATCH" ) == 0 )
111+ else if (method.compare (" PATCH" ) == 0 )
111112 {
112- curl_easy_setopt (curl, CURLOPT_CUSTOMREQUEST, request. method .chars ());
113+ curl_easy_setopt (curl, CURLOPT_CUSTOMREQUEST, method.chars ());
113114 curl_easy_setopt (curl, CURLOPT_POST, 1L );
114115 }
115- else if (request. method .compare (" DELETE" ) == 0 )
116+ else if (method.compare (" DELETE" ) == 0 )
116117 {
117- curl_easy_setopt (curl, CURLOPT_CUSTOMREQUEST, request. method .chars ());
118+ curl_easy_setopt (curl, CURLOPT_CUSTOMREQUEST, method.chars ());
118119 }
119120
120121 curl_easy_setopt (curl, CURLOPT_ACCEPT_ENCODING, " " );
@@ -131,7 +132,7 @@ void HTTPRequestContext::InitCurl()
131132 curl_easy_setopt (curl, CURLOPT_READDATA, &request);
132133 curl_easy_setopt (curl, CURLOPT_READFUNCTION, &ReadRequestBody);
133134 curl_easy_setopt (curl, CURLOPT_TIMEOUT, timeout);
134- curl_easy_setopt (curl, CURLOPT_URL, request. url .chars ());
135+ curl_easy_setopt (curl, CURLOPT_URL, url.chars ());
135136 curl_easy_setopt (curl, CURLOPT_WRITEDATA, &response);
136137 curl_easy_setopt (curl, CURLOPT_WRITEFUNCTION, &WriteResponseBody);
137138}
0 commit comments