MCPcopy Create free account
hub / github.com/Vector35/binaryninja-api / PerformCustomRequestCallback

Method PerformCustomRequestCallback

downloadprovider.cpp:60–92  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

58
59
60int DownloadInstance::PerformCustomRequestCallback(void* ctxt, const char* method, const char* url,
61 uint64_t headerCount, const char* const* headerKeys, const char* const* headerValues,
62 BNDownloadInstanceResponse** response)
63{
64 CallbackRef<DownloadInstance> instance(ctxt);
65 unordered_map<string, string> headers;
66 for (uint64_t i = 0; i < headerCount; i++)
67 {
68 headers[headerKeys[i]] = headerValues[i];
69 }
70
71 Response apiResponse;
72 int status = instance->PerformCustomRequest(method, url, headers, apiResponse);
73
74 char** keys = new char*[apiResponse.headers.size()];
75 char** values = new char*[apiResponse.headers.size()];
76
77 uint64_t i = 0;
78 for (const auto& pair : apiResponse.headers)
79 {
80 keys[i] = BNAllocString(pair.first.c_str());
81 values[i] = BNAllocString(pair.second.c_str());
82 i++;
83 }
84
85 *response = new BNDownloadInstanceResponse;
86 (*response)->statusCode = apiResponse.statusCode;
87 (*response)->headerCount = apiResponse.headers.size();
88 (*response)->headerKeys = keys;
89 (*response)->headerValues = values;
90
91 return status;
92}
93
94
95void DownloadInstance::PerformFreeResponse(void* ctxt, BNDownloadInstanceResponse* response)

Callers

nothing calls this directly

Calls 3

PerformCustomRequestMethod · 0.80
c_strMethod · 0.80
sizeMethod · 0.45

Tested by

no test coverage detected