Lines Matching defs:host
156 static std::string TrimPort(const std::string& host) {
157 size_t last_colon_pos = host.rfind(':');
159 return host;
160 size_t bracket = host.rfind(']');
162 return host.substr(0, last_colon_pos);
163 return host;
166 static bool IsIPAddress(const std::string& host) {
168 // * the host name must be an IP address (CVE-2018-7160, CVE-2022-32212),
174 if (host.find('\0') != std::string::npos) return false;
178 if (host.length() >= 4 && host.front() == '[' && host.back() == ']') {
182 if (host.length() - 2 >= INET6_ADDRSTRLEN) return false;
186 if (host.find('%') != std::string::npos) return false;
190 std::copy(host.begin() + 1, host.end() - 1, ipv6_str);
191 ipv6_str[host.length()] = '\0';
202 // this translation assumes that the host is interpreted as an IPv6 address
219 if (uv_inet_pton(AF_INET, host.c_str(), ipv4) != 0) return false;
472 const std::string& ws_key, const std::string& host)
474 host(host) { }
480 std::string host;
548 if (!IsAllowedHost(event.host) || !event.isGET) {
552 delegate()->OnHttpGet(event.host, event.path);
557 delegate()->OnSocketUpgrade(event.host, event.path, event.ws_key);
636 std::string host = TrimPort(host_with_port);
637 return host.empty() || IsIPAddress(host)
638 || node::StringEqualNoCase(host.data(), "localhost");