cvs commit: jakarta-tomcat-connectors/coyote/src/java/org/apache/coyote/tomcat3 Tomcat3Request.java

2002-11-07 Thread billbarker
billbarker2002/11/07 22:19:51

  Modified:coyote/src/java/org/apache/coyote/tomcat3
Tomcat3Request.java
  Log:
  Clean up the handling of remoteAddr and remoteHost.
  
  We share both of these with the coyoteRequest, so there is no reason to duplicate.
  
  Revision  ChangesPath
  1.11  +0 -22 
jakarta-tomcat-connectors/coyote/src/java/org/apache/coyote/tomcat3/Tomcat3Request.java
  
  Index: Tomcat3Request.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-connectors/coyote/src/java/org/apache/coyote/tomcat3/Tomcat3Request.java,v
  retrieving revision 1.10
  retrieving revision 1.11
  diff -u -r1.10 -r1.11
  --- Tomcat3Request.java   19 Jun 2002 18:21:24 -  1.10
  +++ Tomcat3Request.java   8 Nov 2002 06:19:51 -   1.11
   -210,36 +210,14 
   
   public MessageBytes remoteAddr() {
if( remoteAddrMB.isNull() ) {
  - try {
  - remoteAddrMB.duplicate(coyoteRequest.remoteAddr());
  - } catch(IOException iex) { // can't happen
  - }
  - }
  - if( remoteAddrMB.isNull() ) {
coyoteRequest.action( ActionCode.ACTION_REQ_HOST_ATTRIBUTE, coyoteRequest 
);
  - try{
  - remoteAddrMB.duplicate( coyoteRequest.remoteAddr() );
  - remoteHostMB.duplicate( coyoteRequest.remoteHost() );
  - } catch(IOException iex) { // can't happen
  - }
}
return remoteAddrMB;
   }
   
   public MessageBytes remoteHost() {
if( remoteHostMB.isNull() ) {
  - try {
  - remoteHostMB.duplicate(coyoteRequest.remoteHost());
  - } catch(IOException iex) { // can't happen
  - }
  - }
  - if( remoteHostMB.isNull() ) {
coyoteRequest.action( ActionCode.ACTION_REQ_HOST_ATTRIBUTE, coyoteRequest 
);
  - try{
  - remoteAddrMB.duplicate( coyoteRequest.remoteAddr() );
  - remoteHostMB.duplicate( coyoteRequest.remoteHost() );
  - } catch(IOException iex) { // can't happen
  - }
}
return remoteHostMB;
   }
  
  
  

--
To unsubscribe, e-mail:   mailto:tomcat-dev-unsubscribe;jakarta.apache.org
For additional commands, e-mail: mailto:tomcat-dev-help;jakarta.apache.org




cvs commit: jakarta-tomcat-connectors/coyote/src/java/org/apache/coyote/tomcat3 Tomcat3Request.java

2002-04-09 Thread billbarker

billbarker02/04/09 00:02:53

  Modified:coyote/src/java/org/apache/coyote/tomcat3
Tomcat3Request.java
  Log:
  Tie into the backend remoteAddr  remoteHost lookup.
  
  The duplicates are ugly, but until we can safely stop the agressive recycling, they 
provide huge performance benifits by not doing the lookup on a per-request basis.
  
  Revision  ChangesPath
  1.5   +22 -0 
jakarta-tomcat-connectors/coyote/src/java/org/apache/coyote/tomcat3/Tomcat3Request.java
  
  Index: Tomcat3Request.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-connectors/coyote/src/java/org/apache/coyote/tomcat3/Tomcat3Request.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- Tomcat3Request.java   8 Apr 2002 23:47:04 -   1.4
  +++ Tomcat3Request.java   9 Apr 2002 07:02:53 -   1.5
  @@ -202,14 +202,36 @@
   
   public MessageBytes remoteAddr() {
if( remoteAddrMB.isNull() ) {
  + try {
  + remoteAddrMB.duplicate(coyoteRequest.remoteAddr());
  + } catch(IOException iex) { // can't happen
  + }
  + }
  + if( remoteAddrMB.isNull() ) {
coyoteRequest.action( ActionCode.ACTION_REQ_HOST_ATTRIBUTE, coyoteRequest 
);
  + try{
  + remoteAddrMB.duplicate( coyoteRequest.remoteAddr() );
  + remoteHostMB.duplicate( coyoteRequest.remoteHost() );
  + } catch(IOException iex) { // can't happen
  + }
}
return remoteAddrMB;
   }
   
   public MessageBytes remoteHost() {
  + if( remoteHostMB.isNull() ) {
  + try {
  + remoteHostMB.duplicate(coyoteRequest.remoteHost());
  + } catch(IOException iex) { // can't happen
  + }
  + }
if( remoteAddrMB.isNull() ) {
coyoteRequest.action( ActionCode.ACTION_REQ_HOST_ATTRIBUTE, coyoteRequest 
);
  + try{
  + remoteAddrMB.duplicate( coyoteRequest.remoteAddr() );
  + remoteHostMB.duplicate( coyoteRequest.remoteHost() );
  + } catch(IOException iex) { // can't happen
  + }
}
return remoteHostMB;
   }
  
  
  

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




cvs commit: jakarta-tomcat-connectors/coyote/src/java/org/apache/coyote/tomcat3 Tomcat3Request.java

2002-04-09 Thread billbarker

billbarker02/04/09 00:03:53

  Modified:coyote/src/java/org/apache/coyote/tomcat3
Tomcat3Request.java
  Log:
  Fix Typo.
  
  Revision  ChangesPath
  1.6   +1 -1  
jakarta-tomcat-connectors/coyote/src/java/org/apache/coyote/tomcat3/Tomcat3Request.java
  
  Index: Tomcat3Request.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-connectors/coyote/src/java/org/apache/coyote/tomcat3/Tomcat3Request.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- Tomcat3Request.java   9 Apr 2002 07:02:53 -   1.5
  +++ Tomcat3Request.java   9 Apr 2002 07:03:53 -   1.6
  @@ -225,7 +225,7 @@
} catch(IOException iex) { // can't happen
}
}
  - if( remoteAddrMB.isNull() ) {
  + if( remoteHostMB.isNull() ) {
coyoteRequest.action( ActionCode.ACTION_REQ_HOST_ATTRIBUTE, coyoteRequest 
);
try{
remoteAddrMB.duplicate( coyoteRequest.remoteAddr() );
  
  
  

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




cvs commit: jakarta-tomcat-connectors/coyote/src/java/org/apache/coyote/tomcat3 Tomcat3Request.java

2002-04-09 Thread costin

costin  02/04/09 11:02:19

  Modified:coyote/src/java/org/apache/coyote/tomcat3
Tomcat3Request.java
  Log:
  Merged few more methods from ajp.
  Use the same buffer for addresses, pass the info to Coyote Request
  
  Revision  ChangesPath
  1.7   +56 -0 
jakarta-tomcat-connectors/coyote/src/java/org/apache/coyote/tomcat3/Tomcat3Request.java
  
  Index: Tomcat3Request.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-connectors/coyote/src/java/org/apache/coyote/tomcat3/Tomcat3Request.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- Tomcat3Request.java   9 Apr 2002 07:03:53 -   1.6
  +++ Tomcat3Request.java   9 Apr 2002 18:02:19 -   1.7
  @@ -139,6 +139,13 @@
headers  = coyoteRequest.getMimeHeaders();
scookies.setHeaders(headers);
params.setHeaders(headers);
  +params.setQuery( queryMB );
  +
  +remoteAddrMB = coyoteRequest.remoteAddr();
  + remoteHostMB = coyoteRequest.remoteHost();
  + serverNameMB = coyoteRequest.serverName();
  +
  +
   }
   
   /** Read a single character from the request body.
  @@ -249,5 +256,54 @@
   public int getServerPort(){
   return coyoteRequest.getServerPort();
   }
  +
  +public void setServerPort(int i ) {
  + coyoteRequest.setServerPort( i );
  +}
  +
  +
  +public  void setRemoteUser( String s ) {
  + super.setRemoteUser(s);
  + coyoteRequest.getRemoteUser().setString(s);
  +}
  +
  +public String getRemoteUser() {
  + String s=coyoteRequest.getRemoteUser().toString();
  + if( s == null )
  + s=super.getRemoteUser();
  + return s;
  +}
  +
  +public String getAuthType() {
  + return coyoteRequest.getAuthType().toString();
  +}
  +
  +public void setAuthType(String s ) {
  + coyoteRequest.getAuthType().setString(s);
  +}
  +
  +public String getJvmRoute() {
  + return coyoteRequest.instanceId().toString();
  +}
  +
  +public void setJvmRoute(String s ) {
  + coyoteRequest.instanceId().setString(s);
  +}
  +
  +public boolean isSecure() {
  + return https.equalsIgnoreCase( coyoteRequest.scheme().toString());
  +}
  +
  +public void setAttribute(String name, Object value) {
  + coyoteRequest.setAttribute( name, value );
  +}
  +
  +public Object getAttribute(String name) {
  +if (name == null) {
  +return null;
  +}
  +return coyoteRequest.getAttribute( name );
  +}
  +
   
   }
  
  
  

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




Re: cvs commit: jakarta-tomcat-connectors/coyote/src/java/org/apache/coyote/tomcat3 Tomcat3Request.java

2002-04-09 Thread Bill Barker

   +
   +remoteAddrMB = coyoteRequest.remoteAddr();
   + remoteHostMB = coyoteRequest.remoteHost();
   + serverNameMB = coyoteRequest.serverName();
   +
   +

This forces the lookup to always be per-request, when it would be much nicer
to do it per-connection.

   +
   +public void setAttribute(String name, Object value) {
   + coyoteRequest.setAttribute( name, value );
   +}
   +
   +public Object getAttribute(String name) {
   +if (name == null) {
   +return null;
   +}
   +return coyoteRequest.getAttribute( name );
   +}
   +

Unless I'm missing something, this competely breaks SSL support, since
CoyoteInterceptor2.getInfo is never called.


}




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



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




Re: cvs commit: jakarta-tomcat-connectors/coyote/src/java/org/apache/coyote/tomcat3 Tomcat3Request.java

2002-04-09 Thread Bill Barker


- Original Message -
From: [EMAIL PROTECTED]
To: Tomcat Developers List [EMAIL PROTECTED]
Sent: Tuesday, April 09, 2002 1:45 PM
Subject: Re: cvs commit:
jakarta-tomcat-connectors/coyote/src/java/org/apache/coyote/tomcat3
Tomcat3Request.java


 On Tue, 9 Apr 2002, Bill Barker wrote:

 +
 +remoteAddrMB = coyoteRequest.remoteAddr();
 + remoteHostMB = coyoteRequest.remoteHost();
 + serverNameMB = coyoteRequest.serverName();
 +
 +
 
  This forces the lookup to always be per-request, when it would be much
nicer
  to do it per-connection.

 This is done when the tomcat3 request is created  - and it only means
 that the buffers for storing the remoteHost and serverName are identical (
 we override the tomcat.Request fields with the MessageBytes from
 coyote.Request ). That avoids copying them.

 ( the request is recycled, but the fields remain )

 Unless I'm missing something.

These fields are recycled per-request, so we lose the value of
remoteHost/remoteAddr and will have to look it up again.  If the buffers are
identical, then the o.a.c.Request field is recycled as well. At least for
remoteHost, I'd prefer the copy.


 +public void setAttribute(String name, Object value) {
 + coyoteRequest.setAttribute( name, value );
 +}
 +
 +public Object getAttribute(String name) {
 +if (name == null) {
 +return null;
 +}
 +return coyoteRequest.getAttribute( name );
 +}
 +
 
  Unless I'm missing something, this competely breaks SSL support, since
  CoyoteInterceptor2.getInfo is never called.

 Yes, I'll fix it. Thanks !

I'd be +1 for making get/setAttribute final on the core Request.


 Costin


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



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




Re: cvs commit: jakarta-tomcat-connectors/coyote/src/java/org/apache/coyote/tomcat3 Tomcat3Request.java

2002-04-09 Thread Bill Barker


- Original Message -
From: [EMAIL PROTECTED]
To: Tomcat Developers List [EMAIL PROTECTED]
Sent: Tuesday, April 09, 2002 1:45 PM
Subject: Re: cvs commit:
jakarta-tomcat-connectors/coyote/src/java/org/apache/coyote/tomcat3
Tomcat3Request.java


 On Tue, 9 Apr 2002, Bill Barker wrote:

   Unless I'm missing something.
 
  These fields are recycled per-request, so we lose the value of
  remoteHost/remoteAddr and will have to look it up again.  If the buffers
are
  identical, then the o.a.c.Request field is recycled as well. At least
for
  remoteHost, I'd prefer the copy.

 But how would that work with AJP or other protocols ? Only the protocol
 can know if the host/addr are unchanged and optimize for it - I don't
 think the container has enough information to do that.


That's a good point.

 I'm still missing something I guess :-)

 I can try to preserve the host/addr at the http11 level if you think
 it's important ( just to make Remy nervous :-)


It's not extremely important.  It's just a nice optimization for people who
use remoteHost.  If you want to concentrate on JK, I'll volunteer to make
Remy nervous. :-)

  I'd be +1 for making get/setAttribute final on the core Request.

 +1 too. Not a big priority as long as you and Lary are reviewing
 the commits and prevent me from braking too much :-)

 Costin


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



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




Re: cvs commit: jakarta-tomcat-connectors/coyote/src/java/org/apache/coyote/tomcat3 Tomcat3Request.java

2002-04-09 Thread Remy Maucherat

  I'm still missing something I guess :-)
 
  I can try to preserve the host/addr at the http11 level if you think
  it's important ( just to make Remy nervous :-)
 

 It's not extremely important.  It's just a nice optimization for people
who
 use remoteHost.  If you want to concentrate on JK, I'll volunteer to make
 Remy nervous. :-)

Costin made me nervous enough for the whole week ;-)
In Tomcat 4, the default is to not resolve hosts, and we don't talk too much
about the flag. This solves the performance problem :)

Remy


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




cvs commit: jakarta-tomcat-connectors/coyote/src/java/org/apache/coyote/tomcat3 Tomcat3Request.java

2002-04-08 Thread costin

costin  02/04/08 15:57:36

  Modified:coyote/src/java/org/apache/coyote/tomcat3
Tomcat3Request.java
  Log:
  Pass the request for lazy attributes to the protocol.
  
  That's used for stuff that is not allways needed ( remote host ) and expensive
  to compute.
  
  Revision  ChangesPath
  1.3   +7 -10 
jakarta-tomcat-connectors/coyote/src/java/org/apache/coyote/tomcat3/Tomcat3Request.java
  
  Index: Tomcat3Request.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-connectors/coyote/src/java/org/apache/coyote/tomcat3/Tomcat3Request.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- Tomcat3Request.java   5 Apr 2002 22:17:49 -   1.2
  +++ Tomcat3Request.java   8 Apr 2002 22:57:36 -   1.3
  @@ -73,6 +73,7 @@
   import org.apache.tomcat.util.log.*;
   import org.apache.tomcat.util.compat.*;
   import org.apache.coyote.Adapter;
  +import org.apache.coyote.ActionCode;
   import org.apache.coyote.Processor;
   
   /** The Request to connect with Coyote.
  @@ -196,24 +197,20 @@
   //  override special methods
   
   public MessageBytes remoteAddr() {
  -
  -// XXX Call back the protocol layer - lazy evaluation.
  -//   if( remoteAddrMB.isNull() ) {
  -//   remoteAddrMB.setString(socket.getInetAddress().getHostAddress());
  -//   }
  + if( remoteAddrMB.isNull() ) {
  + coyoteRequest.action( ActionCode.ACTION_REQ_HOST_ATTRIBUTE, coyoteRequest 
);
  + }
return remoteAddrMB;
   }
   
   public MessageBytes remoteHost() {
  -//   if( remoteHostMB.isNull() ) {
  -//   remoteHostMB.setString( socket.getInetAddress().getHostName() );
  -//   }
  + if( remoteAddrMB.isNull() ) {
  + coyoteRequest.action( ActionCode.ACTION_REQ_HOST_ATTRIBUTE, coyoteRequest 
);
  + }
return remoteHostMB;
   }
   
   public String getLocalHost() {
  -//   InetAddress localAddress = socket.getLocalAddress();
  -//   localHost = localAddress.getHostName();
return localHost;
   }
   
  
  
  

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