MCPcopy Create free account
hub / github.com/apache/brpc / FindMethodPropertyByURI

Function FindMethodPropertyByURI

src/brpc/policy/http_rpc_protocol.cpp:1158–1180  ·  view source on GitHub ↗

Used in UT, don't be static

Source from the content-addressed store, hash-verified

1156
1157// Used in UT, don't be static
1158const Server::MethodProperty*
1159FindMethodPropertyByURI(const std::string& uri_path, const Server* server,
1160 std::string* unresolved_path) {
1161 const Server::MethodProperty* mp =
1162 FindMethodPropertyByURIImpl(uri_path, server, unresolved_path);
1163 if (mp != NULL) {
1164 if (mp->http_url != NULL && !mp->params.allow_default_url) {
1165 // the restful method is accessed from its
1166 // default url (SERVICE/METHOD) which should be rejected.
1167 return NULL;
1168 }
1169 return mp;
1170 }
1171 // uri_path cannot match any methods with exact service_name. Match
1172 // the fuzzy patterns in global restful map which often matches
1173 // extension names. Say "*.txt => get_text_file, *.mp4 => download_mp4".
1174 ServerPrivateAccessor accessor(server);
1175 if (accessor.global_restful_map()) {
1176 return accessor.global_restful_map()->FindMethodProperty(
1177 uri_path, unresolved_path);
1178 }
1179 return NULL;
1180}
1181
1182ParseResult ParseHttpMessage(butil::IOBuf *source, Socket *socket,
1183 bool read_eof, const void* arg) {

Callers 4

TESTFunction · 0.85
VerifyHttpRequestFunction · 0.85
ProcessHttpRequestFunction · 0.85
CheckProgressiveReadMethod · 0.85

Calls 3

global_restful_mapMethod · 0.80
FindMethodPropertyMethod · 0.80

Tested by 1

TESTFunction · 0.68