/** * Parses the "host" header to set the server host and port properties. */ private void parseHost() { String host = getRequestHeaders().getFirstValue( HeaderConstants.HEADER_HOST, true); if (host != null) { // Take care of IPV6 addresses int colonIndex = host.indexOf(':', host.indexOf(']')); if (colonIndex != -1) { super.setHostDomain(host.substring(0, colonIndex)); super.setHostPort(Integer.valueOf(host .substring(colonIndex + 1))); } else { super.setHostDomain(host); super.setHostPort(getProtocol().getDefaultPort()); } } else { getLogger().info( "Couldn't find the mandatory \"Host\" HTTP header."); } this.hostParsed = true; }