comparison src/org/eclipse/jetty/server/Request.java @ 1020:6be43ef1eb96

HttpHeaderValues uses StringCache
author Franklin Schmidt <fschmidt@gmail.com>
date Mon, 31 Oct 2016 22:24:41 -0600
parents 0114d373748e
children 3718afd99988
comparison
equal deleted inserted replaced
1019:f126d30e04a4 1020:6be43ef1eb96
674 _port = _uri.getPort(); 674 _port = _uri.getPort();
675 if (_serverName != null) 675 if (_serverName != null)
676 return _serverName; 676 return _serverName;
677 677
678 // Return host from header field 678 // Return host from header field
679 Buffer hostPort = _connection._requestFields.get(HttpHeaders.HOST_BUFFER); 679 String hostPort = _connection._requestFields.getStringField(HttpHeaders.HOST_BUFFER);
680 if (hostPort != null) 680 if (hostPort != null)
681 { 681 {
682 loop: for (int i = hostPort.putIndex(); i-- > hostPort.getIndex();) 682 loop: for (int i = hostPort.length(); i-- > 0;)
683 { 683 {
684 char ch = (char)(0xff & hostPort.peek(i)); 684 char ch = hostPort.charAt(i);
685 switch (ch) 685 switch (ch)
686 { 686 {
687 case ']': 687 case ']':
688 break loop; 688 break loop;
689 689
690 case ':': 690 case ':':
691 _serverName = BufferUtil.to8859_1_String(hostPort.peek(hostPort.getIndex(),i - hostPort.getIndex())); 691 _serverName = hostPort.substring(0,i);
692 try 692 try
693 { 693 {
694 _port = BufferUtil.toInt(hostPort.peek(i + 1,hostPort.putIndex() - i - 1)); 694 _port = Integer.parseInt(hostPort.substring(i + 1));
695 } 695 }
696 catch (NumberFormatException e) 696 catch (NumberFormatException e)
697 { 697 {
698 try 698 try
699 { 699 {
707 return _serverName; 707 return _serverName;
708 } 708 }
709 } 709 }
710 if (_serverName == null || _port < 0) 710 if (_serverName == null || _port < 0)
711 { 711 {
712 _serverName = BufferUtil.to8859_1_String(hostPort); 712 _serverName = hostPort;
713 _port = 0; 713 _port = 0;
714 } 714 }
715 715
716 return _serverName; 716 return _serverName;
717 } 717 }