Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 345900 - Splitting of host:port fails on IPv6 based host field in HTTP request
Summary: Splitting of host:port fails on IPv6 based host field in HTTP request
Status: RESOLVED FIXED
Alias: None
Product: Jetty
Classification: RT
Component: server (show other bugs)
Version: unspecified   Edit
Hardware: PC Windows 7
: P3 normal (vote)
Target Milestone: 7.2.x   Edit
Assignee: Greg Wilkins CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-05-16 05:39 EDT by Joakim Eriksson CLA
Modified: 2011-05-17 00:19 EDT (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Joakim Eriksson CLA 2011-05-16 05:39:31 EDT
Build Identifier: 7.4.1.v2011-05-13

In the Request.java code the parsing of host:port fails when an IPv6 address is used in the http host field.

I have added a suggestion in the below code-snippet that will avoid interpreting one of the colons in an IPv6 address as a port colon.

---
            for (int i=hostPort.length();i-->0;)   
            {
		/* support for IPv6 address without ports */
                if (hostPort.peek(hostPort.getIndex()+i)==']') {
		    break;
		}
                if (hostPort.peek(hostPort.getIndex()+i)==':')
                {
                    _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;
                }
            }
----




Reproducible: Always

Steps to Reproduce:
1. start up jetty with jetty -jar start.jar jetty.port=80
2. browse to a IPv6 based address (that you happen to have on one of your interfaces - I used aaaa::1 on a microsoft loopback adapter)
3. browse to http:://[aaaa::1]/anything.html
Comment 1 Greg Wilkins CLA 2011-05-16 23:41:01 EDT
hmmm it is working for me for http://[::1]:8080/dump/info

I'll work out how/why
Comment 2 Michael Gorovoy CLA 2011-05-16 23:43:21 EDT
(In reply to comment #1)
> hmmm it is working for me for http://[::1]:8080/dump/info

Greg, I think the problem occurs with http://[::1]/dump/info...
Comment 3 Greg Wilkins CLA 2011-05-17 00:19:29 EDT
Ah yes - fixed in r3160