MCPcopy Create free account
hub / github.com/ComodoSecurity/openedr / callback

Method callback

edrav2/eprj/jsonrpccpp/src/test/testhttpserver.cpp:44–70  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

42}
43
44int TestHttpServer::callback(void *cls, MHD_Connection *connection,
45 const char *url, const char *method,
46 const char *version, const char *upload_data,
47 size_t *upload_data_size, void **con_cls) {
48 (void)upload_data;
49 (void)upload_data_size;
50 (void)url;
51 (void)method;
52 (void)version;
53 TestHttpServer *_this = static_cast<TestHttpServer *>(cls);
54 if (*con_cls == NULL) {
55 *con_cls = cls;
56 _this->headers.clear();
57 } else {
58 MHD_get_connection_values(connection, MHD_HEADER_KIND, header_iterator,
59 cls);
60 struct MHD_Response *result = MHD_create_response_from_buffer(
61 _this->response.size(), (void *)_this->response.c_str(),
62 MHD_RESPMEM_MUST_COPY);
63 MHD_add_response_header(result, "Content-Type", "application/json");
64 MHD_add_response_header(result, "Access-Control-Allow-Origin", "*");
65 MHD_queue_response(connection, MHD_HTTP_OK, result);
66 MHD_destroy_response(result);
67 }
68
69 return MHD_YES;
70}
71
72int TestHttpServer::header_iterator(void *cls, MHD_ValueKind kind,
73 const char *key, const char *value) {

Callers 1

bio_call_callbackFunction · 0.45

Calls 8

MHD_add_response_headerFunction · 0.85
MHD_queue_responseFunction · 0.85
MHD_destroy_responseFunction · 0.85
clearMethod · 0.45
sizeMethod · 0.45
c_strMethod · 0.45

Tested by

no test coverage detected