| 65 | } |
| 66 | |
| 67 | url_mapping * |
| 68 | UrlMappingPathIndex::Search(URL *request_url, int request_port, bool normal_search /* = true */) const |
| 69 | { |
| 70 | url_mapping *retval = nullptr; |
| 71 | int scheme_idx; |
| 72 | UrlMappingTrie *trie; |
| 73 | int path_len; |
| 74 | const char *path; |
| 75 | |
| 76 | trie = _GetTrie(request_url, scheme_idx, request_port, normal_search); |
| 77 | |
| 78 | if (!trie) { |
| 79 | Dbg(dbg_ctl_UrlMappingPathIndex_Search, "No mappings exist for scheme index, port combo <%d, %d>", scheme_idx, request_port); |
| 80 | goto lFail; |
| 81 | } |
| 82 | |
| 83 | path = request_url->path_get(&path_len); |
| 84 | if (!(retval = trie->Search(path, path_len))) { |
| 85 | Dbg(dbg_ctl_UrlMappingPathIndex_Search, "Couldn't find entry for url with path [%.*s]", path_len, path); |
| 86 | goto lFail; |
| 87 | } |
| 88 | return retval; |
| 89 | |
| 90 | lFail: |
| 91 | return nullptr; |
| 92 | } |
| 93 | |
| 94 | void |
| 95 | UrlMappingPathIndex::Print() const |