Bug 62399 - always return 400 when use a domain name due can not read serverName (virtualhost)
Summary: always return 400 when use a domain name due can not read serverName (virtual...
Status: RESOLVED DUPLICATE of bug 62371
Alias: None
Product: Tomcat 8
Classification: Unclassified
Component: Catalina (show other bugs)
Version: 8.5.31
Hardware: PC All
: P2 normal (vote)
Target Milestone: ----
Assignee: Tomcat Developers Mailing List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2018-05-23 00:32 UTC by ZhiFeng Hu
Modified: 2018-05-23 06:18 UTC (History)
1 user (show)



Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description ZhiFeng Hu 2018-05-23 00:32:32 UTC
If the domain name .ext contains number, like "domain.sf1m"

DESKTOP-J5RVINV ~ # curl -v -i 127.0.0.1:8080 -H "Host: domain.sf1m"
* Rebuilt URL to: 127.0.0.1:8080/
*   Trying 127.0.0.1...
* TCP_NODELAY set
* Connected to 127.0.0.1 (127.0.0.1) port 8080 (#0)
> GET / HTTP/1.1
> Host: domain.sf1m
> User-Agent: curl/7.52.1
> Accept: */*
>
< HTTP/1.1 400
HTTP/1.1 400
< Transfer-Encoding: chunked
Transfer-Encoding: chunked
< Date: Wed, 23 May 2018 00:12:34 GMT
Date: Wed, 23 May 2018 00:12:34 GMT
< Connection: close
Connection: close

<
* Curl_http_done: called premature == 0
* Closing connection 0


The tomcat will return 400 error code.

and the log message:

2018-05-23 08:12:34.703 DEBUG 20796 --- [8080-Acceptor-0] o.apache.tomcat.util.threads.LimitLatch  : Counting up[http-nio-8080-Acceptor-0] latch=1
2018-05-23 08:12:34.740 DEBUG 20796 --- [nio-8080-exec-9] org.apache.tomcat.util.modeler.Registry  : Managed= Tomcat:type=RequestProcessor,worker="http-nio-8080",name=HttpRequest1
2018-05-23 08:12:34.740 DEBUG 20796 --- [nio-8080-exec-9] org.apache.tomcat.util.modeler.Registry  : Looking for descriptor 
2018-05-23 08:12:34.740 DEBUG 20796 --- [nio-8080-exec-9] org.apache.tomcat.util.modeler.Registry  : Introspecting 
2018-05-23 08:12:34.741 DEBUG 20796 --- [nio-8080-exec-9] m.m.MbeansDescriptorsIntrospectionSource : Introspected attribute virtualHost public java.lang.String org.apache.coyote.RequestInfo.getVirtualHost() null
2018-05-23 08:12:34.741 DEBUG 20796 --- [nio-8080-exec-9] m.m.MbeansDescriptorsIntrospectionSource : Introspected attribute bytesSent public long org.apache.coyote.RequestInfo.getBytesSent() public void org.apache.coyote.RequestInfo.setBytesSent(long)
2018-05-23 08:12:34.741 DEBUG 20796 --- [nio-8080-exec-9] m.m.MbeansDescriptorsIntrospectionSource : Introspected attribute method public java.lang.String org.apache.coyote.RequestInfo.getMethod() null
2018-05-23 08:12:34.741 DEBUG 20796 --- [nio-8080-exec-9] m.m.MbeansDescriptorsIntrospectionSource : Introspected attribute remoteAddr public java.lang.String org.apache.coyote.RequestInfo.getRemoteAddr() null
2018-05-23 08:12:34.741 DEBUG 20796 --- [nio-8080-exec-9] m.m.MbeansDescriptorsIntrospectionSource : Introspected attribute requestBytesSent public long org.apache.coyote.RequestInfo.getRequestBytesSent() null
2018-05-23 08:12:34.741 DEBUG 20796 --- [nio-8080-exec-9] m.m.MbeansDescriptorsIntrospectionSource : Introspected attribute rpName public javax.management.ObjectName org.apache.coyote.RequestInfo.getRpName() public void org.apache.coyote.RequestInfo.setRpName(javax.management.ObjectName)
2018-05-23 08:12:34.741 DEBUG 20796 --- [nio-8080-exec-9] m.m.MbeansDescriptorsIntrospectionSource : Introspected attribute contentLength public int org.apache.coyote.RequestInfo.getContentLength() null
2018-05-23 08:12:34.741 DEBUG 20796 --- [nio-8080-exec-9] m.m.MbeansDescriptorsIntrospectionSource : Introspected attribute workerThreadName public java.lang.String org.apache.coyote.RequestInfo.getWorkerThreadName() public void org.apache.coyote.RequestInfo.setWorkerThreadName(java.lang.String)
2018-05-23 08:12:34.741 DEBUG 20796 --- [nio-8080-exec-9] m.m.MbeansDescriptorsIntrospectionSource : Introspected attribute bytesReceived public long org.apache.coyote.RequestInfo.getBytesReceived() public void org.apache.coyote.RequestInfo.setBytesReceived(long)
2018-05-23 08:12:34.741 DEBUG 20796 --- [nio-8080-exec-9] m.m.MbeansDescriptorsIntrospectionSource : Introspected attribute requestProcessingTime public long org.apache.coyote.RequestInfo.getRequestProcessingTime() null
2018-05-23 08:12:34.741 DEBUG 20796 --- [nio-8080-exec-9] m.m.MbeansDescriptorsIntrospectionSource : Introspected attribute globalProcessor public org.apache.coyote.RequestGroupInfo org.apache.coyote.RequestInfo.getGlobalProcessor() public void org.apache.coyote.RequestInfo.setGlobalProcessor(org.apache.coyote.RequestGroupInfo)
2018-05-23 08:12:34.741 DEBUG 20796 --- [nio-8080-exec-9] m.m.MbeansDescriptorsIntrospectionSource : Introspected attribute remoteAddrForwarded public java.lang.String org.apache.coyote.RequestInfo.getRemoteAddrForwarded() null
2018-05-23 08:12:34.741 DEBUG 20796 --- [nio-8080-exec-9] m.m.MbeansDescriptorsIntrospectionSource : Introspected attribute protocol public java.lang.String org.apache.coyote.RequestInfo.getProtocol() null
2018-05-23 08:12:34.741 DEBUG 20796 --- [nio-8080-exec-9] m.m.MbeansDescriptorsIntrospectionSource : Introspected attribute currentQueryString public java.lang.String org.apache.coyote.RequestInfo.getCurrentQueryString() null
2018-05-23 08:12:34.741 DEBUG 20796 --- [nio-8080-exec-9] m.m.MbeansDescriptorsIntrospectionSource : Introspected attribute maxRequestUri public java.lang.String org.apache.coyote.RequestInfo.getMaxRequestUri() public void org.apache.coyote.RequestInfo.setMaxRequestUri(java.lang.String)
2018-05-23 08:12:34.741 DEBUG 20796 --- [nio-8080-exec-9] m.m.MbeansDescriptorsIntrospectionSource : Introspected attribute requestBytesReceived public long org.apache.coyote.RequestInfo.getRequestBytesReceived() null
2018-05-23 08:12:34.744 DEBUG 20796 --- [nio-8080-exec-9] m.m.MbeansDescriptorsIntrospectionSource : Introspected attribute serverPort public int org.apache.coyote.RequestInfo.getServerPort() null
2018-05-23 08:12:34.744 DEBUG 20796 --- [nio-8080-exec-9] m.m.MbeansDescriptorsIntrospectionSource : Introspected attribute stage public int org.apache.coyote.RequestInfo.getStage() public void org.apache.coyote.RequestInfo.setStage(int)
2018-05-23 08:12:34.744 DEBUG 20796 --- [nio-8080-exec-9] m.m.MbeansDescriptorsIntrospectionSource : Introspected attribute requestCount public int org.apache.coyote.RequestInfo.getRequestCount() public void org.apache.coyote.RequestInfo.setRequestCount(int)
2018-05-23 08:12:34.744 DEBUG 20796 --- [nio-8080-exec-9] m.m.MbeansDescriptorsIntrospectionSource : Introspected attribute maxTime public long org.apache.coyote.RequestInfo.getMaxTime() public void org.apache.coyote.RequestInfo.setMaxTime(long)
2018-05-23 08:12:34.744 DEBUG 20796 --- [nio-8080-exec-9] m.m.MbeansDescriptorsIntrospectionSource : Introspected attribute currentUri public java.lang.String org.apache.coyote.RequestInfo.getCurrentUri() null
2018-05-23 08:12:34.744 DEBUG 20796 --- [nio-8080-exec-9] m.m.MbeansDescriptorsIntrospectionSource : Introspected attribute processingTime public long org.apache.coyote.RequestInfo.getProcessingTime() public void org.apache.coyote.RequestInfo.setProcessingTime(long)
2018-05-23 08:12:34.744 DEBUG 20796 --- [nio-8080-exec-9] m.m.MbeansDescriptorsIntrospectionSource : Introspected attribute lastRequestProcessingTime public long org.apache.coyote.RequestInfo.getLastRequestProcessingTime() public void org.apache.coyote.RequestInfo.setLastRequestProcessingTime(long)
2018-05-23 08:12:34.744 DEBUG 20796 --- [nio-8080-exec-9] m.m.MbeansDescriptorsIntrospectionSource : Introspected attribute errorCount public int org.apache.coyote.RequestInfo.getErrorCount() public void org.apache.coyote.RequestInfo.setErrorCount(int)
2018-05-23 08:12:34.744 DEBUG 20796 --- [nio-8080-exec-9] m.m.MbeansDescriptorsIntrospectionSource : Setting name: org.apache.coyote.RequestInfo
2018-05-23 08:12:34.744 DEBUG 20796 --- [nio-8080-exec-9] o.a.tomcat.util.modeler.BaseModelMBean   : preRegister org.apache.coyote.RequestInfo@26d260d3 Tomcat:type=RequestProcessor,worker="http-nio-8080",name=HttpRequest1
2018-05-23 08:12:34.745 DEBUG 20796 --- [nio-8080-exec-9] o.a.tomcat.util.net.SocketWrapperBase    : Socket: [org.apache.tomcat.util.net.NioEndpoint$NioSocketWrapper@127a42c7:org.apache.tomcat.util.net.NioChannel@fd4be3b:java.nio.channels.SocketChannel[connected local=/127.0.0.1:8080 remote=/127.0.0.1:63434]], Read from buffer: [0]
2018-05-23 08:12:34.745 DEBUG 20796 --- [nio-8080-exec-9] org.apache.tomcat.util.net.NioEndpoint   : Socket: [org.apache.tomcat.util.net.NioEndpoint$NioSocketWrapper@127a42c7:org.apache.tomcat.util.net.NioChannel@fd4be3b:java.nio.channels.SocketChannel[connected local=/127.0.0.1:8080 remote=/127.0.0.1:63434]], Read direct from socket: [75]
2018-05-23 08:12:34.746 DEBUG 20796 --- [nio-8080-exec-9] o.a.coyote.http11.Http11InputBuffer      : Received [GET / HTTP/1.1
Host: domain.sf1m
User-Agent: curl/7.52.1
Accept: */*

]
2018-05-23 08:12:34.758 DEBUG 20796 --- [nio-8080-exec-9] org.apache.tomcat.util.http.Parameters   : Set query string encoding to UTF-8
2018-05-23 08:12:34.764 DEBUG 20796 --- [nio-8080-exec-9] o.apache.coyote.http11.Http11Processor   : Socket: [org.apache.tomcat.util.net.NioEndpoint$NioSocketWrapper@127a42c7:org.apache.tomcat.util.net.NioChannel@fd4be3b:java.nio.channels.SocketChannel[connected local=/127.0.0.1:8080 remote=/127.0.0.1:63434]], Status in: [OPEN_READ], State out: [CLOSED]
2018-05-23 08:12:34.765 DEBUG 20796 --- [nio-8080-exec-9] o.apache.tomcat.util.threads.LimitLatch  : Counting down[http-nio-8080-exec-9] latch=1
2018-05-23 08:12:34.766 DEBUG 20796 --- [nio-8080-exec-9] org.apache.tomcat.util.net.NioEndpoint   : Socket: [org.apache.tomcat.util.net.NioChannel@fd4be3b:java.nio.channels.SocketChannel[closed]] closed
Comment 1 Mark Thomas 2018-05-23 06:18:58 UTC
Correct reported version.

The alphabetic restriction for the final segment has been removed in:
- trunk for 9.0.9 onwards
- 8.5.x for 8.5.32 onwards
- 8.0.x for 8.0.53 onwards
- 7.0.x for 7.0.89 onwards

*** This bug has been marked as a duplicate of bug 62371 ***