MCPcopy Create free account
hub / github.com/LagPixelLOL/ChatGPTCLIBot / upload_binary

Function upload_binary

main/interface/network/Request.cpp:31–50  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

29 }
30
31 void upload_binary(const std::string& url, const std::function<void(const std::vector<char>&, CURL*)>& callback,
32 const std::string& post_data_field, const std::string& post_data,
33 const std::string& binary_field, const std::vector<char>& binary_to_upload,
34 const std::string& binary_filename, const std::string& binary_content_type,
35 const std::vector<std::string>& headers, const int& timeout_s,
36 const std::function<int(curl_off_t, curl_off_t, curl_off_t, curl_off_t)>& progress_callback) {
37 RequestObject request = RequestObject::construct_http_post(url, callback, "", headers, timeout_s, progress_callback);
38 request.mime = curl_mime_init(request.curl);
39 //Add post_data to mime.
40 curl_mimepart* part = curl_mime_addpart(request.mime);
41 curl_mime_name(part, post_data_field.c_str());
42 curl_mime_data(part, post_data.c_str(), CURL_ZERO_TERMINATED);
43 //Add binary_to_upload to mime.
44 part = curl_mime_addpart(request.mime);
45 curl_mime_name(part, binary_field.c_str());
46 curl_mime_filename(part, binary_filename.c_str());
47 curl_mime_type(part, binary_content_type.c_str());
48 curl_mime_data(part, binary_to_upload.data(), binary_to_upload.size());
49 request.perform();
50 }
51
52 void multi_perform(const std::vector<std::shared_ptr<RequestObject>>& requests) {
53 CURLM* multi_handle = curl_multi_init();

Callers

nothing calls this directly

Calls 2

performMethod · 0.80
sizeMethod · 0.45

Tested by

no test coverage detected