[ jetty-Bugs-1205881 ] Garbage characters in input stream

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

[ jetty-Bugs-1205881 ] Garbage characters in input stream

SourceForge.net
Bugs item #1205881, was opened at 2005-05-20 19:58
Message generated for change (Comment added) made by gregwilkins
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=107322&aid=1205881&group_id=7322

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: HTTP protocol
Group: Jetty3
Status: Open
>Resolution: Rejected
Priority: 5
Submitted By: Alex Savitsky (adunatar)
Assigned to: Greg Wilkins (gregwilkins)
Summary: Garbage characters in input stream

Initial Comment:
At some time after a redirect (not sure whether it
matters) Jetty has thrown an exception:


java.io.IOException: The filename, directory name, or
volume label syntax is incorrect
        at java.io.WinNTFileSystem.canonicalize0
(Native Method)
        at java.io.Win32FileSystem.canonicalize
(Win32FileSystem.java:395)
        at java.io.File.getCanonicalPath(File.java:531)
        at org.mortbay.util.FileResource.getAlias
(FileResource.java:162)
        at
org.mortbay.http.ResourceCache.getResource
(ResourceCache.java:252)
        at org.mortbay.http.HttpContext.getResource
(HttpContext.java:2135)
        at
org.mortbay.jetty.servlet.WebApplicationContext.getRes
ource(WebApplicationContext.java:775)
        at
org.mortbay.jetty.servlet.Default.getResource
(Default.java:185)
        at org.mortbay.jetty.servlet.Default.service
(Default.java:209)
        at javax.servlet.http.HttpServlet.service
(HttpServlet.java:689)
        at
org.mortbay.jetty.servlet.ServletHolder.handle
(ServletHolder.java:427)
        at
org.mortbay.jetty.servlet.WebApplicationHandler.dispatc
h(WebApplicationHandler.java:475)
        at
org.mortbay.jetty.servlet.ServletHandler.handle
(ServletHandler.java:556)
        at org.mortbay.http.HttpContext.handle
(HttpContext.java:1563)
        at
org.mortbay.jetty.servlet.WebApplicationContext.handle
(WebApplicationContext.java:623)
        at org.mortbay.http.HttpContext.handle
(HttpContext.java:1515)
        at
org.mortbay.jetty.plus.PlusWebAppContext.handle
(PlusWebAppContext.java:158)
        at org.mortbay.http.HttpServer.service
(HttpServer.java:956)
        at org.mortbay.http.HttpConnection.service
(HttpConnection.java:814)
        at
org.mortbay.http.HttpConnection.handleNext
(HttpConnection.java:981)
        at org.mortbay.http.HttpConnection.handle
(HttpConnection.java:831)
        at
org.mortbay.http.SocketListener.handleConnection
(SocketListener.java:244)
        at org.mortbay.util.ThreadedServer.handle
(ThreadedServer.java:357)
        at
org.mortbay.util.ThreadPool$PoolThread.run
(ThreadPool.java:534)
WARN - Alias request
of 'file:/C:/Personal/Java/workspace/SimpleApp/context/<
<irreproduceable long line of garbage characters here>>'
for 'file:/C:/Personal/Java/workspace/SimpleApp/context/
<<irreproduceable long line of garbage characters
here>>'

The original request URI was http://localhost:8080/app?
service=page/Checkout, later redirected to
https://localhost:8443/app?service=page/Checkout and
then to https://localhost:8443/app?service=page/Login,
at which point it resulted in the above stack trace.

Strangely enough, this behavior could only be
reproduced under IE6 browser (maybe other IE versions
too), but not under Mozilla Firefox

Further tracing down the Jetty source revealed that the
garbage characters mysteriously appear in the LineInput
parameter of the
org.mortbay.http.HttpRequest.readHeader() method. I'll
continue my digging, of course, but I'd like to have
someone more knowledgeable to look at it, too. I can
provide the application I used to get this problem. It's a
Spring/Tapestry/Hibernate test app, running under
Eclipse 3.0.2 using JettyLauncher (Jetty 5.1.3)

----------------------------------------------------------------------

>Comment By: Greg Wilkins (gregwilkins)
Date: 2005-06-04 14:19

Message:
Logged In: YES
user_id=44062

OK thanks for the simple test case.

This is DEFINITELY an IE bug!   It is lieing and sending a
host 8080 header
to the SSL port at 8443:

15:42:21.666 DEBUG  [P1-18]
org.mortbay.http.HttpConnection.handleNext(HttpConnection.java:973)
>05> REQUEST from P1@0.0.0.0:8443:
GET /template/test2.jsp HTTP/1.1
Accept: image/gif, image/x-xbitmap, image/jpeg, image/pjpeg,
application/vnd.ms-powerpoint, application/vnd.ms-excel,
application/msword, */*
Accept-Language: en-gb
Accept-Encoding: gzip, deflate
User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT
5.0; .NET CLR 1.1.4322)
Host: brick:8080
Connection: keep-alive
Cookie: JSESSIONID=41kd1n2k10hq8

So Jetty correctly uses the 8080 port when formatting the
redirect response
and send the nonsense:

HTTP/1.1 302 Moved Temporarily
Date: Sat, 04 Jun 2005 13:42:21 GMT
Server: Jetty/5.1.4rc0 (Linux/2.6.10-5-686 i386 java/1.4.2_08
Content-Type: text/html
Content-Length: 0
Location: https://brick:8080/template/test3.jsp


Of course 8080 is NOT a https port and this the rubbish
characters
are sent to 8080 (they are actually SSL handshake).

The work around is to be explicit with your port numbers
when doing your
redirections.   But the real fix must come from M$ and they
have to fix
IE to no lie about what port it sent the request to.



----------------------------------------------------------------------

Comment By: Alex Savitsky (adunatar)
Date: 2005-05-25 13:43

Message:
Logged In: YES
user_id=503576

If test2.jsp also references the HTTPS:8443 explicitly (like
test.jsp does), the redirections complete succesfully. It is
only if an explicit redirection is followed by an implicit one,
the problem happens.

----------------------------------------------------------------------

Comment By: Alex Savitsky (adunatar)
Date: 2005-05-25 13:40

Message:
Logged In: YES
user_id=503576

A much easier way to reproduce the problem using only
straight vanilla JSPs:

test.jsp:
<% response.sendRedirect
("https://localhost:8443/test2.jsp"); %>

test2.jsp:
<% response.sendRedirect("/test3.jsp"); %>

test3.jsp:
Anything you like

Place all three in the webapp root, and run it using
JettyLauncher with the attached configuration. Then execute
http://localhost:8080/test.jsp.



----------------------------------------------------------------------

You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=107322&aid=1205881&group_id=7322


-------------------------------------------------------
This SF.Net email is sponsored by: NEC IT Guy Games.  How far can you shotput
a projector? How fast can you ride your desk chair down the office luge track?
If you want to score the big prize, get to know the little guy.  
Play to win an NEC 61" plasma display: http://www.necitguy.com/?r=20
_______________________________________________
jetty-discuss mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/jetty-discuss