cvs commit: jakarta-tomcat-connectors/jk/java/org/apache/jk/common HandlerRequest.java

2005-08-17 Thread pero
pero2005/08/17 01:14:29

  Modified:jk/java/org/apache/jk/common HandlerRequest.java
  Log:
  Reports request secret only at trace level!
  
  Revision  ChangesPath
  1.49  +2 -2  
jakarta-tomcat-connectors/jk/java/org/apache/jk/common/HandlerRequest.java
  
  Index: HandlerRequest.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-connectors/jk/java/org/apache/jk/common/HandlerRequest.java,v
  retrieving revision 1.48
  retrieving revision 1.49
  diff -u -r1.48 -r1.49
  --- HandlerRequest.java   16 Jul 2005 20:54:05 -  1.48
  +++ HandlerRequest.java   17 Aug 2005 08:14:29 -  1.49
  @@ -519,8 +519,8 @@
   case AjpConstants.SC_A_SECRET  :
   msg.getBytes(tmpMB);
   String secret=tmpMB.toString();
  -if(log.isInfoEnabled())
  -log.info(Secret:  + secret );
  +if(log.isTraceEnabled())
  +log.trace(Secret:  + secret );
   // endpoint note
   ep.setNote( secretNote, secret );
   break;
  
  
  

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



cvs commit: jakarta-tomcat-connectors/jk/java/org/apache/jk/common HandlerRequest.java JkInputStream.java

2005-07-16 Thread billbarker
billbarker2005/07/16 13:54:05

  Modified:jk/java/org/apache/jk/common HandlerRequest.java
JkInputStream.java
  Log:
  Copy the idea from the APR Connector, and delay reading the initial request 
body packet until the Servlet asks for it.
  
  This reduces the chance that the socket read will block uselessly waiting for 
the data to be available.  You can restore the previous behavior by setting 
request.delayInitialRead=false on the Connector.
  
  Of course, if Bill R. decides to port his C-L patch for proxy_http to mod_jk, 
the value of this setting won't matter :).
  
  Revision  ChangesPath
  1.48  +28 -10
jakarta-tomcat-connectors/jk/java/org/apache/jk/common/HandlerRequest.java
  
  Index: HandlerRequest.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-connectors/jk/java/org/apache/jk/common/HandlerRequest.java,v
  retrieving revision 1.47
  retrieving revision 1.48
  diff -u -r1.47 -r1.48
  --- HandlerRequest.java   30 Jun 2005 02:49:38 -  1.47
  +++ HandlerRequest.java   16 Jul 2005 20:54:05 -  1.48
  @@ -168,6 +168,20 @@
   return registerRequests;
   }
   
  +/**
  + * Set the flag to delay the initial body read
  + */
  +public void setDelayInitialRead(boolean dir) {
  + delayInitialRead = dir;
  +}
  +
  +/**
  + * Get the flag to tell if we delay the initial body read
  + */
  +public boolean getDelayInitialRead() {
  + return delayInitialRead;
  +}
  +
   //  Ajp13.id 
   
   private void generateAjp13Id() {
  @@ -210,14 +224,15 @@
   }
   
   //  Incoming message 
  -String requiredSecret=null;
  -int secretNote;
  -int tmpBufNote;
  -
  -boolean decoded=true;
  -boolean tomcatAuthentication=true;
  -boolean registerRequests=true;
  -boolean shutdownEnabled=false;
  +private String requiredSecret=null;
  +private int secretNote;
  +private int tmpBufNote;
  +
  +private boolean decoded=true;
  +private boolean tomcatAuthentication=true;
  +private boolean registerRequests=true;
  +private boolean shutdownEnabled=false;
  +private boolean delayInitialRead = true;
   
   public int invoke(Msg msg, MsgContext ep ) 
   throws IOException{
  @@ -393,8 +408,11 @@
   // immediately after
   int cl=req.getContentLength();
   if(cl  0) {
  -// This is hidious.  Look to remove it.
  -ep.getInputStream().receive();
  +JkInputStream jkIS = ep.getInputStream();
  +jkIS.setIsReadRequired(true);
  +if(!delayInitialRead) {
  +jkIS.receive();
  +}
   }
   
   if (log.isTraceEnabled()) {
  
  
  
  1.20  +26 -0 
jakarta-tomcat-connectors/jk/java/org/apache/jk/common/JkInputStream.java
  
  Index: JkInputStream.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-connectors/jk/java/org/apache/jk/common/JkInputStream.java,v
  retrieving revision 1.19
  retrieving revision 1.20
  diff -u -r1.19 -r1.20
  --- JkInputStream.java30 Jun 2005 02:49:38 -  1.19
  +++ JkInputStream.java16 Jul 2005 20:54:05 -  1.20
  @@ -50,6 +50,7 @@
   private boolean isEmpty = true;
   private boolean isFirst = true;
   private boolean isReplay = false;
  +private boolean isReadRequired = false;
   
   static {
   // Make certain HttpMessages is loaded for SecurityManager
  @@ -66,14 +67,39 @@
   
   //  Jk specific methods 
   
  +
  +/**
  + * Set the flag saying that the server is sending a body
  + */
  +public void setIsReadRequired(boolean irr) {
  +isReadRequired = irr;
  +}
  +
  +/**
  + * Return the flag saying that the server is sending a body
  + */
  +public boolean isReadRequired() {
  +return isReadRequired;
  +}
  +
   
   /** Must be called before or after each request
*/
   public void recycle() {
  +if(isReadRequired  isFirst) {
  +// The Servlet never read the request body, so we need to junk it
  +try {
  +  receive();
  +} catch(IOException iex) {
  +  log.debug(Error consuming request body,iex);
  +}
  +}
  +
   end_of_stream = false;
   isEmpty = true;
   isFirst = true;
   isReplay = false;
  +isReadRequired = false;
   bodyBuff.recycle();
   tempMB.recycle();
   }
  
  
  

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

cvs commit: jakarta-tomcat-connectors/jk/java/org/apache/jk/common HandlerRequest.java

2004-12-16 Thread billbarker
billbarker2004/12/16 19:02:41

  Modified:jk/java/org/apache/jk/common HandlerRequest.java
  Log:
  Fix weird NumberFormatException.
  
  Apache never sends Content-Length as a String, which is probably why this 
one has been here so long.
  
  Reported By: Allistair Crossley [EMAIL PROTECTED]
  
  Revision  ChangesPath
  1.41  +3 -6  
jakarta-tomcat-connectors/jk/java/org/apache/jk/common/HandlerRequest.java
  
  Index: HandlerRequest.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-connectors/jk/java/org/apache/jk/common/HandlerRequest.java,v
  retrieving revision 1.40
  retrieving revision 1.41
  diff -u -r1.40 -r1.41
  --- HandlerRequest.java   11 Dec 2004 04:00:35 -  1.40
  +++ HandlerRequest.java   17 Dec 2004 03:02:41 -  1.41
  @@ -675,8 +675,6 @@
   hId = -1;
   msg.getBytes( tmpMB );
   ByteChunk bc=tmpMB.getByteChunk();
  -//hName=tmpMB.toString();
  -//vMB=headers.addValue( hName );
   vMB=headers.addValue( bc.getBuffer(),
 bc.getStart(), bc.getLength() );
   }
  @@ -684,12 +682,11 @@
   msg.getBytes(vMB);
   
   if (hId == SC_REQ_CONTENT_LENGTH ||
  -tmpMB.equalsIgnoreCase(Content-Length)) {
  +(hId == -1  tmpMB.equalsIgnoreCase(Content-Length))) {
   // just read the content-length header, so set it
  -int contentLength = (vMB == null) ? -1 : vMB.getInt();
  -req.setContentLength(contentLength);
  +req.setContentLength( vMB.getInt() );
   } else if (hId == SC_REQ_CONTENT_TYPE ||
  -   tmpMB.equalsIgnoreCase(Content-Type)) {
  +(hId == -1  tmpMB.equalsIgnoreCase(Content-Type))) {
   // just read the content-type header, so set it
   ByteChunk bchunk = vMB.getByteChunk();
   req.contentType().setBytes(bchunk.getBytes(),
  
  
  

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



cvs commit: jakarta-tomcat-connectors/jk/java/org/apache/jk/common HandlerRequest.java

2004-12-10 Thread billbarker
billbarker2004/12/10 20:00:35

  Modified:jk/java/org/apache/jk/common HandlerRequest.java
  Log:
  Syncronize access to the Request registration count.
  
  There are reports on the user list that this isn't close enough to atomic, 
and doesn't happen often enough to worry about the overhead of syncronized.
  
  Revision  ChangesPath
  1.40  +8 -1  
jakarta-tomcat-connectors/jk/java/org/apache/jk/common/HandlerRequest.java
  
  Index: HandlerRequest.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-connectors/jk/java/org/apache/jk/common/HandlerRequest.java,v
  retrieving revision 1.39
  retrieving revision 1.40
  diff -u -r1.39 -r1.40
  --- HandlerRequest.java   17 Sep 2004 04:50:47 -  1.39
  +++ HandlerRequest.java   11 Dec 2004 04:00:35 -  1.40
  @@ -189,6 +189,11 @@
*/
   public static final int HOSTBUFFER = 10;
   
  +/**
  + * Thread lock.
  + */
  +private static Object lock = new Object();
  +
   HandlerDispatch dispatch;
   String ajpidDir=conf;
   
  @@ -451,7 +456,9 @@
   req.setResponse(res);
   ep.setRequest( req );
   if( registerRequests ) {
  -ep.getSource().registerRequest(req, ep, count++);
  +synchronized(lock) {
  +ep.getSource().registerRequest(req, ep, count++);
  +}
   }
   }
   return req;
  
  
  

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



cvs commit: jakarta-tomcat-connectors/jk/java/org/apache/jk/common HandlerRequest.java

2004-09-16 Thread billbarker
billbarker2004/09/16 21:50:48

  Modified:jk/java/org/apache/jk/common HandlerRequest.java
  Log:
  Require that use of AJP/1.3 shutdown is explictly enabled to function.
  
  No Adapter in any version of Tomcat currently supports a clean shutdown from 
AJP/1.3, so it is better to turn it off (by default) for now.
  
  Fix for Bug #31204
  
  Revision  ChangesPath
  1.39  +25 -6 
jakarta-tomcat-connectors/jk/java/org/apache/jk/common/HandlerRequest.java
  
  Index: HandlerRequest.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-connectors/jk/java/org/apache/jk/common/HandlerRequest.java,v
  retrieving revision 1.38
  retrieving revision 1.39
  diff -u -r1.38 -r1.39
  --- HandlerRequest.java   15 Jun 2004 20:37:11 -  1.38
  +++ HandlerRequest.java   17 Sep 2004 04:50:47 -  1.39
  @@ -251,6 +251,14 @@
   return tomcatAuthentication;
   }
   
  +public void setShutdownEnabled(boolean se) {
  +shutdownEnabled = se;
  +}
  +
  +public boolean getShutdownEnabled() {
  +return shutdownEnabled;
  +}
  +
   public void setTomcatAuthentication(boolean newTomcatAuthentication) {
   tomcatAuthentication = newTomcatAuthentication;
   }
  @@ -324,6 +332,7 @@
   boolean decoded=true;
   boolean tomcatAuthentication=true;
   boolean registerRequests=true;
  +boolean shutdownEnabled=false;
   
   public int invoke(Msg msg, MsgContext ep ) 
   throws IOException
  @@ -399,9 +408,14 @@
if( !ch.isSameAddress(ep) ) {
log.error(Shutdown request not from 'same address' );
return ERROR;
  - }
  +}
   
  +if( !shutdownEnabled ) {
  +log.warn(Ignoring shutdown request: shutdown not enabled);
  +return ERROR;
  +}
   // forward to the default handler - it'll do the shutdown
  +checkRequest(ep);
   next.invoke( msg, ep );
   
   log.info(Exiting);
  @@ -429,10 +443,7 @@
   
   static int count = 0;
   
  -private int decodeRequest( Msg msg, MsgContext ep, MessageBytes tmpMB )
  -throws IOException
  -{
  -// FORWARD_REQUEST handler
  +private Request checkRequest(MsgContext ep) {
   Request req=(Request)ep.getRequest();
   if( req==null ) {
   req=new Request();
  @@ -440,9 +451,17 @@
   req.setResponse(res);
   ep.setRequest( req );
   if( registerRequests ) {
  - ep.getSource().registerRequest(req, ep, count++);
  +ep.getSource().registerRequest(req, ep, count++);
   }
   }
  +return req;
  +}
  +
  +private int decodeRequest( Msg msg, MsgContext ep, MessageBytes tmpMB )
  +throws IOException
  +{
  +// FORWARD_REQUEST handler
  +Request req = checkRequest(ep);
   
RequestInfo rp = req.getRequestProcessor();
rp.setStage(Constants.STAGE_PARSE);
  
  
  

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



cvs commit: jakarta-tomcat-connectors/jk/java/org/apache/jk/common HandlerRequest.java

2004-06-15 Thread keith
keith   2004/06/15 13:37:11

  Modified:jk/native2/common jk_requtil.c
   jk/java/org/apache/ajp RequestHandler.java
   jk/xdocs/common AJPv13.xml
   jk/native2/include jk_service.h
   jk/java/org/apache/jk/common HandlerRequest.java
  Log:
  Previously the transport would fail for unrecognizned methods; this 

  changes mod_jk2 to send the full method string if the method is

  unrecognized.
  
  Revision  ChangesPath
  1.33  +12 -2 jakarta-tomcat-connectors/jk/native2/common/jk_requtil.c
  
  Index: jk_requtil.c
  ===
  RCS file: /home/cvs/jakarta-tomcat-connectors/jk/native2/common/jk_requtil.c,v
  retrieving revision 1.32
  retrieving revision 1.33
  diff -u -r1.32 -r1.33
  --- jk_requtil.c  21 Mar 2004 09:43:09 -  1.32
  +++ jk_requtil.c  15 Jun 2004 20:37:10 -  1.33
  @@ -67,6 +67,7 @@
   /* only in if JkOptions +ForwardKeySize */
   #define SC_A_SSL_KEY_SIZE   (unsigned char)11
   #define SC_A_SECRET (unsigned char)12
  +#define SC_A_STORED_METHOD  (unsigned char)13
   #define SC_A_ARE_DONE   (unsigned char)0xFF
   
   /*
  @@ -189,7 +190,7 @@
   *sc = SC_M_MKACTIVITY;
   }
   else {
  -rc = JK_ERR;
  + *sc = SC_M_JK_STORED;
   }
   
   return rc;
  @@ -551,7 +552,7 @@
   rc = jk2_requtil_getMethodId(env, s-method, method);
   if (rc != JK_OK) {
   env-l-jkLog(env, env-l, JK_LOG_ERROR,
  -  Error ajp_marshal_into_msgb - No such method %s\n,
  +  Error ajp_marshal_into_msgb - method %s\n,
 s-method);
   return JK_ERR;
   }
  @@ -697,6 +698,15 @@
   }
   }
   
  +/* If the method was unrecognized, encode it as an attribute */
  + if (method == SC_M_JK_STORED) {
  + if (msg-appendByte(env, msg, SC_A_STORED_METHOD) ||
  +msg-appendString(env, msg, s-method)) {
  +env-l-jkLog(env, env-l, JK_LOG_ERROR,
  + handle.request() Error encoding method %s\n,
  + s-method);
  + }
  + }
   
   if (s-attributes-size(env, s-attributes)  0) {
   for (i = 0; i  s-attributes-size(env, s-attributes); i++) {
  
  
  
  1.21  +10 -1 
jakarta-tomcat-connectors/jk/java/org/apache/ajp/RequestHandler.java
  
  Index: RequestHandler.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-connectors/jk/java/org/apache/ajp/RequestHandler.java,v
  retrieving revision 1.20
  retrieving revision 1.21
  diff -u -r1.20 -r1.21
  --- RequestHandler.java   24 Feb 2004 08:48:43 -  1.20
  +++ RequestHandler.java   15 Jun 2004 20:37:10 -  1.21
  @@ -90,6 +90,7 @@
   public static final byte SC_A_SSL_SESSION   = 9;
   public static final byte SC_A_SSL_KEY_SIZE  = 11; // ajp14 originally, now in 
ajp13 with jk 1.2/2.0
   public static final byte SC_A_SECRET= 12;
  +public static final byte SC_A_STORED_METHOD = 13;
   
   // Used for attributes which are not in the list above
   public static final byte SC_A_REQ_ATTRIBUTE = 10; 
  @@ -127,6 +128,8 @@
   BASELINE-CONTROL,
   MKACTIVITY
   };
  +public static final int SC_M_JK_STORED = (byte) 0xFF;
  +
   
   // id's for common request headers
   public static final int SC_REQ_ACCEPT  = 1;
  @@ -254,7 +257,8 @@
   
   // Translate the HTTP method code to a String.
   byte methodCode = msg.getByte();
  -req.method().setString(methodTransArray[(int)methodCode - 1]);
  +if (methodCode != SC_M_JK_STORED)
  +  req.method().setString(methodTransArray[(int)methodCode - 1]);
   
   msg.getMessageBytes(req.protocol()); 
   msg.getMessageBytes(req.requestURI());
  @@ -402,6 +406,11 @@
req.setAttribute(javax.servlet.request.key_size,
 Integer.toString(msg.getInt()));
break;
  +
  +case SC_A_STORED_METHOD:
  +req.method().setString(msg.getString());
  +break;
  +
default:
   // Ignore. Assume a single-string value - we shouldn't
   // allow anything else.
  
  
  
  1.9   +5 -1  jakarta-tomcat-connectors/jk/xdocs/common/AJPv13.xml
  
  Index: AJPv13.xml
  ===
  RCS file: /home/cvs/jakarta-tomcat-connectors/jk/xdocs/common/AJPv13.xml,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- AJPv13.xml4 Mar 2004 04:46:34 -   1.8
  +++ AJPv13.xml15 Jun 2004 20:37:10 -  1.9
  @@ -418,6 +418,10 @@
   /table
   /p
   
  +pLater version of ajp13, when used with mod_jk2, will 

cvs commit: jakarta-tomcat-connectors/jk/java/org/apache/jk/common HandlerRequest.java

2004-04-04 Thread markt
markt   2004/04/04 12:09:38

  Modified:coyote/src/java/org/apache/coyote/tomcat4 CoyoteAdapter.java
   jk/java/org/apache/jk/common HandlerRequest.java
  Log:
  - Fix bug 16157. Set AuthType on HttpServletRequest.
  - First part of patch.
  - Patch submitted by Kan Ogawa.
  
  Revision  ChangesPath
  1.28  +7 -1  
jakarta-tomcat-connectors/coyote/src/java/org/apache/coyote/tomcat4/CoyoteAdapter.java
  
  Index: CoyoteAdapter.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-connectors/coyote/src/java/org/apache/coyote/tomcat4/CoyoteAdapter.java,v
  retrieving revision 1.27
  retrieving revision 1.28
  diff -u -r1.27 -r1.28
  --- CoyoteAdapter.java24 Feb 2004 08:54:29 -  1.27
  +++ CoyoteAdapter.java4 Apr 2004 19:09:38 -   1.28
  @@ -278,6 +278,12 @@
   request.setUserPrincipal(new CoyotePrincipal(principal));
   }
   
  +// Set the authorization type
  +String authtype = req.getAuthType().toString();
  +if (authtype != null) {
  +request.setAuthType(authtype);
  +}
  +
   }
   
   /**
  
  
  
  1.35  +6 -1  
jakarta-tomcat-connectors/jk/java/org/apache/jk/common/HandlerRequest.java
  
  Index: HandlerRequest.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-connectors/jk/java/org/apache/jk/common/HandlerRequest.java,v
  retrieving revision 1.34
  retrieving revision 1.35
  diff -u -r1.34 -r1.35
  --- HandlerRequest.java   24 Feb 2004 08:48:42 -  1.34
  +++ HandlerRequest.java   4 Apr 2004 19:09:38 -   1.35
  @@ -584,7 +584,12 @@
   break;
   
   case SC_A_AUTH_TYPE:
  -msg.getBytes(req.getAuthType());
  +if( tomcatAuthentication ) {
  +// ignore server
  +msg.getBytes( tmpMB );
  +} else {
  +msg.getBytes(req.getAuthType());
  +}
   break;
   
   case SC_A_QUERY_STRING :
  
  
  

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



Re: cvs commit: jakarta-tomcat-connectors/jk/java/org/apache/jk/common HandlerRequest.java

2004-02-19 Thread Remy Maucherat
[EMAIL PROTECTED] wrote:
billbarker2004/02/18 19:44:00

  Modified:jk/java/org/apache/jk/common HandlerRequest.java
  Log:
  Fix JMX Request registration.
  
  And, yes I did test it this time :).
  
  Reported By: Jess Holle [EMAIL PROTECTED]
Do you want a new 5.0.20 release to pick this up, or is it ok to release 
5.0.19 anyway ?
It doesn't seem to me this is very critical, although it can be useful 
in some cases.

Rémy

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


Re: cvs commit: jakarta-tomcat-connectors/jk/java/org/apache/jk/common HandlerRequest.java

2004-02-19 Thread Bill Barker
I don't think this is important enough to stop the 5.0.19 release, since it
doesn't effect the core functionality of Jk-Coyote.  People that want it to
work can grab the jar from the nightly or the gump(y) build (or compile the
file into server/classes).  And there is a configuration setting for people
who don't want to see the error messages in their logs.

- Original Message -
From: Remy Maucherat [EMAIL PROTECTED]
To: Tomcat Developers List [EMAIL PROTECTED]
Sent: Thursday, February 19, 2004 1:13 AM
Subject: Re: cvs commit:
jakarta-tomcat-connectors/jk/java/org/apache/jk/common HandlerRequest.java


[EMAIL PROTECTED] wrote:
 billbarker2004/02/18 19:44:00

   Modified:jk/java/org/apache/jk/common HandlerRequest.java
   Log:
   Fix JMX Request registration.

   And, yes I did test it this time :).

   Reported By: Jess Holle [EMAIL PROTECTED]

Do you want a new 5.0.20 release to pick this up, or is it ok to release
5.0.19 anyway ?
It doesn't seem to me this is very critical, although it can be useful
in some cases.

Rémy

-
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-connectors/jk/java/org/apache/jk/common HandlerRequest.java

2004-02-18 Thread billbarker
billbarker2004/02/18 19:44:00

  Modified:jk/java/org/apache/jk/common HandlerRequest.java
  Log:
  Fix JMX Request registration.
  
  And, yes I did test it this time :).
  
  Reported By: Jess Holle [EMAIL PROTECTED]
  
  Revision  ChangesPath
  1.33  +1 -1  
jakarta-tomcat-connectors/jk/java/org/apache/jk/common/HandlerRequest.java
  
  Index: HandlerRequest.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-connectors/jk/java/org/apache/jk/common/HandlerRequest.java,v
  retrieving revision 1.32
  retrieving revision 1.33
  diff -u -r1.32 -r1.33
  --- HandlerRequest.java   27 Jan 2004 11:49:35 -  1.32
  +++ HandlerRequest.java   19 Feb 2004 03:44:00 -  1.33
  @@ -504,7 +504,7 @@
   RequestInfo rp=req.getRequestProcessor();
   rp.setGlobalProcessor(global);
   ObjectName roname = new ObjectName(getDomain() + 
  -   type=RequestProcessor,name=JkRequest 
+count++);
  +   :type=RequestProcessor,name=JkRequest 
+count++);
   ep.setNote(JMXRequestNote, roname);
   
   Registry.getRegistry().registerComponent( rp,
  
  
  

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



cvs commit: jakarta-tomcat-connectors/jk/java/org/apache/jk/common HandlerRequest.java

2004-01-27 Thread remm
remm2004/01/27 03:49:36

  Modified:jk/java/org/apache/jk/common HandlerRequest.java
  Log:
  - Cleanup the logging for unknown packets (lots of System.out previsouly).
  - I'm getting an unknown packet on shutdown, BTW (it must be the unknown packet
which is being logged).
  
  Revision  ChangesPath
  1.32  +1 -2  
jakarta-tomcat-connectors/jk/java/org/apache/jk/common/HandlerRequest.java
  
  Index: HandlerRequest.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-connectors/jk/java/org/apache/jk/common/HandlerRequest.java,v
  retrieving revision 1.31
  retrieving revision 1.32
  diff -u -r1.31 -r1.32
  --- HandlerRequest.java   16 Jan 2004 06:48:20 -  1.31
  +++ HandlerRequest.java   27 Jan 2004 11:49:35 -  1.32
  @@ -473,8 +473,7 @@
   return OK;
   
   default:
  -System.err.println(Unknown message  + type );
  -msg.dump(Unknown message );
  +log.info(Unknown message  + type);
   }
   
   return OK;
  
  
  

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



cvs commit: jakarta-tomcat-connectors/jk/java/org/apache/jk/common HandlerRequest.java

2004-01-15 Thread billbarker
billbarker2004/01/15 19:57:59

  Modified:jk/java/org/apache/jk/common HandlerRequest.java
  Log:
  Add an option to allow the admin to *not* JMX register the requests.
  
  This is mostly because it may take awhile to plug the memory leaks that registering 
the requests causes (esp. for channel.jni :).
  
  Revision  ChangesPath
  1.30  +17 -2 
jakarta-tomcat-connectors/jk/java/org/apache/jk/common/HandlerRequest.java
  
  Index: HandlerRequest.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-connectors/jk/java/org/apache/jk/common/HandlerRequest.java,v
  retrieving revision 1.29
  retrieving revision 1.30
  diff -u -r1.29 -r1.30
  --- HandlerRequest.java   3 Dec 2003 05:37:42 -   1.29
  +++ HandlerRequest.java   16 Jan 2004 03:57:59 -  1.30
  @@ -295,7 +295,21 @@
   if( .equals( path ) ) path=null;
   ajpidDir=path;
   }
  -
  +
  +/**
  + * Set the flag to tell if we JMX register requests.
  + */
  +public void setRegisterRequests(boolean srr) {
  +registerRequests = srr;
  +}
  +
  +/**
  + * Get the flag to tell if we JMX register requests.
  + */
  +public boolean getRegisterRequests() {
  +return registerRequests;
  +}
  +
   //  Ajp13.id 
   
   private void generateAjp13Id() {
  @@ -345,6 +359,7 @@
   
   boolean decoded=true;
   boolean tomcatAuthentication=true;
  +boolean registerRequests=true;
   
   public int invoke(Msg msg, MsgContext ep ) 
   throws IOException
  @@ -462,7 +477,7 @@
   Response res=new Response();
   req.setResponse(res);
   ep.setRequest( req );
  -if( this.getDomain() != null ) {
  +if( registerRequests  this.getDomain() != null ) {
   try {
   if( global==null ) {
   global=new RequestGroupInfo();
  
  
  

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



cvs commit: jakarta-tomcat-connectors/jk/java/org/apache/jk/common HandlerRequest.java

2003-12-02 Thread billbarker
billbarker2003/12/02 21:37:42

  Modified:jk/java/org/apache/jk/common HandlerRequest.java
  Log:
  Fix JkCoyote to properly handle the distinction between localName/Port and 
serverName/Port.
  
  As always with mod_jk, you can lose strict Servlet-Spec compliance by playing with 
your Apache settings.  However if ConnonicalName=on or DNS, then this is correct.  If 
it's not, then you obviously don't want this to be correct ;-).  It also seems to be 
the value that IIS is sending.
  
  Thanks to Remy for his great parseHost routine (which I had to modify slightly, 
because of design differences in JkCoyote and HTTP11Coyote).
  
  Revision  ChangesPath
  1.29  +144 -60   
jakarta-tomcat-connectors/jk/java/org/apache/jk/common/HandlerRequest.java
  
  Index: HandlerRequest.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-connectors/jk/java/org/apache/jk/common/HandlerRequest.java,v
  retrieving revision 1.28
  retrieving revision 1.29
  diff -u -r1.28 -r1.29
  --- HandlerRequest.java   16 Oct 2003 07:37:32 -  1.28
  +++ HandlerRequest.java   3 Dec 2003 05:37:42 -   1.29
  @@ -62,6 +62,7 @@
   import java.io.File;
   import java.io.FileOutputStream;
   import java.io.IOException;
  +import java.io.CharConversionException;
   import java.net.InetAddress;
   import java.util.Properties;
   
  @@ -75,6 +76,8 @@
   import org.apache.jk.core.MsgContext;
   import org.apache.jk.core.WorkerEnv;
   import org.apache.tomcat.util.buf.ByteChunk;
  +import org.apache.tomcat.util.buf.CharChunk;
  +import org.apache.tomcat.util.buf.HexUtils;
   import org.apache.tomcat.util.buf.MessageBytes;
   import org.apache.tomcat.util.http.MimeHeaders;
   import org.apache.tomcat.util.net.SSLSupport;
  @@ -109,16 +112,16 @@
   
   // Prefix codes for message types from server to container
   public static final byte JK_AJP13_FORWARD_REQUEST   = 2;
  - public static final byte JK_AJP13_SHUTDOWN  = 7;
  - public static final byte JK_AJP13_PING_REQUEST  = 8;
  - public static final byte JK_AJP13_CPING_REQUEST = 10;
  +public static final byte JK_AJP13_SHUTDOWN  = 7;
  +public static final byte JK_AJP13_PING_REQUEST  = 8;
  +public static final byte JK_AJP13_CPING_REQUEST = 10;
   
   // Prefix codes for message types from container to server
   public static final byte JK_AJP13_SEND_BODY_CHUNK   = 3;
   public static final byte JK_AJP13_SEND_HEADERS  = 4;
   public static final byte JK_AJP13_END_RESPONSE  = 5;
  - public static final byte JK_AJP13_GET_BODY_CHUNK= 6;
  - public static final byte JK_AJP13_CPONG_REPLY   = 9;
  +public static final byte JK_AJP13_GET_BODY_CHUNK= 6;
  +public static final byte JK_AJP13_CPONG_REPLY   = 9;
   
   // Integer codes for common response header strings
   public static final int SC_RESP_CONTENT_TYPE= 0xA001;
  @@ -132,7 +135,7 @@
   public static final int SC_RESP_SERVLET_ENGINE  = 0xA009;
   public static final int SC_RESP_STATUS  = 0xA00A;
   public static final int SC_RESP_WWW_AUTHENTICATE= 0xA00B;
  - 
  +
   // Integer codes for common (optional) request attribute names
   public static final byte SC_A_CONTEXT   = 1;  // XXX Unused
   public static final byte SC_A_SERVLET_PATH  = 2;  // XXX Unused
  @@ -219,6 +222,11 @@
   user-agent
   };
   
  +/*
  + * Note for Host parsing.
  + */
  +public static final int HOSTBUFFER = 10;
  +
   HandlerDispatch dispatch;
   String ajpidDir=conf;
   
  @@ -239,9 +247,9 @@
 JK_AJP13_SHUTDOWN,
 this, null); // 7
   
  - dispatch.registerMessageType( JK_AJP13_CPING_REQUEST,
  -   
JK_AJP13_CPING_REQUEST,
  -   
this, null); // 10
  +dispatch.registerMessageType( JK_AJP13_CPING_REQUEST,
  +  
JK_AJP13_CPING_REQUEST,
  +  
this, null); // 10
   
   // register outgoing messages handler
   dispatch.registerMessageType( JK_AJP13_SEND_BODY_CHUNK, // 3
  @@ -272,7 +280,7 @@
   }
   
   public void setDecodedUri( boolean b ) {
  - decoded=b;
  +decoded=b;
   }
   
   public boolean isTomcatAuthentication() {
  @@ -422,21 +430,21 @@
   log.info(Exiting);
   System.exit(0);
   
  - return OK;
  +return OK;
   
  - // We got a 

cvs commit: jakarta-tomcat-connectors/jk/java/org/apache/jk/common HandlerRequest.java

2003-02-07 Thread remm
remm2003/02/07 15:18:44

  Modified:jk/java/org/apache/jk/common HandlerRequest.java
  Log:
  - There is a problem with therad with attributes when Tomcat is used in process
(as the threads used aren't created by Tomcat, it causes class casts).
  
  Revision  ChangesPath
  1.24  +15 -6 
jakarta-tomcat-connectors/jk/java/org/apache/jk/common/HandlerRequest.java
  
  Index: HandlerRequest.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-connectors/jk/java/org/apache/jk/common/HandlerRequest.java,v
  retrieving revision 1.23
  retrieving revision 1.24
  diff -u -r1.23 -r1.24
  --- HandlerRequest.java   28 Jan 2003 05:42:24 -  1.23
  +++ HandlerRequest.java   7 Feb 2003 23:18:44 -   1.24
  @@ -330,7 +330,10 @@
   throws IOException
   {
   int type=msg.getByte();
  -ThreadWithAttributes twa=(ThreadWithAttributes)Thread.currentThread();
  +ThreadWithAttributes twa = null;
  +if (Thread.currentThread() instanceof ThreadWithAttributes) {
  +twa = (ThreadWithAttributes) Thread.currentThread();
  +}
   Object control=ep.getControl();
   
   MessageBytes tmpMB=(MessageBytes)ep.getNote( tmpBufNote );
  @@ -344,11 +347,15 @@
   switch( type ) {
   case JK_AJP13_FORWARD_REQUEST:
   try {
  -twa.setCurrentStage(control, JkDecode);
  +if (twa != null) {
  +twa.setCurrentStage(control, JkDecode);
  +}
   decodeRequest( msg, ep, tmpMB );
  -twa.setCurrentStage(control, JkService);
  -twa.setParam(control,
  -((Request)ep.getRequest()).unparsedURI().toString());
  +if (twa != null) {
  +twa.setCurrentStage(control, JkService);
  +twa.setParam(control,
  + ((Request)ep.getRequest()).unparsedURI());
  +}
   } catch( Exception ex ) {
   log.error( Error decoding request , ex );
   msg.dump( Incomming message);
  @@ -366,7 +373,9 @@
 next.getClass().getName());
   
   int err= next.invoke( msg, ep );
  -twa.setCurrentStage(control, JkDone);
  +if (twa != null) {
  +twa.setCurrentStage(control, JkDone);
  +}
   
   if( log.isDebugEnabled() )
   log.debug( Invoke returned  + err );
  
  
  

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




cvs commit: jakarta-tomcat-connectors/jk/java/org/apache/jk/common HandlerRequest.java ChannelSocket.java

2003-01-16 Thread costin
costin  2003/01/16 14:13:37

  Modified:jk/java/org/apache/jk/common HandlerRequest.java
ChannelSocket.java
  Log:
  Add JMX info.
  
  The thread pool will be registered, as well as RequestProcessor.
  For each request we'll save in the thread pool attributes the stage
  and URI.
  
  If the JkHandlers are not registered - the domain is not set and nothing
  will happen.
  
  Revision  ChangesPath
  1.21  +23 -2 
jakarta-tomcat-connectors/jk/java/org/apache/jk/common/HandlerRequest.java
  
  Index: HandlerRequest.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-connectors/jk/java/org/apache/jk/common/HandlerRequest.java,v
  retrieving revision 1.20
  retrieving revision 1.21
  diff -u -r1.20 -r1.21
  --- HandlerRequest.java   18 Dec 2002 09:26:48 -  1.20
  +++ HandlerRequest.java   16 Jan 2003 22:13:37 -  1.21
  @@ -68,9 +68,11 @@
   import org.apache.tomcat.util.http.*;
   import org.apache.tomcat.util.buf.*;
   import org.apache.tomcat.util.net.SSLSupport;
  +import org.apache.tomcat.util.threads.ThreadWithAttributes;
   
   import org.apache.coyote.Request;
   import org.apache.coyote.*;
  +import org.apache.commons.modeler.Registry;
   
   /**
* Handle messages related with basic request information.
  @@ -328,6 +330,8 @@
   throws IOException
   {
   int type=msg.getByte();
  +ThreadWithAttributes twa=(ThreadWithAttributes)Thread.currentThread();
  +Object control=ep.getControl();
   
   MessageBytes tmpMB=(MessageBytes)ep.getNote( tmpBufNote );
   if( tmpMB==null ) {
  @@ -339,8 +343,12 @@
   
   switch( type ) {
   case JK_AJP13_FORWARD_REQUEST:
  -try { 
  +try {
  +twa.setCurrentStage(control, JkDecode);
   decodeRequest( msg, ep, tmpMB );
  +twa.setCurrentStage(control, JkService);
  +twa.setParam(control,
  +((Request)ep.getRequest()).unparsedURI().toString());
   } catch( Exception ex ) {
   log.error( Error decoding request , ex );
   msg.dump( Incomming message);
  @@ -356,8 +364,10 @@
   if(log.isDebugEnabled() )
   log.debug(Calling next  + next.getName() +   +
 next.getClass().getName());
  -
  +
   int err= next.invoke( msg, ep );
  +twa.setCurrentStage(control, JkDone);
  +
   if( log.isDebugEnabled() )
   log.debug( Invoke returned  + err );
   return err;
  @@ -400,6 +410,8 @@
   return OK;
   }
   
  +static int count=0;
  +
   private int decodeRequest( Msg msg, MsgContext ep, MessageBytes tmpMB )
   throws IOException
   {
  @@ -410,6 +422,15 @@
   Response res=new Response();
   req.setResponse(res);
   ep.setRequest( req );
  +RequestProcessor rp=new RequestProcessor(req);
  +if( this.getDomain() != null ) {
  +try {
  +Registry.getRegistry().registerComponent( rp,
  +getDomain(), RequestProcessor, name=Request + 
count++ );
  +} catch( Exception ex ) {
  +log.warn(Error registering request);
  +}
  +}
   }
   
   JkInputStream jkBody=(JkInputStream)ep.getNote( bodyNote );
  
  
  
  1.31  +24 -6 
jakarta-tomcat-connectors/jk/java/org/apache/jk/common/ChannelSocket.java
  
  Index: ChannelSocket.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-connectors/jk/java/org/apache/jk/common/ChannelSocket.java,v
  retrieving revision 1.30
  retrieving revision 1.31
  diff -u -r1.30 -r1.31
  --- ChannelSocket.java19 Dec 2002 15:36:32 -  1.30
  +++ ChannelSocket.java16 Jan 2003 22:13:37 -  1.31
  @@ -70,6 +70,8 @@
   import org.apache.tomcat.util.threads.*;
   
   import org.apache.jk.core.*;
  +import org.apache.jk.server.JkMain;
  +import org.apache.commons.modeler.Registry;
   
   
   /* XXX Make the 'message type' pluggable
  @@ -95,6 +97,10 @@
* @author Costin Manolache
* @jmx:mbean name=jk2:service=ChannelSocket
*description=Accept socket connections
  + * @jmx:notification name=org.apache.coyote.INVOKE
  + * @jmx:notification-handler name=org.apache.jk.JK_SEND_PACKET
  + * @jmx:notification-handler name=org.apache.jk.JK_RECEIVE_PACKET
  + * @jmx:notification-handler name=org.apache.jk.JK_FLUSH
*/
   public class ChannelSocket extends JkHandler {
   private static org.apache.commons.logging.Log log=
  @@ -118,7 +124,7 @@
   */
   static final boolean BUFFER_WRITE=false;
   
  -ThreadPool tp=new ThreadPool();
  +

cvs commit: jakarta-tomcat-connectors/jk/java/org/apache/jk/common HandlerRequest.java

2002-12-18 Thread billbarker
billbarker2002/12/18 01:26:48

  Modified:jk/java/org/apache/jk/common HandlerRequest.java
  Log:
  Now, with the correct version, after remembering to save the file before doing a 
'ci'.
  
  Revision  ChangesPath
  1.20  +3 -4  
jakarta-tomcat-connectors/jk/java/org/apache/jk/common/HandlerRequest.java
  
  Index: HandlerRequest.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-connectors/jk/java/org/apache/jk/common/HandlerRequest.java,v
  retrieving revision 1.19
  retrieving revision 1.20
  diff -u -r1.19 -r1.20
  --- HandlerRequest.java   18 Dec 2002 09:15:06 -  1.19
  +++ HandlerRequest.java   18 Dec 2002 09:26:48 -  1.20
  @@ -532,11 +532,10 @@
   case SC_A_SSL_CERT :
   req.scheme().setString( https );
   // Transform the string into certificate.
  -tmpMB = new MessageBytes();
  -msg.getBytes(tmpMB);
  -String certString = tmpMB.toString();
  +MessageBytes tmpMB2 = new MessageBytes();
  +msg.getBytes(tmpMB2);
   // SSL certificate extraction is costy, moved to JkCoyoteHandler
  -req.setNote(WorkerEnv.SSL_CERT_NOTE, tmpMB);
  +req.setNote(WorkerEnv.SSL_CERT_NOTE, tmpMB2);
   break;
   
   case SC_A_SSL_CIPHER   :
  
  
  

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




cvs commit: jakarta-tomcat-connectors/jk/java/org/apache/jk/common HandlerRequest.java

2002-10-04 Thread costin

costin  2002/10/04 16:26:25

  Modified:jk/java/org/apache/jk/common HandlerRequest.java
  Log:
  Fix 13263.
  
  Revision  ChangesPath
  1.17  +3 -2  
jakarta-tomcat-connectors/jk/java/org/apache/jk/common/HandlerRequest.java
  
  Index: HandlerRequest.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-connectors/jk/java/org/apache/jk/common/HandlerRequest.java,v
  retrieving revision 1.16
  retrieving revision 1.17
  diff -u -r1.16 -r1.17
  --- HandlerRequest.java   1 Oct 2002 23:14:13 -   1.16
  +++ HandlerRequest.java   4 Oct 2002 23:26:25 -   1.17
  @@ -481,9 +481,10 @@
   /* Special case ( XXX in future API make it separate type !)
*/
   if( attributeCode == SC_A_SSL_KEY_SIZE ) {
  -// int ???... 
  +// Bug 1326: it's an Integer.
req.setAttribute(javax.servlet.request.key_size,
  -  Integer.toString(msg.getInt()));
  + new Integer( msg.getInt()));
  +//Integer.toString(msg.getInt()));
   }
   
   if( attributeCode == SC_A_REQ_ATTRIBUTE ) {
  
  
  

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




cvs commit: jakarta-tomcat-connectors/jk/java/org/apache/jk/common HandlerRequest.java

2002-10-01 Thread nacho

nacho   2002/10/01 16:14:13

  Modified:jk/java/org/apache/jk/common HandlerRequest.java
  Log:
  tomcatAuthentication must default to true ( tomcat ignores auth done in the HTTP 
server ) to match the tc4.0 and tc3.3 behaviour and
  
  Revision  ChangesPath
  1.16  +1 -1  
jakarta-tomcat-connectors/jk/java/org/apache/jk/common/HandlerRequest.java
  
  Index: HandlerRequest.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-connectors/jk/java/org/apache/jk/common/HandlerRequest.java,v
  retrieving revision 1.15
  retrieving revision 1.16
  diff -u -r1.15 -r1.16
  --- HandlerRequest.java   26 Aug 2002 09:54:34 -  1.15
  +++ HandlerRequest.java   1 Oct 2002 23:14:13 -   1.16
  @@ -323,7 +323,7 @@
   int secretNote;
   
   boolean decoded=true;
  -boolean tomcatAuthentication;
  +boolean tomcatAuthentication=true;
   
   public int invoke(Msg msg, MsgContext ep ) 
   throws IOException
  
  
  

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




cvs commit: jakarta-tomcat-connectors/jk/java/org/apache/jk/common HandlerRequest.java

2002-05-10 Thread costin

costin  02/05/10 16:56:49

  Modified:jk/java/org/apache/jk/common HandlerRequest.java
  Log:
  Few more optimizations ( again thanks to OptimizeIt ).
  
  Header processing is updated from the Ajp13 interceptor in 33 for
  less allocation ( 3-4 strings per req ), also few debugs need to check if debug is 
enabled.
  
  Revision  ChangesPath
  1.12  +14 -7 
jakarta-tomcat-connectors/jk/java/org/apache/jk/common/HandlerRequest.java
  
  Index: HandlerRequest.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-connectors/jk/java/org/apache/jk/common/HandlerRequest.java,v
  retrieving revision 1.11
  retrieving revision 1.12
  diff -u -r1.11 -r1.12
  --- HandlerRequest.java   17 Apr 2002 22:38:42 -  1.11
  +++ HandlerRequest.java   10 May 2002 23:56:49 -  1.12
  @@ -329,7 +329,8 @@
   tmpMB=new MessageBytes();
   ep.setNote( tmpBufNote, tmpMB);
   }
  -log.debug( Handling  + type );
  +if( log.isDebugEnabled() )
  +log.debug( Handling  + type );
   
   switch( type ) {
   case JK_AJP13_FORWARD_REQUEST:
  @@ -352,7 +353,8 @@
 next.getClass().getName());
   
   int err= next.invoke( msg, ep );
  -log.debug( Invoke returned  + err );
  +if( log.isDebugEnabled() )
  +log.debug( Invoke returned  + err );
   return err;
   case JK_AJP13_SHUTDOWN:
   String epSecret=null;
  @@ -364,7 +366,8 @@
   
   if( requiredSecret != null 
   requiredSecret.equals( epSecret ) ) {
  -log.debug(Received wrong secret, no shutdown );
  +if( log.isDebugEnabled() )
  +log.debug(Received wrong secret, no shutdown );
   return ERROR;
   }
   
  @@ -591,6 +594,7 @@
   if(0xA000 == isc) {
   msg.getInt(); // To advance the read position
   hName = headerTransArray[hId - 1];
  +vMB=headers.addValue( hName );
   } else {
   // reset hId -- if the header currently being read
   // happens to be 7 or 8 bytes long, the code below
  @@ -600,19 +604,22 @@
   // behaviour.  see bug 5861 for more information.
   hId = -1;
   msg.getBytes( tmpMB );
  -hName=tmpMB.toString();
  +ByteChunk bc=tmpMB.getByteChunk();
  +//hName=tmpMB.toString();
  +//vMB=headers.addValue( hName );
  +vMB=headers.addValue( bc.getBuffer(),
  +  bc.getStart(), bc.getLength() );
   }
   
  -vMB=headers.addValue( hName );
   msg.getBytes(vMB);
   
   if (hId == SC_REQ_CONTENT_LENGTH ||
  -hName.equalsIgnoreCase(Content-Length)) {
  +tmpMB.equalsIgnoreCase(Content-Length)) {
   // just read the content-length header, so set it
   int contentLength = (vMB == null) ? -1 : vMB.getInt();
   req.setContentLength(contentLength);
   } else if (hId == SC_REQ_CONTENT_TYPE ||
  -   hName.equalsIgnoreCase(Content-Type)) {
  +   tmpMB.equalsIgnoreCase(Content-Type)) {
   // just read the content-type header, so set it
   ByteChunk bchunk = vMB.getByteChunk();
   req.contentType().setBytes(bchunk.getBytes(),
  
  
  

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




cvs commit: jakarta-tomcat-connectors/jk/java/org/apache/jk/common HandlerRequest.java

2002-04-08 Thread costin

costin  02/04/08 15:58:40

  Modified:jk/java/org/apache/jk/common HandlerRequest.java
  Log:
  Associate the Request/Response with each other
  
  Revision  ChangesPath
  1.10  +2 -0  
jakarta-tomcat-connectors/jk/java/org/apache/jk/common/HandlerRequest.java
  
  Index: HandlerRequest.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-connectors/jk/java/org/apache/jk/common/HandlerRequest.java,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- HandlerRequest.java   4 Apr 2002 19:00:09 -   1.9
  +++ HandlerRequest.java   8 Apr 2002 22:58:40 -   1.10
  @@ -396,6 +396,8 @@
   Request req=(Request)ep.getRequest();
   if( req==null ) {
   req=new Request();
  +Response res=new Response();
  +req.setResponse(res);
   ep.setRequest( req );
   }
   
  
  
  

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




cvs commit: jakarta-tomcat-connectors/jk/java/org/apache/jk/common HandlerRequest.java

2002-02-07 Thread costin

costin  02/02/07 09:07:35

  Modified:jk/java/org/apache/jk/common HandlerRequest.java
  Log:
  Don't generate ajp13.id if conf/ dir not found or if no secret.
  
  Revision  ChangesPath
  1.5   +9 -1  
jakarta-tomcat-connectors/jk/java/org/apache/jk/common/HandlerRequest.java
  
  Index: HandlerRequest.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-connectors/jk/java/org/apache/jk/common/HandlerRequest.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- HandlerRequest.java   6 Feb 2002 17:48:22 -   1.4
  +++ HandlerRequest.java   7 Feb 2002 17:07:35 -   1.5
  @@ -260,9 +260,17 @@
   int portInt=8009; // tcpCon.getPort();
   InetAddress address=null; // tcpCon.getAddress();
   
  +if( requiredSecret == null )
  +return;
  +
   File f1=new File( wEnv.getJkHome() );
  +File f2=new File( f1, conf );
  +if( ! f2.exists() ) {
  +log( No conf dir for ajp13.id  + f2 );
  +return;
  +}
   
  -File sf=new File( f1, conf/ajp13.id);
  +File sf=new File( f2, ajp13.id);
   
   if( dL  0) d( Using stop file: +sf);
   
  
  
  

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




cvs commit: jakarta-tomcat-connectors/jk/java/org/apache/jk/common HandlerRequest.java

2002-02-06 Thread costin

costin  02/02/06 09:48:22

  Modified:jk/java/org/apache/jk/common HandlerRequest.java
  Log:
  Few big changes here:
  
  - added support for 'secret' - as a normal request attributes. If
  the handler is configured to require a secret, it'll block any request
  without one. If not - older mod_jk's will work. ( I'll commit the change
  on the C code for both mod_jk and mod_jk2 )
  
  - added support for 'ajp13.id' - similar with what ajp12interceptor is
  doing in 3.3. This will save the connection info ( including secret )
  for easy reading by caller. ( not completed )
  
  - add useSecret option - it'll automatically generate a secret, no
  config needed ( and no need to ask the user to change the pass
  regularily - we'll do it on each server restart ). Mod_jk will just
  read the file.
  
  - added support for the shutdown message ( not completed )
  
  The request handler will call 'container' as the next handler,
  unless overriden. It'll also check if a dispathcer is
  present and register the messages it supports ( right now it's
  the only handler, so dispatcher is optional )
  
  Revision  ChangesPath
  1.4   +188 -64   
jakarta-tomcat-connectors/jk/java/org/apache/jk/common/HandlerRequest.java
  
  Index: HandlerRequest.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-connectors/jk/java/org/apache/jk/common/HandlerRequest.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- HandlerRequest.java   26 Jan 2002 14:14:35 -  1.3
  +++ HandlerRequest.java   6 Feb 2002 17:48:22 -   1.4
  @@ -60,8 +60,8 @@
   package org.apache.jk.common;
   
   import java.io.*;
  -import java.net.Socket;
  -import java.util.Enumeration;
  +import java.net.*;
  +import java.util.*;
   import java.security.*;
   import java.security.cert.*;
   
  @@ -91,13 +91,15 @@
* @author Keith Wannamaker [[EMAIL PROTECTED]]
* @author Costin Manolache
*/
  -public class HandlerRequest extends Handler
  +public class HandlerRequest extends JkHandler
   {
   // XXX Will move to a registry system.
   
   // Prefix codes for message types from server to container
   public static final byte JK_AJP13_FORWARD_REQUEST   = 2;
   
  +public static final byte JK_AJP13_SHUTDOWN   = 7;
  +
   // Prefix codes for message types from container to server
   public static final byte JK_AJP13_SEND_BODY_CHUNK   = 3;
   public static final byte JK_AJP13_SEND_HEADERS  = 4;
  @@ -128,6 +130,7 @@
   public static final byte SC_A_SSL_CIPHER= 8;
   public static final byte SC_A_SSL_SESSION   = 9;
   public static final byte SC_A_SSL_KEYSIZE   = 11;
  +public static final byte SC_A_SECRET= 12;
   
   // Used for attributes which are not in the list above
   public static final byte SC_A_REQ_ATTRIBUTE = 10; 
  @@ -200,55 +203,179 @@
   {
   }
   
  +HandlerDispatch dispatch;
  +
   public void init() {
  - // register incoming message handlers
  - we.registerMessageType( JK_AJP13_FORWARD_REQUEST,
  -JK_AJP13_FORWARD_REQUEST,
  -this, null); // 2
  -
  - // register outgoing messages handler
  - we.registerMessageType( JK_AJP13_SEND_BODY_CHUNK, // 3
  -JK_AJP13_SEND_BODY_CHUNK,
  -this,null );
  - we.registerMessageType( JK_AJP13_SEND_HEADERS,  // 4
  -JK_AJP13_SEND_HEADERS,
  -this,null );
  - we.registerMessageType( JK_AJP13_END_RESPONSE, // 5
  -JK_AJP13_END_RESPONSE,
  -this,null );
  - we.registerMessageType( JK_AJP13_GET_BODY_CHUNK, // 6
  -JK_AJP13_GET_BODY_CHUNK,
  -this, null );
  +dispatch=(HandlerDispatch)wEnv.getHandler( dispatch );
  +if( dispatch != null ) {
  +// register incoming message handlers
  +dispatch.registerMessageType( JK_AJP13_FORWARD_REQUEST,
  +  JK_AJP13_FORWARD_REQUEST,
  +  this, null); // 2
  +
  +dispatch.registerMessageType( JK_AJP13_FORWARD_REQUEST,
  +  JK_AJP13_SHUTDOWN,
  +  this, null); // 7
  +
  +// register outgoing messages handler
  +dispatch.registerMessageType( JK_AJP13_SEND_BODY_CHUNK, // 3
  +  JK_AJP13_SEND_BODY_CHUNK,
  +  this,null );
  +}
  +
  +bodyNote=wEnv.getNoteId( WorkerEnv.ENDPOINT_NOTE, jkInputStream );
  +tmpBufNote=wEnv.getNoteId( WorkerEnv.ENDPOINT_NOTE, tmpBuf 

cvs commit: jakarta-tomcat-connectors/jk/java/org/apache/jk/common HandlerRequest.java

2002-01-26 Thread seguin

seguin  02/01/26 06:14:35

  Modified:jk/java/org/apache/jk/common HandlerRequest.java
  Log:
  port fix for bug 5861.
  
  Revision  ChangesPath
  1.3   +9 -1  
jakarta-tomcat-connectors/jk/java/org/apache/jk/common/HandlerRequest.java
  
  Index: HandlerRequest.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-connectors/jk/java/org/apache/jk/common/HandlerRequest.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- HandlerRequest.java   26 Jan 2002 07:25:53 -  1.2
  +++ HandlerRequest.java   26 Jan 2002 14:14:35 -  1.3
  @@ -430,6 +430,13 @@
   msg.getInt(); // To advance the read position
   hName = headerTransArray[hId - 1];
   } else {
  +// reset hId -- if the header currently being read
  +// happens to be 7 or 8 bytes long, the code below
  +// will think it's the content-type header or the
  +// content-length header - SC_REQ_CONTENT_TYPE=7,
  +// SC_REQ_CONTENT_LENGTH=8 - leading to unexpected
  +// behaviour.  see bug 5861 for more information.
  +hId = -1;
   msg.getBytes( tmpMB );
   hName=tmpMB.toString();
   }
  @@ -437,11 +444,12 @@
   vMB=headers.addValue( hName );
   msg.getBytes(vMB);
   
  -// set content length, if this is it...
   if (hId == SC_REQ_CONTENT_LENGTH) {
  +// just read the content-length header, so set it
   int contentLength = (vMB == null) ? -1 : vMB.getInt();
   req.setContentLength(contentLength);
   } else if (hId == SC_REQ_CONTENT_TYPE) {
  +// just read the content-type header, so set it
   ByteChunk bchunk = vMB.getByteChunk();
   req.contentType().setBytes(bchunk.getBytes(),
  bchunk.getOffset(),
  
  
  

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




cvs commit: jakarta-tomcat-connectors/jk/java/org/apache/jk/common HandlerRequest.java MsgAjp.java WorkerDummy.java

2002-01-25 Thread costin

costin  02/01/25 23:25:53

  Modified:jk/java/org/apache/jk/common HandlerRequest.java MsgAjp.java
WorkerDummy.java
  Log:
  Updates ( similar with what changed on the C side ), fixes.
  
  Revision  ChangesPath
  1.2   +11 -14
jakarta-tomcat-connectors/jk/java/org/apache/jk/common/HandlerRequest.java
  
  Index: HandlerRequest.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-connectors/jk/java/org/apache/jk/common/HandlerRequest.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- HandlerRequest.java   31 Dec 2001 19:02:01 -  1.1
  +++ HandlerRequest.java   26 Jan 2002 07:25:53 -  1.2
  @@ -75,8 +75,10 @@
* Handle messages related with basic request information.
*
* This object can handle the following incoming messages:
  - * - FORWARD_REQUEST input message ( sent when a request is passed from the web 
server )
  - * - RECEIVE_BODY_CHUNK input ( sent by container to pass more body, in response 
to GET_BODY_CHUNK )
  + * - FORWARD_REQUEST input message ( sent when a request is passed from the
  + *   web server )
  + * - RECEIVE_BODY_CHUNK input ( sent by container to pass more body, in
  + *   response to GET_BODY_CHUNK )
*
* It can handle the following outgoing messages:
* - SEND_HEADERS. Pass the status code and headers.
  @@ -198,7 +200,7 @@
   {
   }
   
  -public void init( WorkerEnv we ) {
  +public void init() {
// register incoming message handlers
we.registerMessageType( JK_AJP13_FORWARD_REQUEST,
   JK_AJP13_FORWARD_REQUEST,
  @@ -224,12 +226,6 @@
   int postMsgNote=5;
   int tmpBufNote=6;
   
  -Worker w;
  -
  -public void setWorker( Worker w ) {
  -this.w=w;
  -}
  -
   public int callback(int type, Channel ch, Endpoint ep, Msg msg)
   throws IOException
   {
  @@ -244,7 +240,7 @@
   decodeRequest( msg, req, ch, ep );
   
   /* XXX it should be computed from request, by workerEnv */
  -w.service( req, ch, ep );
  +worker.service( req, ch, ep );
   return OK;
   }
   
  @@ -256,6 +252,7 @@
   // Translate the HTTP method code to a String.
   byte methodCode = msg.getByte();
   String mName=methodTransArray[(int)methodCode - 1];
  +
   req.method().setString(mName);
   
   msg.getBytes(req.protocol()); 
  @@ -290,12 +287,12 @@
   }
   
/* Read present data */
  - int err = postMsg.receive(ch, ep);
  + int err = ch.receive(postMsg, ep);
}
   
   if (dL  5) {
   d(req.toString());
  -}
  + }
   
   return OK;
   }
  @@ -385,7 +382,7 @@
jsseCerts);
   break;

  - case SC_A_SSL_CIPHER   :
  + case SC_A_SSL_CIPHER   :
req.setSecure( true );
   msg.getBytes(tmpMB);
req.setAttribute(javax.servlet.request.cipher_suite,
  @@ -453,7 +450,7 @@
   }
   }
   
  -private static final int dL=10;
  +private static final int dL=0;
   private static void d(String s ) {
   System.err.println( HandlerRequest:  + s );
   }
  
  
  
  1.4   +21 -63
jakarta-tomcat-connectors/jk/java/org/apache/jk/common/MsgAjp.java
  
  Index: MsgAjp.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-connectors/jk/java/org/apache/jk/common/MsgAjp.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- MsgAjp.java   12 Jan 2002 04:03:42 -  1.3
  +++ MsgAjp.java   26 Jan 2002 07:25:53 -  1.4
  @@ -90,16 +90,16 @@
*/
   public class MsgAjp extends Msg {
   
  -byte buf[]=new byte[8300];
  +private byte buf[]=new byte[8300];
   // The current read or write position in the buffer
  -int pos;
  +private int pos;
   /**
* This actually means different things depending on whether the
* packet is read or write.  For read, it's the length of the
* payload (excluding the header).  For write, it's the length of
* the packet as a whole (counting the header).  Oh, well.
*/
  -int len; 
  +private int len; 
   
   
   
  @@ -128,7 +128,15 @@
   buf[2]=  (byte)((dLen8 )  0xFF );
   buf[3] = (byte)(dLen  0xFF);
   }
  - 
  +
  +public byte[] getBuffer() {
  +return buf;
  +}
  +
  +public int getLen() {
  +return len;
  +}
  +
   //  Data Writing Methods ===
   
   /**
  @@ -200,7 +208,8 @@
*/
   public void appendBytes( byte b[], int off, int numBytes ) {
   if( pos +