RE: cvs commit: jakarta-tomcat-catalina/catalina/src/share/org/apache/coyote/tomcat5 CoyoteResponse.java
Bill, Thanks for implementing a patch for TC5. I looked at porting it to TC4 and noticed that the implementation of toAbsolute() is very different. Looking through the CVS logs, the TC4 implementation used to be the same as TC5 but you changed it back in Oct 2002. I can see pros and cons of both implementations. Is one significantly better than the other and if so is it worth changing the other one? If not, I propose to add a 'location.startsWith(mailto:;)' test to TC4 to fix bug 18147. What do you think? Thanks, Mark -Original Message- From: Bill Barker [mailto:[EMAIL PROTECTED] Sent: Saturday, June 19, 2004 9:47 PM To: Tomcat Developers List Subject: Re: cvs commit: jakarta-tomcat-catalina/catalina/src/share/org/apache/coyote/t omcat5 CoyoteResponse.java - Original Message - From: Mark Thomas [EMAIL PROTECTED] To: 'Tomcat Developers List' [EMAIL PROTECTED] Sent: Saturday, June 19, 2004 11:50 AM Subject: RE: cvs commit: jakarta-tomcat-catalina/catalina/src/share/org/apache/coyote/tomcat5 CoyoteResponse.java Fair point - I'll revert it now. Is your objection to the concept of supporting mailto in redirect or just this bad implementation of it? I have seen some uses of this and some users must want to do it or the bug report would never have been filed. I am happy to work on a better implementation. I don't care one way or the other about supporting mailto in a redirect. I believe that the check used to be done by testing if a o.a.t.u.net.URL could be constructed from the 'location', and consider it absolute if it could be. A well-formed mailto URI would pass this test. This one would also fail something like 'foobar.html?uri=http://myserver/myapp', which currently passes. The current code is supposed to be an optimization to save the time (and garbage) of parsing a URI that just gets thrown away. I could probably live with 'location.startsWith(mailto:;)' (and, even, news:; :) as a compromise. Mark -Original Message- From: Bill Barker [mailto:[EMAIL PROTECTED] Sent: Saturday, June 19, 2004 7:56 PM To: Tomcat Developers List Subject: Re: cvs commit: jakarta-tomcat-catalina/catalina/src/share/org/apache/coyote/t omcat5 CoyoteResponse.java - Original Message - From: [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Saturday, June 19, 2004 11:14 AM Subject: cvs commit: jakarta-tomcat-catalina/catalina/src/share/org/apache/coyote/tomcat5 CoyoteResponse.java markt 2004/06/19 11:14:23 Modified:catalina/src/share/org/apache/coyote/tomcat5 CoyoteResponse.java Log: Fix bug 18147. Prevent mailto URLs from being mangled in re-directs. - Ported from TC4 Big huge -1. Please revert this, since it is questionable that it fixes any real problem, and it breaks plenty of things (e.g. sendRedirect(mailto.html)). - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: cvs commit: jakarta-tomcat-catalina/catalina/src/share/org/apache/coyote/tomcat5 CoyoteResponse.java
- Original Message - From: Mark Thomas [EMAIL PROTECTED] To: 'Tomcat Developers List' [EMAIL PROTECTED] Sent: Sunday, June 20, 2004 9:26 AM Subject: RE: cvs commit: jakarta-tomcat-catalina/catalina/src/share/org/apache/coyote/tomcat5 CoyoteResponse.java Bill, Thanks for implementing a patch for TC5. I looked at porting it to TC4 and noticed that the implementation of toAbsolute() is very different. Looking through the CVS logs, the TC4 implementation used to be the same as TC5 but you changed it back in Oct 2002. I can see pros and cons of both implementations. Is one significantly better than the other and if so is it worth changing the other one? If not, I propose to add a 'location.startsWith(mailto:;)' test to TC4 to fix bug 18147. What do you think? My change back in 2002 was from java.net.URL to o.a.t.u.net.URL. It was Remy that didn't like all the garbage it produced for TC5 :). Now, TC5 is probably better than TC4. I also don't think that this is a critical call, so I don't think it really matters. The check for 'is an absolute URL' is pretty much the same for well-formed URLs, but TC5 doesn't generate garbage in checking. It's true that TC5 doesn't correctly handle the case of 'sendRedirect(//www.yahoo.com)', but I doubt that it is that big of an issue. To keep the current method of TC4, I'd go with: if(url.getAuthority() == null) return location (we might as well allow 'news:' as well :). Thanks, Mark -Original Message- From: Bill Barker [mailto:[EMAIL PROTECTED] Sent: Saturday, June 19, 2004 9:47 PM To: Tomcat Developers List Subject: Re: cvs commit: jakarta-tomcat-catalina/catalina/src/share/org/apache/coyote/t omcat5 CoyoteResponse.java - Original Message - From: Mark Thomas [EMAIL PROTECTED] To: 'Tomcat Developers List' [EMAIL PROTECTED] Sent: Saturday, June 19, 2004 11:50 AM Subject: RE: cvs commit: jakarta-tomcat-catalina/catalina/src/share/org/apache/coyote/tomcat5 CoyoteResponse.java Fair point - I'll revert it now. Is your objection to the concept of supporting mailto in redirect or just this bad implementation of it? I have seen some uses of this and some users must want to do it or the bug report would never have been filed. I am happy to work on a better implementation. I don't care one way or the other about supporting mailto in a redirect. I believe that the check used to be done by testing if a o.a.t.u.net.URL could be constructed from the 'location', and consider it absolute if it could be. A well-formed mailto URI would pass this test. This one would also fail something like 'foobar.html?uri=http://myserver/myapp', which currently passes. The current code is supposed to be an optimization to save the time (and garbage) of parsing a URI that just gets thrown away. I could probably live with 'location.startsWith(mailto:;)' (and, even, news:; :) as a compromise. Mark -Original Message- From: Bill Barker [mailto:[EMAIL PROTECTED] Sent: Saturday, June 19, 2004 7:56 PM To: Tomcat Developers List Subject: Re: cvs commit: jakarta-tomcat-catalina/catalina/src/share/org/apache/coyote/t omcat5 CoyoteResponse.java - Original Message - From: [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Saturday, June 19, 2004 11:14 AM Subject: cvs commit: jakarta-tomcat-catalina/catalina/src/share/org/apache/coyote/tomcat5 CoyoteResponse.java markt 2004/06/19 11:14:23 Modified:catalina/src/share/org/apache/coyote/tomcat5 CoyoteResponse.java Log: Fix bug 18147. Prevent mailto URLs from being mangled in re-directs. - Ported from TC4 Big huge -1. Please revert this, since it is questionable that it fixes any real problem, and it breaks plenty of things (e.g. sendRedirect(mailto.html)). - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] This message is intended only for the use of the person(s) listed above as the intended recipient(s), and may contain information that is PRIVILEGED and CONFIDENTIAL. If you are not an intended recipient, you may not read, copy, or distribute this message or any attachment. If you received this communication in error, please notify us immediately by e-mail and then delete all copies of this message and any attachments. In addition you should be aware that ordinary (unencrypted) e-mail sent through the Internet is not secure. Do not send confidential or sensitive information, such as social
cvs commit: jakarta-tomcat-catalina/catalina/src/share/org/apache/coyote/tomcat5 CoyoteResponse.java
markt 2004/06/19 11:14:23 Modified:catalina/src/share/org/apache/coyote/tomcat5 CoyoteResponse.java Log: Fix bug 18147. Prevent mailto URLs from being mangled in re-directs. - Ported from TC4 Revision ChangesPath 1.19 +5 -1 jakarta-tomcat-catalina/catalina/src/share/org/apache/coyote/tomcat5/CoyoteResponse.java Index: CoyoteResponse.java === RCS file: /home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/coyote/tomcat5/CoyoteResponse.java,v retrieving revision 1.18 retrieving revision 1.19 diff -u -r1.18 -r1.19 --- CoyoteResponse.java 17 Jun 2004 01:08:08 - 1.18 +++ CoyoteResponse.java 19 Jun 2004 18:14:22 - 1.19 @@ -1421,6 +1421,10 @@ if (location == null) return (location); + if (location.toLowerCase().startsWith(mailto)) { + return (location); + } + boolean leadingSlash = location.startsWith(/); if (leadingSlash - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: cvs commit: jakarta-tomcat-catalina/catalina/src/share/org/apache/coyote/tomcat5 CoyoteResponse.java
- Original Message - From: [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Saturday, June 19, 2004 11:14 AM Subject: cvs commit: jakarta-tomcat-catalina/catalina/src/share/org/apache/coyote/tomcat5 CoyoteResponse.java markt 2004/06/19 11:14:23 Modified:catalina/src/share/org/apache/coyote/tomcat5 CoyoteResponse.java Log: Fix bug 18147. Prevent mailto URLs from being mangled in re-directs. - Ported from TC4 Big huge -1. Please revert this, since it is questionable that it fixes any real problem, and it breaks plenty of things (e.g. sendRedirect(mailto.html)). This message is intended only for the use of the person(s) listed above as the intended recipient(s), and may contain information that is PRIVILEGED and CONFIDENTIAL. If you are not an intended recipient, you may not read, copy, or distribute this message or any attachment. If you received this communication in error, please notify us immediately by e-mail and then delete all copies of this message and any attachments. In addition you should be aware that ordinary (unencrypted) e-mail sent through the Internet is not secure. Do not send confidential or sensitive information, such as social security numbers, account numbers, personal identification numbers and passwords, to us via ordinary (unencrypted) e-mail. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: cvs commit: jakarta-tomcat-catalina/catalina/src/share/org/apache/coyote/tomcat5 CoyoteResponse.java
Fair point - I'll revert it now. Is your objection to the concept of supporting mailto in redirect or just this bad implementation of it? I have seen some uses of this and some users must want to do it or the bug report would never have been filed. I am happy to work on a better implementation. Mark -Original Message- From: Bill Barker [mailto:[EMAIL PROTECTED] Sent: Saturday, June 19, 2004 7:56 PM To: Tomcat Developers List Subject: Re: cvs commit: jakarta-tomcat-catalina/catalina/src/share/org/apache/coyote/t omcat5 CoyoteResponse.java - Original Message - From: [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Saturday, June 19, 2004 11:14 AM Subject: cvs commit: jakarta-tomcat-catalina/catalina/src/share/org/apache/coyote/tomcat5 CoyoteResponse.java markt 2004/06/19 11:14:23 Modified:catalina/src/share/org/apache/coyote/tomcat5 CoyoteResponse.java Log: Fix bug 18147. Prevent mailto URLs from being mangled in re-directs. - Ported from TC4 Big huge -1. Please revert this, since it is questionable that it fixes any real problem, and it breaks plenty of things (e.g. sendRedirect(mailto.html)). - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
cvs commit: jakarta-tomcat-catalina/catalina/src/share/org/apache/coyote/tomcat5 CoyoteResponse.java
markt 2004/06/19 11:52:42 Modified:catalina/src/share/org/apache/coyote/tomcat5 CoyoteResponse.java Log: Revert previous patch - it breaks things like sendRedirect(mailto.html) Revision ChangesPath 1.20 +1 -5 jakarta-tomcat-catalina/catalina/src/share/org/apache/coyote/tomcat5/CoyoteResponse.java Index: CoyoteResponse.java === RCS file: /home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/coyote/tomcat5/CoyoteResponse.java,v retrieving revision 1.19 retrieving revision 1.20 diff -u -r1.19 -r1.20 --- CoyoteResponse.java 19 Jun 2004 18:14:22 - 1.19 +++ CoyoteResponse.java 19 Jun 2004 18:52:42 - 1.20 @@ -1421,10 +1421,6 @@ if (location == null) return (location); - if (location.toLowerCase().startsWith(mailto)) { - return (location); - } - boolean leadingSlash = location.startsWith(/); if (leadingSlash - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: cvs commit: jakarta-tomcat-catalina/catalina/src/share/org/apache/coyote/tomcat5 CoyoteResponse.java
- Original Message - From: Mark Thomas [EMAIL PROTECTED] To: 'Tomcat Developers List' [EMAIL PROTECTED] Sent: Saturday, June 19, 2004 11:50 AM Subject: RE: cvs commit: jakarta-tomcat-catalina/catalina/src/share/org/apache/coyote/tomcat5 CoyoteResponse.java Fair point - I'll revert it now. Is your objection to the concept of supporting mailto in redirect or just this bad implementation of it? I have seen some uses of this and some users must want to do it or the bug report would never have been filed. I am happy to work on a better implementation. I don't care one way or the other about supporting mailto in a redirect. I believe that the check used to be done by testing if a o.a.t.u.net.URL could be constructed from the 'location', and consider it absolute if it could be. A well-formed mailto URI would pass this test. This one would also fail something like 'foobar.html?uri=http://myserver/myapp', which currently passes. The current code is supposed to be an optimization to save the time (and garbage) of parsing a URI that just gets thrown away. I could probably live with 'location.startsWith(mailto:;)' (and, even, news:; :) as a compromise. Mark -Original Message- From: Bill Barker [mailto:[EMAIL PROTECTED] Sent: Saturday, June 19, 2004 7:56 PM To: Tomcat Developers List Subject: Re: cvs commit: jakarta-tomcat-catalina/catalina/src/share/org/apache/coyote/t omcat5 CoyoteResponse.java - Original Message - From: [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Saturday, June 19, 2004 11:14 AM Subject: cvs commit: jakarta-tomcat-catalina/catalina/src/share/org/apache/coyote/tomcat5 CoyoteResponse.java markt 2004/06/19 11:14:23 Modified:catalina/src/share/org/apache/coyote/tomcat5 CoyoteResponse.java Log: Fix bug 18147. Prevent mailto URLs from being mangled in re-directs. - Ported from TC4 Big huge -1. Please revert this, since it is questionable that it fixes any real problem, and it breaks plenty of things (e.g. sendRedirect(mailto.html)). - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] This message is intended only for the use of the person(s) listed above as the intended recipient(s), and may contain information that is PRIVILEGED and CONFIDENTIAL. If you are not an intended recipient, you may not read, copy, or distribute this message or any attachment. If you received this communication in error, please notify us immediately by e-mail and then delete all copies of this message and any attachments. In addition you should be aware that ordinary (unencrypted) e-mail sent through the Internet is not secure. Do not send confidential or sensitive information, such as social security numbers, account numbers, personal identification numbers and passwords, to us via ordinary (unencrypted) e-mail. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
cvs commit: jakarta-tomcat-catalina/catalina/src/share/org/apache/coyote/tomcat5 CoyoteResponse.java
billbarker2004/06/19 17:28:07 Modified:catalina/src/share/org/apache/coyote/tomcat5 CoyoteResponse.java Log: Make the check for an absolute URI conform conform better to the RFC. Now an absolute URI is anything of the form scheme:scheme-specific-data. This allows protocols such as 'mailto' and 'news' as well as the standard URLs. Fix for Bug #18147 Revision ChangesPath 1.21 +18 -3 jakarta-tomcat-catalina/catalina/src/share/org/apache/coyote/tomcat5/CoyoteResponse.java Index: CoyoteResponse.java === RCS file: /home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/coyote/tomcat5/CoyoteResponse.java,v retrieving revision 1.20 retrieving revision 1.21 diff -u -r1.20 -r1.21 --- CoyoteResponse.java 19 Jun 2004 18:52:42 - 1.20 +++ CoyoteResponse.java 20 Jun 2004 00:28:07 - 1.21 @@ -1423,8 +1423,7 @@ boolean leadingSlash = location.startsWith(/); -if (leadingSlash -|| (!leadingSlash (location.indexOf(://) == -1))) { +if (leadingSlash || !hasScheme(location)) { redirectURLCC.recycle(); @@ -1487,6 +1486,22 @@ } + +/** + * Determine if a URI string has a codescheme/code component. + */ +private boolean hasScheme(String uri) { +int len = uri.length(); +for(int i=0; i len ; i++) { +char c = uri.charAt(i); +if(c == ':') { +return i 0; +} else if(!URL.isSchemeChar(c)) { +return false; +} +} +return false; +} /** * Return the specified URL with the specified session identifier - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
cvs commit: jakarta-tomcat-catalina/catalina/src/share/org/apache/coyote/tomcat5 CoyoteResponse.java
luehe 2004/06/16 18:08:08 Modified:catalina/src/share/org/apache/coyote/tomcat5 CoyoteResponse.java Log: Fixed Bugtraq 5062838 (ServletResponse.setContentType sets response encoding after getWriter was called) According to Servlet API, a call to ServletResponse.setContentType(mime; charset=charset) 1. has no effect if response has already been committed. 2. sets only the media type (mime), but *not* the response charset if getWriter() has already been called. TC currently violates 2. Revision ChangesPath 1.18 +11 -1 jakarta-tomcat-catalina/catalina/src/share/org/apache/coyote/tomcat5/CoyoteResponse.java Index: CoyoteResponse.java === RCS file: /home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/coyote/tomcat5/CoyoteResponse.java,v retrieving revision 1.17 retrieving revision 1.18 diff -u -r1.17 -r1.18 --- CoyoteResponse.java 5 Jun 2004 05:13:47 - 1.17 +++ CoyoteResponse.java 17 Jun 2004 01:08:08 - 1.18 @@ -705,6 +705,16 @@ if (included) return; +// Ignore charset if getWriter() has already been called +if (usingWriter) { +if (type != null) { +int index = type.indexOf(;); +if (index != -1) { +type = type.substring(0, index); +} +} +} + coyoteResponse.setContentType(type); // Check to see if content type contains charset - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
cvs commit: jakarta-tomcat-catalina/catalina/src/share/org/apache/coyote/tomcat5 CoyoteResponse.java
billbarker2004/06/04 22:13:47 Modified:catalina/src/share/org/apache/coyote/tomcat5 CoyoteResponse.java Log: Use JDK 1.3.x supported method. Revision ChangesPath 1.17 +2 -2 jakarta-tomcat-catalina/catalina/src/share/org/apache/coyote/tomcat5/CoyoteResponse.java Index: CoyoteResponse.java === RCS file: /home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/coyote/tomcat5/CoyoteResponse.java,v retrieving revision 1.16 retrieving revision 1.17 diff -u -r1.16 -r1.17 --- CoyoteResponse.java 16 May 2004 16:39:45 - 1.16 +++ CoyoteResponse.java 5 Jun 2004 05:13:47 - 1.17 @@ -1450,7 +1450,7 @@ } catch (PrivilegedActionException pae){ IllegalArgumentException iae = new IllegalArgumentException(location); -jdkCompat.chainException(iae, pae.getCause()); +jdkCompat.chainException(iae, pae.getException()); throw iae; } } else { - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
cvs commit: jakarta-tomcat-catalina/catalina/src/share/org/apache/coyote/tomcat5 CoyoteResponse.java
markt 2004/05/16 09:39:45 Modified:catalina/src/share/org/apache/coyote/tomcat5 CoyoteResponse.java Log: Fix bug 22413. response.encodeURL(response.encodeURL(xxx.jsp) now works correctly in root context. Revision ChangesPath 1.16 +2 -2 jakarta-tomcat-catalina/catalina/src/share/org/apache/coyote/tomcat5/CoyoteResponse.java Index: CoyoteResponse.java === RCS file: /home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/coyote/tomcat5/CoyoteResponse.java,v retrieving revision 1.15 retrieving revision 1.16 diff -u -r1.15 -r1.16 --- CoyoteResponse.java 15 Apr 2004 01:54:07 - 1.15 +++ CoyoteResponse.java 16 May 2004 16:39:45 - 1.16 @@ -1382,7 +1382,7 @@ return (false); String contextPath = getContext().getPath(); -if ((contextPath != null) (contextPath.length() 0)) { +if (contextPath != null) { String file = url.getFile(); if ((file == null) || !file.startsWith(contextPath)) return (false); - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
cvs commit: jakarta-tomcat-catalina/catalina/src/share/org/apache/coyote/tomcat5 CoyoteResponse.java
luehe 2004/04/14 10:40:54 Modified:catalina/src/share/org/apache/coyote/tomcat5 CoyoteResponse.java Log: Added support for exception chaining. Revision ChangesPath 1.14 +9 -3 jakarta-tomcat-catalina/catalina/src/share/org/apache/coyote/tomcat5/CoyoteResponse.java Index: CoyoteResponse.java === RCS file: /home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/coyote/tomcat5/CoyoteResponse.java,v retrieving revision 1.13 retrieving revision 1.14 diff -u -r1.13 -r1.14 --- CoyoteResponse.java 14 Apr 2004 00:14:22 - 1.13 +++ CoyoteResponse.java 14 Apr 2004 17:40:54 - 1.14 @@ -1438,7 +1438,10 @@ } }); } catch (PrivilegedActionException pae){ -throw new IllegalArgumentException(location); +IllegalArgumentException iae = +new IllegalArgumentException(location); +iae.initCause(pae.getCause()); +throw iae; } } else { encodedURI = urlEncoder.encodeURL(relativePath); @@ -1448,7 +1451,10 @@ } redirectURLCC.append(location, 0, location.length()); } catch (IOException e) { -throw new IllegalArgumentException(location); +IllegalArgumentException iae = +new IllegalArgumentException(location); +iae.initCause(e); +throw iae; } return redirectURLCC.toString(); - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
cvs commit: jakarta-tomcat-catalina/catalina/src/share/org/apache/coyote/tomcat5 CoyoteResponse.java
luehe 2004/04/14 18:54:07 Modified:catalina/src/share/org/apache/coyote/tomcat5 CoyoteResponse.java Log: Hide Throwable.initCause() inside Jdk14Compat, in order to preserver BC with J2SE 1.3 Revision ChangesPath 1.15 +16 -6 jakarta-tomcat-catalina/catalina/src/share/org/apache/coyote/tomcat5/CoyoteResponse.java Index: CoyoteResponse.java === RCS file: /home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/coyote/tomcat5/CoyoteResponse.java,v retrieving revision 1.14 retrieving revision 1.15 diff -u -r1.14 -r1.15 --- CoyoteResponse.java 14 Apr 2004 17:40:54 - 1.14 +++ CoyoteResponse.java 15 Apr 2004 01:54:07 - 1.15 @@ -54,6 +54,7 @@ import org.apache.tomcat.util.http.MimeHeaders; import org.apache.tomcat.util.http.ServerCookie; import org.apache.tomcat.util.net.URL; +import org.apache.tomcat.util.compat.JdkCompat; /** * Wrapper object for the Coyote response. @@ -75,12 +76,13 @@ } -// - Instance Variables +// - Class Variables + /** - * The date format we will use for creating date headers. + * JDK compatibility support */ -protected SimpleDateFormat format = null; +private static final JdkCompat jdkCompat = JdkCompat.getJdkCompat(); /** @@ -97,6 +99,14 @@ StringManager.getManager(Constants.Package); +// - Instance Variables + +/** + * The date format we will use for creating date headers. + */ +protected SimpleDateFormat format = null; + + // - Properties @@ -1440,7 +1450,7 @@ } catch (PrivilegedActionException pae){ IllegalArgumentException iae = new IllegalArgumentException(location); -iae.initCause(pae.getCause()); +jdkCompat.chainException(iae, pae.getCause()); throw iae; } } else { @@ -1453,7 +1463,7 @@ } catch (IOException e) { IllegalArgumentException iae = new IllegalArgumentException(location); -iae.initCause(e); +jdkCompat.chainException(iae, e); throw iae; } - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
cvs commit: jakarta-tomcat-catalina/catalina/src/share/org/apache/coyote/tomcat5 CoyoteResponse.java
luehe 2004/01/20 11:39:00 Modified:catalina/src/share/org/apache/coyote/tomcat5 CoyoteResponse.java Log: Fix for Bugtraq 4655010: Method sendError() of class HttpServletResponse does not send multi byte data Use response encoding when generating error report, so that the following code works as expected: response.setCharacterEncoding(charset); response.sendError(errorCode, message); Revision ChangesPath 1.11 +8 -5 jakarta-tomcat-catalina/catalina/src/share/org/apache/coyote/tomcat5/CoyoteResponse.java Index: CoyoteResponse.java === RCS file: /home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/coyote/tomcat5/CoyoteResponse.java,v retrieving revision 1.10 retrieving revision 1.11 diff -u -r1.10 -r1.11 --- CoyoteResponse.java 15 Oct 2003 18:47:49 - 1.10 +++ CoyoteResponse.java 20 Jan 2004 19:39:00 - 1.11 @@ -529,9 +529,12 @@ * unexpected exception thrown during the servlet processing * (and only in that case), null will be returned if the response stream * has already been used. + * + * @exception IOException if an input/output error occurs */ -public PrintWriter getReporter() { +public PrintWriter getReporter() throws IOException { if (outputBuffer.isNew()) { +outputBuffer.checkConverter(); return writer; } else { return null; - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
cvs commit: jakarta-tomcat-catalina/catalina/src/share/org/apache/coyote/tomcat5 CoyoteResponse.java
jfarcand2003/10/15 11:47:49 Modified:catalina/src/share/org/apache/catalina Wrapper.java catalina/src/share/org/apache/catalina/core StandardWrapper.java StandardWrapperValve.java catalina/src/share/org/apache/coyote/tomcat5 CoyoteResponse.java Log: Better increment the error count value by incrementing the count everytime sendError is invoked Revision ChangesPath 1.3 +10 -4 jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/Wrapper.java Index: Wrapper.java === RCS file: /home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/Wrapper.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- Wrapper.java 29 Jan 2003 12:41:47 - 1.2 +++ Wrapper.java 15 Oct 2003 18:47:49 - 1.3 @@ -290,6 +290,12 @@ /** + * Increment the error count value used when monitoring. + */ +public void incrementErrorCount(); + + +/** * Load and initialize an instance of this servlet, if there is not already * at least one initialized instance. This can be used, for example, to * load servlets that are marked in the deployment descriptor to be loaded 1.34 +11 -4 jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core/StandardWrapper.java Index: StandardWrapper.java === RCS file: /home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core/StandardWrapper.java,v retrieving revision 1.33 retrieving revision 1.34 diff -u -r1.33 -r1.34 --- StandardWrapper.java 24 Sep 2003 06:56:21 - 1.33 +++ StandardWrapper.java 15 Oct 2003 18:47:49 - 1.34 @@ -1424,6 +1424,13 @@ swValve.setErrorCount(errorCount); } +/** + * Increment the error count used for monitoring. + */ +public void incrementErrorCount(){ +swValve.setErrorCount(swValve.getErrorCount() + 1); +} + public long getLoadTime() { return loadTime; } 1.23 +1 -2 jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core/StandardWrapperValve.java Index: StandardWrapperValve.java === RCS file: /home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core/StandardWrapperValve.java,v retrieving revision 1.22 retrieving revision 1.23 diff -u -r1.22 -r1.23 --- StandardWrapperValve.java 2 Sep 2003 21:22:04 - 1.22 +++ StandardWrapperValve.java 15 Oct 2003 18:47:49 - 1.23 @@ -442,7 +442,6 @@ */ private void exception(Request request, Response response, Throwable exception) { -errorCount++; ServletRequest sreq = request.getRequest(); sreq.setAttribute(Globals.EXCEPTION_ATTR, exception); 1.10 +10 -4 jakarta-tomcat-catalina/catalina/src/share/org/apache/coyote/tomcat5/CoyoteResponse.java Index: CoyoteResponse.java === RCS file: /home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/coyote/tomcat5/CoyoteResponse.java,v retrieving revision 1.9 retrieving revision 1.10 diff -u -r1.9 -r1.10 --- CoyoteResponse.java 19 Sep 2003 22:03:07 - 1.9 +++ CoyoteResponse.java 15 Oct 2003 18:47:49 - 1.10 @@ -90,6 +90,7 @@ import org.apache.catalina.Connector; import org.apache.catalina.Context; import org.apache.catalina.HttpResponse; +import org.apache.catalina.Wrapper; import org.apache.catalina.util.CharsetMapper; import org.apache.catalina.util.DateTool; import org.apache.catalina.util.StringManager; @@ -1149,6 +1150,11 @@ // Ignore any call from an included servlet if (included) return; + +Wrapper wrapper = getRequest().getWrapper(); +if (wrapper != null) { +wrapper.incrementErrorCount(); +} setError(); - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
cvs commit: jakarta-tomcat-catalina/catalina/src/share/org/apache/coyote/tomcat5 CoyoteResponse.java
jfarcand2003/09/19 15:03:07 Modified:catalina/src/share/org/apache/coyote/tomcat5 CoyoteResponse.java Log: Add missing doPrivileged block Revision ChangesPath 1.9 +45 -13 jakarta-tomcat-catalina/catalina/src/share/org/apache/coyote/tomcat5/CoyoteResponse.java Index: CoyoteResponse.java === RCS file: /home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/coyote/tomcat5/CoyoteResponse.java,v retrieving revision 1.8 retrieving revision 1.9 diff -u -r1.8 -r1.9 --- CoyoteResponse.java 3 Sep 2003 22:10:33 - 1.8 +++ CoyoteResponse.java 19 Sep 2003 22:03:07 - 1.9 @@ -70,6 +70,7 @@ import java.io.PrintWriter; import java.net.MalformedURLException; import java.security.AccessController; +import java.security.PrivilegedAction; import java.security.PrivilegedActionException; import java.security.PrivilegedExceptionAction; import java.text.SimpleDateFormat; @@ -905,7 +906,7 @@ * * @param cookie Cookie to be added */ -public void addCookie(Cookie cookie) { +public void addCookie(final Cookie cookie) { if (isCommitted()) return; @@ -916,11 +917,25 @@ cookies.add(cookie); -StringBuffer sb = new StringBuffer(); -ServerCookie.appendCookieValue -(sb, cookie.getVersion(), cookie.getName(), cookie.getValue(), - cookie.getPath(), cookie.getDomain(), cookie.getComment(), - cookie.getMaxAge(), cookie.getSecure()); +final StringBuffer sb = new StringBuffer(); +if (System.getSecurityManager() != null) { +AccessController.doPrivileged(new PrivilegedAction() { +public Object run(){ +ServerCookie.appendCookieValue +(sb, cookie.getVersion(), cookie.getName(), + cookie.getValue(), cookie.getPath(), + cookie.getDomain(), cookie.getComment(), + cookie.getMaxAge(), cookie.getSecure()); +return null; +} +}); +} else { +ServerCookie.appendCookieValue +(sb, cookie.getVersion(), cookie.getName(), cookie.getValue(), + cookie.getPath(), cookie.getDomain(), cookie.getComment(), + cookie.getMaxAge(), cookie.getSecure()); +} + // the header name is Set-Cookie for both old and v.1 ( RFC2109 ) // RFC2965 is not supported by browsers and the Servlet spec // asks for 2109. @@ -1305,7 +1320,7 @@ * * @param location Absolute URL to be validated */ -protected boolean isEncodeable(String location) { +protected boolean isEncodeable(final String location) { if (location == null) return (false); @@ -1315,13 +1330,30 @@ return (false); // Are we in a valid session that is not using cookies? -HttpServletRequest hreq = (HttpServletRequest) request.getRequest(); -HttpSession session = hreq.getSession(false); +final HttpServletRequest hreq = +(HttpServletRequest) request.getRequest(); +final HttpSession session = hreq.getSession(false); if (session == null) return (false); if (hreq.isRequestedSessionIdFromCookie()) return (false); + +if (System.getSecurityManager() != null) { +return ((Boolean) +AccessController.doPrivileged(new PrivilegedAction() { + +public Object run(){ +return new Boolean(doIsEncodeable(hreq, session, location)); +} +})).booleanValue(); +} else { +return doIsEncodeable(hreq, session, location); +} +} +private boolean doIsEncodeable(HttpServletRequest hreq, + HttpSession session, + String location){ // Is this a valid absolute URL? URL url = null; try { - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
cvs commit: jakarta-tomcat-catalina/catalina/src/share/org/apache/coyote/tomcat5 CoyoteResponse.java
luehe 2003/09/03 15:10:33 Modified:catalina/src/share/org/apache/coyote/tomcat5 CoyoteResponse.java Log: Fixed Bugtraq 4916164 (Tomcat's default charset for Preferred locale overrides page directive) The HTTP spec mandates that in: media-type = type / subtype *( ; parameter ) parameter = attribute = value there be no (linear) white space between the type and subtype, nor between an attribute and its value, but it does not make any statement about the number of spaces surrounding the semicolon. The HTTP spec itself has this example: Content-Type: text/html; charset=ISO-8859-4 Revision ChangesPath 1.8 +27 -6 jakarta-tomcat-catalina/catalina/src/share/org/apache/coyote/tomcat5/CoyoteResponse.java Index: CoyoteResponse.java === RCS file: /home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/coyote/tomcat5/CoyoteResponse.java,v retrieving revision 1.7 retrieving revision 1.8 diff -u -r1.7 -r1.8 --- CoyoteResponse.java 2 Sep 2003 21:21:59 - 1.7 +++ CoyoteResponse.java 3 Sep 2003 22:10:33 - 1.8 @@ -713,9 +713,30 @@ return; coyoteResponse.setContentType(type); -if ((type != null) (type.indexOf(;charset=) != -1)) { -isCharacterEncodingSet = true; + +// Check to see if content type contains charset +if (type != null) { +int index = type.indexOf(;); +if (index != -1) { +int len = type.length(); +index++; +while (index len Character.isSpace(type.charAt(index))) { +index++; +} +if (index+7 len + type.charAt(index) == 'c' + type.charAt(index+1) == 'h' + type.charAt(index+2) == 'a' + type.charAt(index+3) == 'r' + type.charAt(index+4) == 's' + type.charAt(index+5) == 'e' + type.charAt(index+6) == 't' + type.charAt(index+7) == '=') { +isCharacterEncodingSet = true; +} +} } + isContentTypeSet = true; } - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
cvs commit: jakarta-tomcat-catalina/catalina/src/share/org/apache/coyote/tomcat5 CoyoteResponse.java
luehe 2003/08/12 17:13:43 Modified:catalina/src/share/org/apache/coyote/tomcat5 CoyoteResponse.java Log: Optimizations: - Bugtraq 4730584 (HttpResponseBase should create date format only when needed) - Bugtraq 4701695 (avoid reformatting constant Expires header on every request) Revision ChangesPath 1.6 +22 -12 jakarta-tomcat-catalina/catalina/src/share/org/apache/coyote/tomcat5/CoyoteResponse.java Index: CoyoteResponse.java === RCS file: /home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/coyote/tomcat5/CoyoteResponse.java,v retrieving revision 1.5 retrieving revision 1.6 diff -u -r1.5 -r1.6 --- CoyoteResponse.java 23 Jun 2003 19:14:41 - 1.5 +++ CoyoteResponse.java 13 Aug 2003 00:13:43 - 1.6 @@ -113,7 +113,7 @@ import org.apache.catalina.util.CharsetMapper; import org.apache.catalina.util.RequestUtil; import org.apache.catalina.util.StringManager; - +import org.apache.catalina.util.DateTool; /** * Wrapper object for the Coyote response. @@ -131,10 +131,7 @@ public CoyoteResponse() { - -format.setTimeZone(TimeZone.getTimeZone(GMT)); urlEncoder.addSafeCharacter('/'); - } @@ -143,8 +140,7 @@ /** * The date format we will use for creating date headers. */ -protected final SimpleDateFormat format = -new SimpleDateFormat(EEE, dd MMM HH:mm:ss zzz, Locale.US); +protected SimpleDateFormat format = null; /** @@ -939,8 +935,15 @@ return; // Ignore any call from an included servlet -if (included) +if (included) { return; +} + +if (format == null) { +format = new SimpleDateFormat(DateTool.HTTP_RESPONSE_DATE_HEADER, + Locale.US); +format.setTimeZone(TimeZone.getTimeZone(GMT)); +} addHeader(name, FastHttpDateFormat.formatDate(value, format)); @@ -1190,8 +1193,15 @@ return; // Ignore any call from an included servlet -if (included) +if (included) { return; +} + +if (format == null) { +format = new SimpleDateFormat(DateTool.HTTP_RESPONSE_DATE_HEADER, + Locale.US); +format.setTimeZone(TimeZone.getTimeZone(GMT)); +} setHeader(name, FastHttpDateFormat.formatDate(value, format)); - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: cvs commit: jakarta-tomcat-catalina/catalina/src/share/org/apache/coyote/tomcat5 CoyoteResponse.java
- Original Message - From: [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Tuesday, August 12, 2003 5:13 PM Subject: cvs commit: jakarta-tomcat-catalina/catalina/src/share/org/apache/coyote/tomcat5 CoyoteResponse.java luehe 2003/08/12 17:13:43 Modified:catalina/src/share/org/apache/coyote/tomcat5 CoyoteResponse.java Log: Optimizations: - Bugtraq 4730584 (HttpResponseBase should create date format only when needed) - Bugtraq 4701695 (avoid reformatting constant Expires header on every request) The CoyoteResponse is a pretty long-living object. I wouldn't expect that this will speed Tomcat up at all once it has been running for a while. This message is intended only for the use of the person(s) listed above as the intended recipient(s), and may contain information that is PRIVILEGED and CONFIDENTIAL. If you are not an intended recipient, you may not read, copy, or distribute this message or any attachment. If you received this communication in error, please notify us immediately by e-mail and then delete all copies of this message and any attachments. In addition you should be aware that ordinary (unencrypted) e-mail sent through the Internet is not secure. Do not send confidential or sensitive information, such as social security numbers, account numbers, personal identification numbers and passwords, to us via ordinary (unencrypted) e-mail. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]