MCPcopy Create free account
hub / github.com/actor-framework/actor-framework / exec

Method exec

libcaf_net/caf/net/http/route.cpp:54–74  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

52}
53
54bool http_simple_route_base::exec(const net::http::request_header& hdr,
55 const_byte_span body,
56 net::http::router* parent) {
57 if (method_ && *method_ != hdr.method())
58 return false;
59 // Header might return a relative path when the HTTP request came with a
60 // request-target in absolute form. See discussion in PR #2079.
61 // Note: `net::http::make_route` enforces an absolute path.
62 auto path_compare = [](std::string_view path, std::string_view hdr_path) {
63 if (hdr_path.empty() || hdr_path.front() != '/')
64 return path.substr(1) == hdr_path;
65 else
66 return path == hdr_path;
67 };
68 if (path_compare(path_, hdr.path())) {
69 net::http::responder rp{&hdr, body, parent};
70 do_apply(rp);
71 return true;
72 }
73 return false;
74}
75
76} // namespace caf::detail

Callers 3

caf_mainFunction · 0.45
WITH_FIXTUREFunction · 0.45
consumeMethod · 0.45

Calls 4

substrMethod · 0.80
pathMethod · 0.80
emptyMethod · 0.45
frontMethod · 0.45

Tested by 1

WITH_FIXTUREFunction · 0.36