diff --git a/proxy/hdrs/URL.cc b/proxy/hdrs/URL.cc index 707a55402d2..21e768797be 100644 --- a/proxy/hdrs/URL.cc +++ b/proxy/hdrs/URL.cc @@ -25,7 +25,6 @@ #include #include "tscore/ink_platform.h" #include "tscore/ink_memory.h" -#include "tscore/TsBuffer.h" #include "URL.h" #include "MIME.h" #include "HTTP.h" @@ -1284,7 +1283,7 @@ url_parse_internet(HdrHeap *heap, URLImpl *url, const char **start, char const * const char *cur = *start; const char *base; // Base for host/port field. const char *bracket = nullptr; // marker for open bracket, if any. - ts::ConstBuffer user, passw, host, port; + swoc::TextView user, passw, host, port; static size_t const MAX_COLON = 8; // max # of valid colons. size_t n_colon = 0; const char *last_colon = nullptr; // pointer to last colon seen. @@ -1313,7 +1312,7 @@ url_parse_internet(HdrHeap *heap, URLImpl *url, const char **start, char const * stripping brackets from non-IPv6 content but that gets ugly as well. Just not worth it. */ - host.set(bracket, cur); + host.assign(bracket, cur); // Spec requires This constitute the entire host so the next // character must be missing (EOS), slash, or colon. if (cur >= end || '/' == *cur) { // done which is OK @@ -1339,12 +1338,12 @@ url_parse_internet(HdrHeap *heap, URLImpl *url, const char **start, char const * return PARSE_RESULT_ERROR; // we already got one, or too many colons. } if (n_colon) { - user.set(base, last_colon); - passw.set(last_colon + 1, cur); + user.assign(base, last_colon); + passw.assign(last_colon + 1, cur); n_colon = 0; last_colon = nullptr; } else { - user.set(base, cur); + user.assign(base, cur); } ++cur; base = cur; @@ -1374,24 +1373,24 @@ url_parse_internet(HdrHeap *heap, URLImpl *url, const char **start, char const * // character past the parse area. if (user) { - url->set_user(heap, user._ptr, user._size, copy_strings_p); + url->set_user(heap, user.data(), user.size(), copy_strings_p); if (passw) { - url->set_password(heap, passw._ptr, passw._size, copy_strings_p); + url->set_password(heap, passw.data(), passw.size(), copy_strings_p); } } // @a host not set means no brackets to mark explicit host. if (!host) { if (1 == n_colon || MAX_COLON == n_colon) { // presume port. - host.set(base, last_colon); + host.assign(base, last_colon); } else { // it's all host. - host.set(base, cur); + host.assign(base, cur); last_colon = nullptr; // prevent port setting. } } - if (host._size) { - if (!verify_host_characters || validate_host_name(std::string_view(host._ptr, host._size))) { - url->set_host(heap, host._ptr, host._size, copy_strings_p); + if (!host.empty()) { + if (!verify_host_characters || validate_host_name(host)) { + url->set_host(heap, host.data(), host.size(), copy_strings_p); } else { return PARSE_RESULT_ERROR; } @@ -1399,11 +1398,11 @@ url_parse_internet(HdrHeap *heap, URLImpl *url, const char **start, char const * if (last_colon) { ink_assert(n_colon); - port.set(last_colon + 1, cur); - if (!port._size) { + port.assign(last_colon + 1, cur); + if (port.empty()) { return PARSE_RESULT_ERROR; // colon w/o port value. } - url->set_port(heap, port._ptr, port._size, copy_strings_p); + url->set_port(heap, port.data(), port.size(), copy_strings_p); } *start = cur; return PARSE_RESULT_DONE;