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

Method PerformCustomRequest

downloadprovider.cpp:149–181  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

147
148
149int DownloadInstance::PerformCustomRequest(const string& method, const string& url,
150 const std::unordered_map<std::string, std::string>& headers, Response& response,
151 BNDownloadInstanceInputOutputCallbacks* callbacks)
152{
153 const char** headerKeys = new const char*[headers.size()];
154 const char** headerValues = new const char*[headers.size()];
155
156 uint64_t i = 0;
157 for (auto it = headers.begin(); it != headers.end(); ++it)
158 {
159 headerKeys[i] = it->first.c_str();
160 headerValues[i] = it->second.c_str();
161 i++;
162 }
163
164 BNDownloadInstanceResponse* bnResponse;
165
166 int result = BNPerformCustomRequest(
167 m_object, method.c_str(), url.c_str(), headers.size(), headerKeys, headerValues, &bnResponse, callbacks);
168
169 response.statusCode = bnResponse->statusCode;
170 for (uint64_t i = 0; i < bnResponse->headerCount; i++)
171 {
172 response.headers[bnResponse->headerKeys[i]] = bnResponse->headerValues[i];
173 }
174
175 BNFreeDownloadInstanceResponse(bnResponse);
176
177 delete[] headerKeys;
178 delete[] headerValues;
179
180 return result;
181}
182
183
184void DownloadInstance::DestroyInstance()

Callers 2

PerformFunction · 0.80

Calls 4

c_strMethod · 0.80
sizeMethod · 0.45
beginMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected