438204 getServerName returns IPv6 addresses wrapped in []

This commit is contained in:
Greg Wilkins 2014-07-09 14:38:06 +10:00
parent ca1a9ceb7c
commit 42e1a60d65
2 changed files with 3 additions and 3 deletions

View File

@ -48,7 +48,7 @@ public class HostPortHttpField extends HttpField
int close=authority.lastIndexOf(']');
if (close<0)
throw new BadMessageException(HttpStatus.BAD_REQUEST_400,"Bad ipv6");
_host=authority.substring(1,close);
_host=authority.substring(0,close+1);
if (authority.length()>close+1)
{

View File

@ -66,7 +66,7 @@ public class CheckReverseProxyHeadersTest
@Override
public void validate(HttpServletRequest request)
{
assertEquals("::1", request.getServerName());
assertEquals("[::1]", request.getServerName());
assertEquals(80, request.getServerPort());
assertEquals("10.20.30.40", request.getRemoteAddr());
assertEquals("10.20.30.40", request.getRemoteHost());
@ -84,7 +84,7 @@ public class CheckReverseProxyHeadersTest
@Override
public void validate(HttpServletRequest request)
{
assertEquals("::1", request.getServerName());
assertEquals("[::1]", request.getServerName());
assertEquals(8888, request.getServerPort());
assertEquals("10.20.30.40", request.getRemoteAddr());
assertEquals("10.20.30.40", request.getRemoteHost());