| 68 | } |
| 69 | |
| 70 | uint64_t |
| 71 | ParentConsistentHash::getPathHash(HttpRequestData *hrdata, ATSHash64 *h) |
| 72 | { |
| 73 | const char *url_string_ref = nullptr; |
| 74 | int len; |
| 75 | URL *ps_url = nullptr; |
| 76 | |
| 77 | // Use over-ride URL from HttpTransact::State's cache_info.parent_selection_url, if present. |
| 78 | if (hrdata->cache_info_parent_selection_url) { |
| 79 | ps_url = *(hrdata->cache_info_parent_selection_url); |
| 80 | if (ps_url) { |
| 81 | url_string_ref = ps_url->string_get_ref(&len); |
| 82 | if (url_string_ref && len > 0) { |
| 83 | // Print the over-ride URL |
| 84 | Dbg(dbg_ctl_parent_select, "Using Over-Ride String='%.*s'.", len, url_string_ref); |
| 85 | h->update(url_string_ref, len); |
| 86 | h->final(); |
| 87 | return h->get(); |
| 88 | } |
| 89 | } |
| 90 | } |
| 91 | |
| 92 | ps_url = hrdata->hdr->url_get(); |
| 93 | |
| 94 | // Always hash on '/' because paths returned by ATS are always stripped of it |
| 95 | h->update("/", 1); |
| 96 | |
| 97 | url_string_ref = ps_url->path_get(&len); |
| 98 | if (url_string_ref) { |
| 99 | h->update(url_string_ref, len); |
| 100 | } |
| 101 | |
| 102 | if (!ignore_query) { |
| 103 | url_string_ref = ps_url->query_get(&len); |
| 104 | if (url_string_ref) { |
| 105 | h->update("?", 1); |
| 106 | h->update(url_string_ref, len); |
| 107 | } |
| 108 | } |
| 109 | |
| 110 | h->final(); |
| 111 | |
| 112 | return h->get(); |
| 113 | } |
| 114 | |
| 115 | // Helper function to abstract calling ATSConsistentHash lookup_by_hashval() vs lookup(). |
| 116 | static pRecord * |