-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Nick,
On 8/11/2010 9:38 AM, Nick Langlois wrote: > Get "HTTP/1.1 400 Bad Request" response back when Tomcat receives an HTTP > simple request (no HTTP version specified in request line). [snip] > Example of expected behaviour: > > wcars1u7-unit1# telnet localhost 5555 > Trying 127.0.0.1... > Connected to localhost. > Escape charac= ter is '^]'. > GET /index.html > > <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN"> Agreed. Wow. HTML 3.2? No wonder you're supporting HTTP/0.9. :( > <html> > <head> > <title>Zack Networks Application Server</title> > <style type="text/css"> If you're doing HTML 3.2, you might want your <style> content to be in <!-- here --> instead of bare like that. > Behaviour I'm seeing: > > wcars1u7-unit1# telnet localhost 8080 > Trying 127.0.0.1... > Connected to localhost. > Escape character is '^]'. > GET /index.html > HTTP/1.1 400 Bad Request > Server: Apache-Coyote/1.1 It looks like there's something wrong, here: Tomcat is responding immediately with a non-version-matching response (it says HTTP/1.1 and should be using at most HTTP/1.0) and then supplying response headers, which aren't legal at the 0.9 level. Several things may be happening here: 1. Tomcat is assuming HTTP 1.0, and then everything above is normal. I'll have to keep reading through the specs to see what the default HTTP version is supposed to be... I wouldn't be surprised if it's 1.0 and not 0.9. 2. Tomcat has a bug (actually Coyote). Here's what I observe in my environment. Using Tomcat 6.0.26 $ telnet localhost 8080 Trying 127.0.0.1... Connected to localhost.localdomain. Escape character is '^]'. GET /mywebapp/index.html <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> <html lang="en" xmlns="http://www.w3.org/1999/xhtml"> ... $ telnet localhost 8080 Trying 127.0.0.1... Connected to localhost.localdomain. Escape character is '^]'. GET /mywebapp/index.html HTTP/1.0 HTTP/1.1 200 OK Server: Apache-Coyote/1.1 Accept-Ranges: bytes ETag: W/"3136-1280422452000" Last-Modified: Thu, 29 Jul 2010 16:54:12 GMT Content-Type: text/html Content-Length: 3136 Date: Fri, 13 Aug 2010 13:08:34 GMT Connection: close <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> <html lang="en" xmlns="http://www.w3.org/1999/xhtml"> ... $ telnet localhost 8080 Trying 127.0.0.1... Connected to localhost.localdomain. Escape character is '^]'. GET /mywebapp/index.html HTTP/1.1 Host: myhost HTTP/1.1 200 OK Server: Apache-Coyote/1.1 Accept-Ranges: bytes ETag: W/"3136-1280422452000" Last-Modified: Thu, 29 Jul 2010 16:54:12 GMT Content-Type: text/html Content-Length: 3136 Date: Fri, 13 Aug 2010 13:04:24 GMT Connection: close <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> <html lang="en" xmlns="http://www.w3.org/1999/xhtml"> ... (Note that a "Host" request header is required in HTTP/1.1). Using Tomcat 5.5.27 $ telnet localhost 8081 Trying 127.0.0.1... Connected to localhost.localdomain. Escape character is '^]'. GET /myotherwebapp/index.html <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> ... $ telnet localhost 8081 Trying 127.0.0.1... Connected to localhost.localdomain. Escape character is '^]'. GET /cschultz-resource-search/index.html HTTP/1.0 HTTP/1.1 404 Not Found Server: Apache-Coyote/1.1 Content-Type: text/html;charset=ISO-8859-1 Date: Fri, 13 Aug 2010 13:31:57 GMT Connection: close <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> ... $ telnet localhost 8081 Trying 127.0.0.1... Connected to localhost.localdomain. Escape character is '^]'. GET /cschultz-resource-search/index.html HTTP/1.1 Host: dev.chadis.com HTTP/1.1 404 Not Found Server: Apache-Coyote/1.1 Content-Type: text/html;charset=ISO-8859-1 Transfer-Encoding: chunked Date: Fri, 13 Aug 2010 13:32:37 GMT 43d <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> ... 0 Odd that the HTTP/1.1 response was chunked for some reason. I don't have a 5.5.29 version available to test right now, but these two versions appear to behave appropriately. Do you have time to check the ChengeLog to see if anything interesting changed in the "Coyote" portion of the project? > wcars1u7-unit1# > > With debug enabled, tomcat logs the following thrown exception: > > 2010-07-29 15:49:22,068 [http-8080-Processor24] DEBUG > > org.apache.coyote.http11.Http11Processor - Error parsing HTTP request header > > java.lang.IllegalArgumentException: Invalid character (CR or LF) found > in method name That certainly looks weird. What else can you tell us about your environment? Could you provide a wireshark or tcpdump trace of the conversation, or at least the request part? - -chris -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.10 (MingW32) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iEYEARECAAYFAkxlS9UACgkQ9CaO5/Lv0PBsdgCfaBkNlkvb6/kZDdn3RuDKKgEd A6MAniZUnbK/4b75sQSHDD0Qd+224Knl =TFux -----END PGP SIGNATURE----- --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org