MCPcopy Create free account
hub / github.com/apache/cloudberry / get

Method get

gpcontrib/gpcloud/src/s3restful_service.cpp:146–178  ·  view source on GitHub ↗

get() will execute HTTP GET RESTful API with given url/headers/params, and return raw response content. This method does not care about response format, caller need to handle response format accordingly.

Source from the content-addressed store, hash-verified

144// This method does not care about response format, caller need to handle
145// response format accordingly.
146Response S3RESTfulService::get(const string &url, HTTPHeaders &headers) {
147 Response response(RESPONSE_ERROR, this->s3MemContext);
148 response.getRawData().reserve(this->chunkBufferSize);
149
150 headers.CreateList();
151 CURLWrapper wrapper(url, headers.GetList(), this->lowSpeedLimit, this->lowSpeedTime,
152 this->debugCurl, this->proxy);
153 CURL *curl = wrapper.curl;
154
155 curl_easy_setopt(curl, CURLOPT_WRITEDATA, (void *)&response);
156 curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, RESTfulServiceWriteFuncCallback);
157 curl_easy_setopt(curl, CURLOPT_SSL_VERIFYPEER, this->verifyCert);
158
159 this->performCurl(curl, response);
160
161 if (response.getStatus() == RESPONSE_OK) {
162 return response;
163 }
164
165 S3MessageParser s3msg(response);
166 ResponseCode responseCode = response.getResponseCode();
167
168 if ((responseCode == 500) || (responseCode == 503)) {
169 S3_DIE(S3ConnectionError, s3msg.getMessage());
170 }
171 if (responseCode == 400) {
172 if (s3msg.getCode().compare("RequestTimeout") == 0) {
173 S3_DIE(S3ConnectionError, s3msg.getMessage());
174 }
175 }
176
177 return response;
178}
179
180Response S3RESTfulService::put(const string &url, HTTPHeaders &headers, const S3VectorUInt8 &data) {
181 Response response(RESPONSE_ERROR);

Callers 3

TESTFunction · 0.45
TEST_FFunction · 0.45

Calls 8

performCurlMethod · 0.95
CreateListMethod · 0.80
GetListMethod · 0.80
getStatusMethod · 0.80
getResponseCodeMethod · 0.80
getRawDataMethod · 0.45
getMessageMethod · 0.45
getCodeMethod · 0.45

Tested by 2

TESTFunction · 0.36
TEST_FFunction · 0.36