You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by bu...@apache.org on 2010/11/26 08:04:07 UTC

DO NOT REPLY [Bug 50342] New: Exception on the Host request-header field included colon(':')

https://issues.apache.org/bugzilla/show_bug.cgi?id=50342

           Summary: Exception on the Host request-header field included
                    colon(':')
           Product: Tomcat 6
           Version: 6.0.26
          Platform: PC
            Status: NEW
          Severity: minor
          Priority: P2
         Component: Connectors
        AssignedTo: dev@tomcat.apache.org
        ReportedBy: knight@nhn.com


Hello.

If A tomcat receive a request contained the Host request-header field included
colon, java.io.CharConversionException is thrown.

Exception is below
2010. 11. 26 SEVERE 3:43:37 org.apache.jk.common.HandlerRequest invoke
SEVERE: Error decoding request 
java.io.CharConversionException: Invalid char in port: 103
        at
org.apache.jk.common.HandlerRequest.parseHost(HandlerRequest.java:655)
        at
org.apache.jk.common.HandlerRequest.decodeRequest(HandlerRequest.java:403)
        at org.apache.jk.common.HandlerRequest.invoke(HandlerRequest.java:260)
        at org.apache.jk.common.ChannelSocket.invoke(ChannelSocket.java:754)
        at
org.apache.jk.common.ChannelSocket.processConnection(ChannelSocket.java:684)
        at
org.apache.jk.common.ChannelSocket$SocketConnection.runIt(ChannelSocket.java:876)
        at
org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684)
        at java.lang.Thread.run(Thread.java:619)
2010. 11. 26  SEVERE 3:43:37 org.apache.jk.common.ChannelSocket
processConnection
SEVEREĆ­: processCallbacks status 2
2010. 11. 26SEVERE 3:43:37 org.apache.jk.common.HandlerRequest invoke
SEVERE: Error decoding request 
java.io.CharConversionException: Invalid char in port: 103
        at
org.apache.jk.common.HandlerRequest.parseHost(HandlerRequest.java:655)
        at
org.apache.jk.common.HandlerRequest.decodeRequest(HandlerRequest.java:403)
        at org.apache.jk.common.HandlerRequest.invoke(HandlerRequest.java:260)
        at org.apache.jk.common.ChannelSocket.invoke(ChannelSocket.java:754)
        at
org.apache.jk.common.ChannelSocket.processConnection(ChannelSocket.java:684)
        at
org.apache.jk.common.ChannelSocket$SocketConnection.runIt(ChannelSocket.java:876)
        at
org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684)
        at java.lang.Thread.run(Thread.java:619)
2010. 11. 26 SEVERE 3:43:37 org.apache.jk.common.ChannelSocket
processConnection
SEVEREĆ­: processCallbacks status 2


So. the sample request is below :
(Host field contained two domain name ; tomcat.apache.org and www.apache.org)

telnet localhost 80
Trying 127.0.0.1...
Connected to localhost.localdomain (127.0.0.1).
Escape character is '^]'.
GET http://myweb.com/search.nhn HTTP/1.1
Accept-Language: ko-KR
User-Agent: Mozilla/4.0
Accept-Encoding: gzip, deflate
Host:  tomcat.apache.org:www.apache.org   
Connection: Keep-Alive

HTTP/1.1 502 Bad Gateway
Date: Fri, 26 Nov 2010 06:43:36 GMT
.....


It looks like the HTTP 1.1 specification allows to do such call, here's the
content of HTTP 1.1 specification.

http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.23

14.23 Host
The Host request-header field specifies the Internet host and port number of
the resource being requested, as obtained from the original URI given by the
user or referring resource (generally an HTTP URL, 

as described in section 3.2.2). The Host field value MUST represent the naming
authority of the origin server or gateway given by the original URL. This
allows the origin server or gateway to differentiate between
internally-ambiguous URLs, such as the root "/" URL of a server for multiple
host names on a single IP address. 

       Host = "Host" ":" host [ ":" port ] ; Section 3.2.2


Because http specification 1.1 support multiple host name, I think tomcat may
support this. If I am wrong, let me know it. 
Every tomcat I tested show the exception. 

Thank you.

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


DO NOT REPLY [Bug 50342] Exception on the Host request-header field included colon(':')

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=50342

--- Comment #3 from Kim Yong Hwan <kn...@nhn.com> 2010-11-28 21:19:59 EST ---
Thank you!

I got confused about Host field of HTTP 1.1. 

I understand what you mentioned.

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


DO NOT REPLY [Bug 50342] Exception on the Host request-header field included colon(':')

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=50342

--- Comment #4 from Kim Yong Hwan <kn...@nhn.com> 2010-12-21 04:40:46 EST ---
Could you give more information when java.io.CharConversionException is thrown.

In present, I do not know why the exception is thrown and what character is
transfered from client. 

So, I hope to add a information below. 

<in org.apache.jk.commo.HandlerRequest.java>

in present :
throw new CharConversionException("Invalid char in port: " + valueB[i +
valueS]); 

to be :
throw new CharConversionException("Invalid char in port: " + valueB[i + valueS]
+ ", invalid string is " + new String(valueB));

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


DO NOT REPLY [Bug 50342] Exception on the Host request-header field included colon(':')

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=50342

Chuck Caldarale <ch...@unisys.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |INVALID
         OS/Version|                            |All

--- Comment #1 from Chuck Caldarale <ch...@unisys.com> 2010-11-26 03:06:24 EST ---
(In reply to comment #0)
> If A tomcat receive a request contained the Host request-header field included
> colon, java.io.CharConversionException is thrown.

Not true.  The exception is thrown because the request contains an invalid port
number after the colon.

> Host:  tomcat.apache.org:www.apache.org   

The above is invalid.

> It looks like the HTTP 1.1 specification allows to do such call

It certainly does not.

> Host = "Host" ":" host [ ":" port ] ; Section 3.2.2

The first colon separates the header name from the header value; the second
colon, when present, separates the host name from the port number.

> Because http specification 1.1 support multiple host name

It does not.

 - Chuck

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


DO NOT REPLY [Bug 50342] Exception on the Host request-header field included colon(':')

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=50342

--- Comment #2 from Kim Yong Hwan <kn...@nhn.com> 2010-11-28 21:18:52 EST ---
Thank you!
I got confused about host field, I understand what you said.

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org