generated from duckdb/extension-template
    
        
        - 
                Notifications
    You must be signed in to change notification settings 
- Fork 0
Open
Description
duckdb-curl-filesystem/src/httpfs_curl_client.cpp
Lines 202 to 236 in a27dd4a
| unique_ptr<HTTPResponse> Put(PutRequestInfo &info) override { | |
| if (state) { | |
| state->put_count++; | |
| state->total_bytes_sent += info.buffer_in_len; | |
| } | |
| auto curl_headers = TransformHeadersCurl(info.headers); | |
| // Add content type header from info | |
| curl_headers.Add("Content-Type: " + info.content_type); | |
| // transform parameters | |
| request_info->url = info.url; | |
| if (!info.params.extra_headers.empty()) { | |
| auto curl_params = TransformParamsCurl(info.params); | |
| request_info->url += "?" + curl_params; | |
| } | |
| CURLcode res; | |
| { | |
| curl_easy_setopt(*curl, CURLOPT_URL, request_info->url.c_str()); | |
| // Perform PUT | |
| curl_easy_setopt(*curl, CURLOPT_CUSTOMREQUEST, "PUT"); | |
| // Include PUT body | |
| curl_easy_setopt(*curl, CURLOPT_POSTFIELDS, const_char_ptr_cast(info.buffer_in)); | |
| curl_easy_setopt(*curl, CURLOPT_POSTFIELDSIZE, info.buffer_in_len); | |
| // Apply headers | |
| curl_easy_setopt(*curl, CURLOPT_HTTPHEADER, curl_headers ? curl_headers.headers : nullptr); | |
| res = curl->Execute(); | |
| } | |
| curl_easy_getinfo(*curl, CURLINFO_RESPONSE_CODE, &request_info->response_code); | |
| return TransformResponseCurl(res); | |
| } | 
Metadata
Metadata
Assignees
Labels
No labels