345900 Handle ipv6 with default port

git-svn-id: svn+ssh://dev.eclipse.org/svnroot/rt/org.eclipse.jetty/jetty/trunk@3160 7e9141cc-0065-0410-87d8-b60c137991c4
This commit is contained in:
Greg Wilkins 2011-05-17 04:18:39 +00:00
parent 6058e595d5
commit 018a366f6d
2 changed files with 12 additions and 5 deletions

View File

@ -3,6 +3,7 @@ jetty-7.4.2-SNAPSHOT
+ 345615 Enable SSL Session caching
+ 345763 Source file is updated during the build
+ 345873 Update jetty-ssl.xml to new style
+ 345900 Handle ipv6 with default port
+ 346014 Fixed full HttpGenerator
jetty-7.4.1.v20110513

View File

@ -987,13 +987,19 @@ public class Request implements HttpServletRequest
Buffer hostPort = _connection.getRequestFields().get(HttpHeaders.HOST_BUFFER);
if (hostPort!=null)
{
for (int i=hostPort.length();i-->0;)
loop:
for (int i=hostPort.putIndex();i-->hostPort.getIndex();)
{
if (hostPort.peek(hostPort.getIndex()+i)==':')
char ch=(char)(0xff&hostPort.peek(i));
switch(ch)
{
_serverName=BufferUtil.to8859_1_String(hostPort.peek(hostPort.getIndex(), i));
_port=BufferUtil.toInt(hostPort.peek(hostPort.getIndex()+i+1, hostPort.length()-i-1));
return _serverName;
case ']':
break loop;
case ':':
_serverName=BufferUtil.to8859_1_String(hostPort.peek(hostPort.getIndex(), i-hostPort.getIndex()));
_port=BufferUtil.toInt(hostPort.peek(i+1, hostPort.putIndex()-i-1));
return _serverName;
}
}
if (_serverName==null || _port<0)