cvs commit: jakarta-tomcat/src/facade22/org/apache/tomcat/facade HttpServletResponseFacade.java

2002-12-04 Thread billbarker
billbarker2002/12/04 22:42:35

  Modified:src/facade22/org/apache/tomcat/facade
HttpServletResponseFacade.java
  Log:
  Port patch for encoding an empty string from TC4 branch.
  
  Revision  ChangesPath
  1.30  +17 -7 
jakarta-tomcat/src/facade22/org/apache/tomcat/facade/HttpServletResponseFacade.java
  
  Index: HttpServletResponseFacade.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat/src/facade22/org/apache/tomcat/facade/HttpServletResponseFacade.java,v
  retrieving revision 1.29
  retrieving revision 1.30
  diff -u -r1.29 -r1.30
  --- HttpServletResponseFacade.java4 Jul 2002 04:09:30 -   1.29
  +++ HttpServletResponseFacade.java5 Dec 2002 06:42:35 -   1.30
  @@ -142,10 +142,15 @@
*  part of response, but session code.
*/
   public String encodeRedirectURL(String location) {
  - if (isEncodeable(toAbsolute(location)))
  + String absolute = toAbsolute(location);
  + if (isEncodeable(absolute)) {
  + if( "".equals(location) ) {
  + location = absolute;
  + }
return (toEncoded(location, response.getRequest().getSession(false)));
  - else
  + } else {
return (location);
  + }
   }
   
   /**
  @@ -156,10 +161,15 @@
   }
   
   public String encodeURL(String url) {
  - if (isEncodeable(toAbsolute(url)))
  + String absolute = toAbsolute(url); 
  + if (isEncodeable(absolute)) {
  + if( "".equals(url) ) {
  + url = absolute;
  + }
return (toEncoded(url, response.getRequest().getSession(false)));
  - else
  + } else {
return (url);
  + }
   }
   
   /**
  
  
  

--
To unsubscribe, e-mail:   
For additional commands, e-mail: 




cvs commit: jakarta-tomcat/src/facade22/org/apache/tomcat/facade HttpServletResponseFacade.java

2002-07-03 Thread billbarker

billbarker2002/07/03 21:09:30

  Modified:src/facade22/org/apache/tomcat/facade
HttpServletResponseFacade.java
  Log:
  Fix problem when the Context path contains a non-safe character.
  
  As an added benefit, we get rid of the deprecated HttpUtils dependency.  At some 
point, we should probably add a getRequestURL method to the core request to remove 
some of the repeated code.
  
  Fix for bug #9111
  Reported By: Alexander Lamm [EMAIL PROTECTED]
  
  Revision  ChangesPath
  1.29  +24 -8 
jakarta-tomcat/src/facade22/org/apache/tomcat/facade/HttpServletResponseFacade.java
  
  Index: HttpServletResponseFacade.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat/src/facade22/org/apache/tomcat/facade/HttpServletResponseFacade.java,v
  retrieving revision 1.28
  retrieving revision 1.29
  diff -u -r1.28 -r1.29
  --- HttpServletResponseFacade.java22 Mar 2002 02:54:34 -  1.28
  +++ HttpServletResponseFacade.java4 Jul 2002 04:09:30 -   1.29
  @@ -358,7 +358,6 @@
} catch (MalformedURLException e) {
return (false);
}
  -
// Does this URL match down to (and including) the context path?
if (!request.scheme().equalsIgnoreCase(url.getProtocol()))
return (false);
  @@ -414,10 +413,7 @@
url = new URL(location);
} catch (MalformedURLException e1) {
Request request = response.getRequest();
  - HttpServletRequestFacade reqF=(HttpServletRequestFacade)request.
  - getFacade();
  - String requrl =
  - HttpUtils.getRequestURL(reqF).toString();
  + String requrl = getRequestURL(request);
try {
url = new URL(new URL(requrl), location);
} catch (MalformedURLException e2) {
  @@ -427,6 +423,26 @@
return (url.toExternalForm());
   
   }
  +
  +/**
  + * Return the requested URL.
  + * Should be moved to util.
  + */
  +private String getRequestURL(Request req) {
  + StringBuffer sb = new StringBuffer();
  + int port = req.getServerPort();
  + String scheme = req.scheme().toString();
  + sb.append(scheme).append("://");
  + sb.append(req.serverName().toString());
  + if(("http".equalsIgnoreCase(scheme) && port != 80) ||
  +("https".equalsIgnoreCase(scheme) && port != 443)) {
  + sb.append(':').append(port);
  + }
  + sb.append(req.requestURI().toString());
  + return sb.toString();
  +}
  +
  + 
   
   
   /**
  
  
  

--
To unsubscribe, e-mail:   
For additional commands, e-mail: 




cvs commit: jakarta-tomcat/src/facade22/org/apache/tomcat/facade HttpServletResponseFacade.java

2002-02-21 Thread billbarker

billbarker02/02/21 22:12:14

  Modified:src/facade22/org/apache/tomcat/facade
HttpServletResponseFacade.java
  Log:
  Avoid double-encoding of URLS.
  
  Fix for bug #6629.
  Based on Subimission of: Tilo Christ [EMAIL PROTECTED]
  Reported by: Tilo Christ [EMAIL PROTECTED]
  
  Revision  ChangesPath
  1.27  +7 -3  
jakarta-tomcat/src/facade22/org/apache/tomcat/facade/HttpServletResponseFacade.java
  
  Index: HttpServletResponseFacade.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat/src/facade22/org/apache/tomcat/facade/HttpServletResponseFacade.java,v
  retrieving revision 1.26
  retrieving revision 1.27
  diff -u -r1.26 -r1.27
  --- HttpServletResponseFacade.java18 Feb 2002 03:43:38 -  1.26
  +++ HttpServletResponseFacade.java22 Feb 2002 06:12:14 -  1.27
  @@ -1,7 +1,7 @@
   /*
  - * $Header: 
/home/cvs/jakarta-tomcat/src/facade22/org/apache/tomcat/facade/HttpServletResponseFacade.java,v
 1.26 2002/02/18 03:43:38 billbarker Exp $
  - * $Revision: 1.26 $
  - * $Date: 2002/02/18 03:43:38 $
  + * $Header: 
/home/cvs/jakarta-tomcat/src/facade22/org/apache/tomcat/facade/HttpServletResponseFacade.java,v
 1.27 2002/02/22 06:12:14 billbarker Exp $
  + * $Revision: 1.27 $
  + * $Date: 2002/02/22 06:12:14 $
*
* 
*
  @@ -383,6 +383,10 @@
String file = url.getFile();
if ((file == null) || !file.startsWith(contextPath))
return (false);
  + // XXX endsWith() ? However, that confilicts with
  + // the ;charset= attribute.
  + if(file.indexOf(";jsessionid=" + session.getId()) >= 0)
  + return (false); // Already encoded
}
   
// This URL belongs to our web application, so it is encodeable
  
  
  

--
To unsubscribe, e-mail:   
For additional commands, e-mail: 




cvs commit: jakarta-tomcat/src/facade22/org/apache/tomcat/facade HttpServletResponseFacade.java

2002-02-17 Thread billbarker

billbarker02/02/17 19:43:38

  Modified:src/facade22/org/apache/tomcat/facade
HttpServletResponseFacade.java
  Log:
  Don't set DateHeaders if we are included.
  
  The spec forbids setting headers on includes, but the DateHeaders slipped through.  
This closes the hole.
  
  Fix for bug #6515
  Reported by: Paul Fu [EMAIL PROTECTED]
  
  Revision  ChangesPath
  1.26  +11 -7 
jakarta-tomcat/src/facade22/org/apache/tomcat/facade/HttpServletResponseFacade.java
  
  Index: HttpServletResponseFacade.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat/src/facade22/org/apache/tomcat/facade/HttpServletResponseFacade.java,v
  retrieving revision 1.25
  retrieving revision 1.26
  diff -u -r1.25 -r1.26
  --- HttpServletResponseFacade.java5 Feb 2002 03:54:27 -   1.25
  +++ HttpServletResponseFacade.java18 Feb 2002 03:43:38 -  1.26
  @@ -1,7 +1,7 @@
   /*
  - * $Header: 
/home/cvs/jakarta-tomcat/src/facade22/org/apache/tomcat/facade/HttpServletResponseFacade.java,v
 1.25 2002/02/05 03:54:27 billbarker Exp $
  - * $Revision: 1.25 $
  - * $Date: 2002/02/05 03:54:27 $
  + * $Header: 
/home/cvs/jakarta-tomcat/src/facade22/org/apache/tomcat/facade/HttpServletResponseFacade.java,v
 1.26 2002/02/18 03:43:38 billbarker Exp $
  + * $Revision: 1.26 $
  + * $Date: 2002/02/18 03:43:38 $
*
* 
*
  @@ -250,13 +250,17 @@
   }
   
   public void setDateHeader(String name, long date) {
  - MimeHeaders headers=response.getMimeHeaders();
  - headers.setValue( name ).setTime( date );
  + if( ! response.isIncluded() ) {
  + MimeHeaders headers=response.getMimeHeaders();
  + headers.setValue( name ).setTime( date );
  + }
   }
   
   public void addDateHeader(String name, long value) {
  - MimeHeaders headers=response.getMimeHeaders();
  - headers.addValue( name ).setTime( value );
  + if ( ! response.isIncluded() ) {
  + MimeHeaders headers=response.getMimeHeaders();
  + headers.addValue( name ).setTime( value );
  + }
   }
   
   public void setHeader(String name, String value) {
  
  
  

--
To unsubscribe, e-mail:   
For additional commands, e-mail: 




cvs commit: jakarta-tomcat/src/facade22/org/apache/tomcat/facade HttpServletResponseFacade.java

2002-02-04 Thread billbarker

billbarker02/02/04 19:54:27

  Modified:src/facade22/org/apache/tomcat/facade
HttpServletResponseFacade.java
  Log:
  Make certain that the Writer isn't in the error state.
  
  This is the quickest and safest fix.  We could try for something better in 3.3.2 if 
we want.  However, this almost never happens (since usually an IOException kills the 
entire thread), so there really isn't that much extra garbage to collect.
  
  Fix for bug #6234.
  Reported by: Pete Fischer [EMAIL PROTECTED]
  
  Revision  ChangesPath
  1.25  +7 -4  
jakarta-tomcat/src/facade22/org/apache/tomcat/facade/HttpServletResponseFacade.java
  
  Index: HttpServletResponseFacade.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat/src/facade22/org/apache/tomcat/facade/HttpServletResponseFacade.java,v
  retrieving revision 1.24
  retrieving revision 1.25
  diff -u -r1.24 -r1.25
  --- HttpServletResponseFacade.java30 Jan 2002 03:37:12 -  1.24
  +++ HttpServletResponseFacade.java5 Feb 2002 03:54:27 -   1.25
  @@ -1,7 +1,7 @@
   /*
  - * $Header: 
/home/cvs/jakarta-tomcat/src/facade22/org/apache/tomcat/facade/HttpServletResponseFacade.java,v
 1.24 2002/01/30 03:37:12 billbarker Exp $
  - * $Revision: 1.24 $
  - * $Date: 2002/01/30 03:37:12 $
  + * $Header: 
/home/cvs/jakarta-tomcat/src/facade22/org/apache/tomcat/facade/HttpServletResponseFacade.java,v
 1.25 2002/02/05 03:54:27 billbarker Exp $
  + * $Revision: 1.25 $
  + * $Date: 2002/02/05 03:54:27 $
*
* 
*
  @@ -106,7 +106,10 @@
   void recycle() {
usingStream = false;
usingWriter= false;
  - //  writer=null; // fixed ( ? )
  + if( writer.checkError() ) {
  + OutputBuffer oBuffer= response.getBuffer();
  + writer = new ServletWriterFacade( oBuffer, response);
  + }
if( osFacade != null ) osFacade.recycle();
   }
   
  
  
  

--
To unsubscribe, e-mail:   
For additional commands, e-mail: 




cvs commit: jakarta-tomcat/src/facade22/org/apache/tomcat/facade HttpServletResponseFacade.java

2002-01-29 Thread billbarker

billbarker02/01/29 19:37:12

  Modified:src/facade22/org/apache/tomcat/facade
HttpServletResponseFacade.java
  Log:
  Don't encode URLs that only have an anchor.
  
  Now response.encodeURL("#foobar") works as well.
  
  Fix for bug 6115
  Reported by: Peter Nuetzel [EMAIL PROTECTED]
  
  Revision  ChangesPath
  1.24  +7 -5  
jakarta-tomcat/src/facade22/org/apache/tomcat/facade/HttpServletResponseFacade.java
  
  Index: HttpServletResponseFacade.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat/src/facade22/org/apache/tomcat/facade/HttpServletResponseFacade.java,v
  retrieving revision 1.23
  retrieving revision 1.24
  diff -u -r1.23 -r1.24
  --- HttpServletResponseFacade.java16 Nov 2001 04:10:35 -  1.23
  +++ HttpServletResponseFacade.java30 Jan 2002 03:37:12 -  1.24
  @@ -1,7 +1,7 @@
   /*
  - * $Header: 
/home/cvs/jakarta-tomcat/src/facade22/org/apache/tomcat/facade/HttpServletResponseFacade.java,v
 1.23 2001/11/16 04:10:35 billbarker Exp $
  - * $Revision: 1.23 $
  - * $Date: 2001/11/16 04:10:35 $
  + * $Header: 
/home/cvs/jakarta-tomcat/src/facade22/org/apache/tomcat/facade/HttpServletResponseFacade.java,v
 1.24 2002/01/30 03:37:12 billbarker Exp $
  + * $Revision: 1.24 $
  + * $Date: 2002/01/30 03:37:12 $
*
* 
*
  @@ -447,8 +447,10 @@
path = path.substring(0,hashP);
}
StringBuffer sb = new StringBuffer(path);
  - sb.append(";jsessionid=");
  - sb.append(sessionId);
  + if( sb.length() > 0) { // Can't have jsessionid first.
  + sb.append(";jsessionid=");
  + sb.append(sessionId);
  + }
if(anchor != null) 
sb.append(anchor);
if (query != null)
  
  
  

--
To unsubscribe, e-mail:   
For additional commands, e-mail: 




Re: cvs commit: jakarta-tomcat/src/facade22/org/apache/tomcat/facade HttpServletResponseFacade.java

2002-01-05 Thread Remy Maucherat

> Hi Remy,
>  
> Bill made this patch a while back to the toEncoded() method so
> it would put ";jsessionid" in the right place in the presence of an
> anchor.  I checked and Tomcat 4.x still has what was
> Tomcat 3.3's pre-patched code.  I'm not sure which is "more"
> spec compliant.  Would you like me to port this patch to 4.0.2
> and 4.1?

That sounds ok.

Thanks,
Remy


--
To unsubscribe, e-mail:   
For additional commands, e-mail: 




RE: cvs commit: jakarta-tomcat/src/facade22/org/apache/tomcat/facade HttpServletResponseFacade.java

2002-01-05 Thread Larry Isaacs

Hi Remy,
 
Bill made this patch a while back to the toEncoded() method so
it would put ";jsessionid" in the right place in the presence of an
anchor.  I checked and Tomcat 4.x still has what was
Tomcat 3.3's pre-patched code.  I'm not sure which is "more"
spec compliant.  Would you like me to port this patch to 4.0.2
and 4.1?
 
Cheers,
Larry
 

-Original Message- 
From: [EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]>  
[mailto:[EMAIL PROTECTED]] 
Sent: Thu 11/15/2001 11:10 PM 
To: [EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]>  
Cc: 
Subject: cvs commit: jakarta-tomcat/src/facade22/org/apache/tomcat/facade 
HttpServletResponseFacade.java

billbarker01/11/15 20:10:35 
  Modified:src/facade22/org/apache/tomcat/facade 
HttpServletResponseFacade.java 
  Log: 
  Fix URL rewriting when the url has an anchor. 
  
  In order to be functional, the "jsessionid=" must be part of the "file" component of 
the URL.  This just makes certain that it is not part of the anchor.
  
  Revision  ChangesPath 
  1.23  +11 -3 
jakarta-tomcat/src/facade22/org/apache/tomcat/facade/HttpServletResponseFacade.java 
  
  Index: HttpServletResponseFacade.java 
  === 
  RCS file: 
/home/cvs/jakarta-tomcat/src/facade22/org/apache/tomcat/facade/HttpServletResponseFacade.java,v
 
  retrieving revision 1.22 
  retrieving revision 1.23 
  diff -u -r1.22 -r1.23 
  --- HttpServletResponseFacade.java2001/11/14 02:57:08 1.22 
  +++ HttpServletResponseFacade.java2001/11/16 04:10:35 1.23 
  @@ -1,7 +1,7 @@ 
   /* 
  - * $Header: 
/home/cvs/jakarta-tomcat/src/facade22/org/apache/tomcat/facade/HttpServletResponseFacade.java,v
 1.22 2001/11/14 02:57:08 larryi Exp $
  - * $Revision: 1.22 $ 
  - * $Date: 2001/11/14 02:57:08 $ 
  + * $Header: 
/home/cvs/jakarta-tomcat/src/facade22/org/apache/tomcat/facade/HttpServletResponseFacade.java,v
 1.23 2001/11/16 04:10:35 billbarker Exp $
  + * $Revision: 1.23 $ 
  + * $Date: 2001/11/16 04:10:35 $ 
* 
*  
* 
  @@ -440,9 +440,17 @@ 
path = url.substring(0, question); 
query = url.substring(question); 
} 
  + String anchor = null; 
  + int hashP = path.indexOf("#"); 
  + if(hashP >= 0) { 
  + anchor = path.substring(hashP); 
  + path = path.substring(0,hashP); 
  + } 
StringBuffer sb = new StringBuffer(path); 
sb.append(";jsessionid="); 
sb.append(sessionId); 
  + if(anchor != null) 
  + sb.append(anchor); 
if (query != null) 
sb.append(query); 
return (sb.toString()); 
  
  
  
-- 
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED] 
<mailto:[EMAIL PROTECTED]> > 
For additional commands, e-mail: <mailto:[EMAIL PROTECTED] 
<mailto:[EMAIL PROTECTED]> > 




msg19802/bin0.bin
Description: application/ms-tnef

--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>


cvs commit: jakarta-tomcat/src/facade22/org/apache/tomcat/facade HttpServletResponseFacade.java

2001-11-15 Thread billbarker

billbarker01/11/15 20:10:35

  Modified:src/facade22/org/apache/tomcat/facade
HttpServletResponseFacade.java
  Log:
  Fix URL rewriting when the url has an anchor.
  
  In order to be functional, the "jsessionid=" must be part of the "file" component of 
the URL.  This just makes certain that it is not part of the anchor.
  
  Revision  ChangesPath
  1.23  +11 -3 
jakarta-tomcat/src/facade22/org/apache/tomcat/facade/HttpServletResponseFacade.java
  
  Index: HttpServletResponseFacade.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat/src/facade22/org/apache/tomcat/facade/HttpServletResponseFacade.java,v
  retrieving revision 1.22
  retrieving revision 1.23
  diff -u -r1.22 -r1.23
  --- HttpServletResponseFacade.java2001/11/14 02:57:08 1.22
  +++ HttpServletResponseFacade.java2001/11/16 04:10:35 1.23
  @@ -1,7 +1,7 @@
   /*
  - * $Header: 
/home/cvs/jakarta-tomcat/src/facade22/org/apache/tomcat/facade/HttpServletResponseFacade.java,v
 1.22 2001/11/14 02:57:08 larryi Exp $
  - * $Revision: 1.22 $
  - * $Date: 2001/11/14 02:57:08 $
  + * $Header: 
/home/cvs/jakarta-tomcat/src/facade22/org/apache/tomcat/facade/HttpServletResponseFacade.java,v
 1.23 2001/11/16 04:10:35 billbarker Exp $
  + * $Revision: 1.23 $
  + * $Date: 2001/11/16 04:10:35 $
*
* 
*
  @@ -440,9 +440,17 @@
path = url.substring(0, question);
query = url.substring(question);
}
  + String anchor = null;
  + int hashP = path.indexOf("#");
  + if(hashP >= 0) {
  + anchor = path.substring(hashP);
  + path = path.substring(0,hashP);
  + }
StringBuffer sb = new StringBuffer(path);
sb.append(";jsessionid=");
sb.append(sessionId);
  + if(anchor != null) 
  + sb.append(anchor);
if (query != null)
sb.append(query);
return (sb.toString());
  
  
  

--
To unsubscribe, e-mail:   
For additional commands, e-mail: 




cvs commit: jakarta-tomcat/src/facade22/org/apache/tomcat/facade HttpServletResponseFacade.java

2001-11-13 Thread larryi

larryi  01/11/13 18:57:08

  Modified:src/facade22/org/apache/tomcat/facade
HttpServletResponseFacade.java
  Log:
  Update to use a "better" method for converting the URL to the needed
  string.
  
  Revision  ChangesPath
  1.22  +4 -4  
jakarta-tomcat/src/facade22/org/apache/tomcat/facade/HttpServletResponseFacade.java
  
  Index: HttpServletResponseFacade.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat/src/facade22/org/apache/tomcat/facade/HttpServletResponseFacade.java,v
  retrieving revision 1.21
  retrieving revision 1.22
  diff -u -r1.21 -r1.22
  --- HttpServletResponseFacade.java2001/11/08 03:48:02 1.21
  +++ HttpServletResponseFacade.java2001/11/14 02:57:08 1.22
  @@ -1,7 +1,7 @@
   /*
  - * $Header: 
/home/cvs/jakarta-tomcat/src/facade22/org/apache/tomcat/facade/HttpServletResponseFacade.java,v
 1.21 2001/11/08 03:48:02 billbarker Exp $
  - * $Revision: 1.21 $
  - * $Date: 2001/11/08 03:48:02 $
  + * $Header: 
/home/cvs/jakarta-tomcat/src/facade22/org/apache/tomcat/facade/HttpServletResponseFacade.java,v
 1.22 2001/11/14 02:57:08 larryi Exp $
  + * $Revision: 1.22 $
  + * $Date: 2001/11/14 02:57:08 $
*
* 
*
  @@ -413,7 +413,7 @@
return (location);  // Give up
}
}
  - return (url.toString());
  + return (url.toExternalForm());
   
   }
   
  
  
  

--
To unsubscribe, e-mail:   
For additional commands, e-mail: 




cvs commit: jakarta-tomcat/src/facade22/org/apache/tomcat/facade HttpServletResponseFacade.java

2001-04-22 Thread costin

costin  01/04/22 11:56:03

  Modified:src/facade22/org/apache/tomcat/facade
HttpServletResponseFacade.java
  Log:
  Checked in patch for #578.
  Thanks Santiago Gala for submiting the patch.
  
  Submitted by: [EMAIL PROTECTED] (Santiago Gala)
  
  Revision  ChangesPath
  1.20  +8 -4  
jakarta-tomcat/src/facade22/org/apache/tomcat/facade/HttpServletResponseFacade.java
  
  Index: HttpServletResponseFacade.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat/src/facade22/org/apache/tomcat/facade/HttpServletResponseFacade.java,v
  retrieving revision 1.19
  retrieving revision 1.20
  diff -u -r1.19 -r1.20
  --- HttpServletResponseFacade.java2001/03/07 21:29:38 1.19
  +++ HttpServletResponseFacade.java2001/04/22 18:56:03 1.20
  @@ -1,7 +1,7 @@
   /*
  - * $Header: 
/home/cvs/jakarta-tomcat/src/facade22/org/apache/tomcat/facade/HttpServletResponseFacade.java,v
 1.19 2001/03/07 21:29:38 larryi Exp $
  - * $Revision: 1.19 $
  - * $Date: 2001/03/07 21:29:38 $
  + * $Header: 
/home/cvs/jakarta-tomcat/src/facade22/org/apache/tomcat/facade/HttpServletResponseFacade.java,v
 1.20 2001/04/22 18:56:03 costin Exp $
  + * $Revision: 1.20 $
  + * $Date: 2001/04/22 18:56:03 $
*
* 
*
  @@ -359,7 +359,11 @@
   // Set the URL port to HTTP default if not available before comparing
   int urlPort = url.getPort();
   if (urlPort == -1) {
  -urlPort = 80;
  + if("http".equalsIgnoreCase(url.getProtocol())) {
  + urlPort = 80;
  + } else if ("https".equalsIgnoreCase(url.getProtocol())) {
  + urlPort = 443;
  +}
   }
int serverPort = request.getServerPort();
if (serverPort == -1)   // Work around bug in java.net.URL.getHost()
  
  
  



cvs commit: jakarta-tomcat/src/facade22/org/apache/tomcat/facade HttpServletResponseFacade.java

2001-03-07 Thread larryi

larryi  01/03/07 13:29:45

  Modified:src/facade22/org/apache/tomcat/facade
HttpServletResponseFacade.java
  Log:
  Port changes from tomcat_32 by Marc Saegesser
  
  This fixes some additional problems uncovered by the fix for
  Bugzilla 160.
  
  The isEncodable() method used isRequestedSessionIdValid() to determine
  if there was an active session.This is incorrect, because the requested
  session id may have expired or been invalidated and a new session created.
  
  isEncodeable() now encodes sessions that are new (i.e. we don't know yet
  if the client will be sending cookies or not) or if, if the session
  is not new (meaning the requested session id was a valid session) and
  the requested session id did not come from a cookie.
  
  Revision  ChangesPath
  1.19  +19 -15
jakarta-tomcat/src/facade22/org/apache/tomcat/facade/HttpServletResponseFacade.java
  
  Index: HttpServletResponseFacade.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat/src/facade22/org/apache/tomcat/facade/HttpServletResponseFacade.java,v
  retrieving revision 1.18
  retrieving revision 1.19
  diff -u -r1.18 -r1.19
  --- HttpServletResponseFacade.java2001/02/27 02:42:38 1.18
  +++ HttpServletResponseFacade.java2001/03/07 21:29:38 1.19
  @@ -1,4 +1,8 @@
   /*
  + * $Header: 
/home/cvs/jakarta-tomcat/src/facade22/org/apache/tomcat/facade/HttpServletResponseFacade.java,v
 1.19 2001/03/07 21:29:38 larryi Exp $
  + * $Revision: 1.19 $
  + * $Date: 2001/03/07 21:29:38 $
  + *
* 
*
* The Apache Software License, Version 1.1
  @@ -135,8 +139,7 @@
*/
   public String encodeRedirectURL(String location) {
if (isEncodeable(toAbsolute(location)))
  - return (toEncoded(location,
  -   response.getRequest().getRequestedSessionId()));
  + return (toEncoded(location, response.getRequest().getSession(false)));
else
return (location);
   }
  @@ -150,8 +153,7 @@
   
   public String encodeURL(String url) {
if (isEncodeable(toAbsolute(url)))
  - return (toEncoded(url,
  -   response.getRequest().getSessionId()));
  + return (toEncoded(url, response.getRequest().getSession(false)));
else
return (url);
   }
  @@ -330,15 +332,16 @@
if (location.startsWith("#"))
return (false);
   
  - // Are we in a valid session that is not using cookies?
  +// Are we in a valid session that is not using cookies?
Request request = response.getRequest();
  - HttpServletRequestFacade reqF=(HttpServletRequestFacade)request.
  - getFacade();
  - 
  - if (!reqF.isRequestedSessionIdValid() )
  - return (false);
  - if ( reqF.isRequestedSessionIdFromCookie() )
  - return (false);
  + ServerSession session = request.getSession(false);
  + if(session == null || !session.isValid())
  + return false;
  + // If the session is new, encode the URL
  + if(!session.getTimeStamp().isNew() &&
  + ((HttpServletRequestFacade)request.getFacade()).
  + isRequestedSessionIdFromCookie())
  + return false;
   
// Is this a valid absolute URL?
URL url = null;
  @@ -415,13 +418,14 @@
* suitably encoded.
*
* @param url URL to be encoded with the session id
  - * @param sessionId Session id to be included in the encoded URL
  + * @param session Session whose id is to be included in the encoded URL
*/
  -private String toEncoded(String url, String sessionId) {
  +private String toEncoded(String url, ServerSession session) {
   
  - if ((url == null) || (sessionId == null))
  + if ((url == null) || (session == null))
return (url);
   
  + String sessionId = session.getId().toString();
String path = null;
String query = null;
int question = url.indexOf("?");
  
  
  

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, email: [EMAIL PROTECTED]




cvs commit: jakarta-tomcat/src/facade22/org/apache/tomcat/facade HttpServletResponseFacade.java ServletWriterFacade.java

2001-02-26 Thread costin

costin  01/02/26 18:42:38

  Modified:src/facade22/org/apache/tomcat/facade
HttpServletResponseFacade.java
ServletWriterFacade.java
  Log:
  Another fix for the writer bug ( fixed by Nacho and Henri before M1 ).
  
  The new fix is reusing the writer, but makes sure close is not putting
  the PrintWriter in an un-usable state ( that was the original problem ).
  
  Nacho, Henri - please take a look ( I used jetspeed to reproduce and
  test and it seems the fix is good )
  
  Revision  ChangesPath
  1.18  +4 -21 
jakarta-tomcat/src/facade22/org/apache/tomcat/facade/HttpServletResponseFacade.java
  
  Index: HttpServletResponseFacade.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat/src/facade22/org/apache/tomcat/facade/HttpServletResponseFacade.java,v
  retrieving revision 1.17
  retrieving revision 1.18
  diff -u -r1.17 -r1.18
  --- HttpServletResponseFacade.java2001/02/20 03:34:10 1.17
  +++ HttpServletResponseFacade.java2001/02/27 02:42:38 1.18
  @@ -88,20 +88,20 @@
   private boolean usingStream = false;
   private boolean usingWriter = false;
   ServletOutputStreamFacade osFacade=null;
  -PrintWriter writer = null; // XXX will go away when we add the convertor
  +ServletWriterFacade writer;
   
  -// Logger.Helper loghelper = new Logger.Helper("tc_log", 
"HttpServletResponseFacade");
  -
   /** Package
*/
   HttpServletResponseFacade(Response response) {
   this.response = response;
  + OutputBuffer oBuffer= response.getBuffer();
  + writer = new ServletWriterFacade( oBuffer, response);
   }
   
   void recycle() {
usingStream = false;
usingWriter= false;
  - writer=null; // no need - the OutputBuffer will deal with enc
  + //  writer=null; // fixed ( ? )
if( osFacade != null ) osFacade.recycle();
   }
   
  @@ -193,23 +193,6 @@
throw new IllegalStateException(msg);
}
usingWriter= true ;
  - //  response.setUsingWriter( true );
  -
  - // old mechanism
  - // if( osFacade==null && response.getOutputBuffer() == null )
  - //  return response.getWriter();
  -
  - if( writer != null ) return writer;
  - if(  osFacade == null ) {
  - osFacade=new ServletOutputStreamFacade(response);
  - }
  -
  - OutputBuffer oBuffer= response.getBuffer();
  - writer = new ServletWriterFacade( oBuffer, response);
  - 
  - // writer=((ResponseImpl)response).getWriter( osFacade );
  - //  response.setServletOutputStream( osFacade );
  - //  response.setWriter(  writer );
   
return writer;
   }
  
  
  
  1.4   +10 -0 
jakarta-tomcat/src/facade22/org/apache/tomcat/facade/ServletWriterFacade.java
  
  Index: ServletWriterFacade.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat/src/facade22/org/apache/tomcat/facade/ServletWriterFacade.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- ServletWriterFacade.java  2001/02/20 03:34:11 1.3
  +++ ServletWriterFacade.java  2001/02/27 02:42:38 1.4
  @@ -110,6 +110,16 @@
super.write( str );
   }
   
  +public void close() {
  + // We don't close the PrintWriter - super() is not called,
  + // so the stream can be reused. We close ob.
  + try {
  + ob.close();
  + } catch (IOException ex ) {
  + ex.printStackTrace();
  + }
  +}
  +
   /** Reuse the object instance, avoid GC
*  Called from BSOS
*/
  
  
  

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, email: [EMAIL PROTECTED]




cvs commit: jakarta-tomcat/src/facade22/org/apache/tomcat/facade HttpServletResponseFacade.java

2001-02-12 Thread costin

costin  01/02/12 08:58:28

  Modified:src/facade22/org/apache/tomcat/facade
HttpServletResponseFacade.java
  Log:
  Recycle the writer, thanks Nacho for finding that.
  
  Revision  ChangesPath
  1.16  +1 -1  
jakarta-tomcat/src/facade22/org/apache/tomcat/facade/HttpServletResponseFacade.java
  
  Index: HttpServletResponseFacade.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat/src/facade22/org/apache/tomcat/facade/HttpServletResponseFacade.java,v
  retrieving revision 1.15
  retrieving revision 1.16
  diff -u -r1.15 -r1.16
  --- HttpServletResponseFacade.java2000/12/30 07:54:10 1.15
  +++ HttpServletResponseFacade.java2001/02/12 16:58:28 1.16
  @@ -101,7 +101,7 @@
   void recycle() {
usingStream = false;
usingWriter= false;
  - //  writer=null; // no need - the OutputBuffer will deal with enc
  + writer=null; // no need - the OutputBuffer will deal with enc
if( osFacade != null ) osFacade.recycle();
   }
   
  
  
  

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, email: [EMAIL PROTECTED]




cvs commit: jakarta-tomcat/src/facade22/org/apache/tomcat/facade HttpServletResponseFacade.java

2000-12-26 Thread costin

costin  00/12/26 14:50:48

  Modified:src/facade22/org/apache/tomcat/facade
HttpServletResponseFacade.java
  Log:
  Use the changes in ServerSession.
  
  Revision  ChangesPath
  1.14  +13 -16
jakarta-tomcat/src/facade22/org/apache/tomcat/facade/HttpServletResponseFacade.java
  
  Index: HttpServletResponseFacade.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat/src/facade22/org/apache/tomcat/facade/HttpServletResponseFacade.java,v
  retrieving revision 1.13
  retrieving revision 1.14
  diff -u -r1.13 -r1.14
  --- HttpServletResponseFacade.java2000/12/01 06:00:24 1.13
  +++ HttpServletResponseFacade.java2000/12/26 22:50:47 1.14
  @@ -112,10 +112,19 @@
if( response.isIncluded() ) return;
// layer costs - this can be avoided, but it's not a
// frequent operation ( for example sc can be reused )
  - ServerCookie sc=new ServerCookie();
  - cookie2serverCookie( cookie, sc);
  - addHeader( sc.getCookieHeaderName(),
  -sc.getCookieHeaderValue());
  +
  + // XXX reuse
  + StringBuffer sb=new StringBuffer();
  + 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.
  + addHeader( "Set-Cookie", 
  +sb.toString());
   }
   
   public boolean containsHeader(String name) {
  @@ -447,17 +456,5 @@
sb.append(query);
return (sb.toString());
   
  -}
  -
  -
  -private void cookie2serverCookie( Cookie cookie, ServerCookie sc ) {
  - sc.getName().setString( cookie.getName() );
  - sc.setVersion( cookie.getVersion());
  - sc.getValue().setString( cookie.getValue() );
  - sc.getPath().setString(cookie.getPath());
  - sc.getDomain().setString( cookie.getDomain());
  - sc.getComment().setString( cookie.getComment());
  - sc.setMaxAge( cookie.getMaxAge() );
  - sc.setSecure( cookie.getSecure());
   }
   }