Used in UT, don't be static
| 1156 | |
| 1157 | // Used in UT, don't be static |
| 1158 | const Server::MethodProperty* |
| 1159 | FindMethodPropertyByURI(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 | |
| 1182 | ParseResult ParseHttpMessage(butil::IOBuf *source, Socket *socket, |
| 1183 | bool read_eof, const void* arg) { |