cvs commit: jakarta-tomcat-connectors/http11/src/java/org/apache/coyote/http11 Http11Processor.java Http11Protocol.java

2005-03-14 Thread remm
remm2005/03/14 07:33:11

  Modified:util/java/org/apache/tomcat/util/net PoolTcpEndpoint.java
   http11/src/java/org/apache/coyote/http11
Http11Processor.java Http11Protocol.java
  Log:
  - The new thread pool currently uses the endpoint to store its stuff.
  - Allocate a worker before accepting. If the pool is full, wait 100ms. This 
should allow taking advantage of the acceptCount.
  - Fix setting a reduced socket timeout.
  
  Revision  ChangesPath
  1.44  +14 -8 
jakarta-tomcat-connectors/util/java/org/apache/tomcat/util/net/PoolTcpEndpoint.java
  
  Index: PoolTcpEndpoint.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-connectors/util/java/org/apache/tomcat/util/net/PoolTcpEndpoint.java,v
  retrieving revision 1.43
  retrieving revision 1.44
  diff -u -r1.43 -r1.44
  --- PoolTcpEndpoint.java  29 Jan 2005 19:30:44 -  1.43
  +++ PoolTcpEndpoint.java  14 Mar 2005 15:33:10 -  1.44
  @@ -626,21 +626,27 @@
   // Ignore
   }
   }
  -
  -// Accept the next incoming connection from the server socket
  -Socket socket = acceptSocket();
   
  -// Hand this socket off to an appropriate processor
  +// Allocate a new worker thread
   MasterSlaveWorkerThread workerThread = createWorkerThread();
   if (workerThread == null) {
   try {
  -log.warn(sm.getString(endpoint.noProcessor));
  -socket.close();
  -} catch (IOException e) {
  -;
  +// Wait a little for load to go down: as a result, 
  +// no accept will be made until the concurrency is
  +// lower than the specified maxThreads, and current
  +// connections will wait for a little bit instead of
  +// failing right away.
  +Thread.sleep(100);
  +} catch (InterruptedException e) {
  +// Ignore
   }
   continue;
   }
  +
  +// Accept the next incoming connection from the server socket
  +Socket socket = acceptSocket();
  +
  +// Hand this socket off to an appropriate processor
   workerThread.assign(socket);
   
   // The processor will recycle itself when it finishes
  
  
  
  1.119 +36 -5 
jakarta-tomcat-connectors/http11/src/java/org/apache/coyote/http11/Http11Processor.java
  
  Index: Http11Processor.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-connectors/http11/src/java/org/apache/coyote/http11/Http11Processor.java,v
  retrieving revision 1.118
  retrieving revision 1.119
  diff -u -r1.118 -r1.119
  --- Http11Processor.java  27 Feb 2005 18:18:02 -  1.118
  +++ Http11Processor.java  14 Mar 2005 15:33:10 -  1.119
  @@ -49,6 +49,7 @@
   import org.apache.tomcat.util.buf.MessageBytes;
   import org.apache.tomcat.util.http.FastHttpDateFormat;
   import org.apache.tomcat.util.http.MimeHeaders;
  +import org.apache.tomcat.util.net.PoolTcpEndpoint;
   import org.apache.tomcat.util.net.SSLSupport;
   import org.apache.tomcat.util.threads.ThreadPool;
   import org.apache.tomcat.util.threads.ThreadWithAttributes;
  @@ -298,6 +299,12 @@
   
   
   /**
  + * Associated endpoint.
  + */
  +protected PoolTcpEndpoint endpoint;
  +
  +
  +/**
* Allow a customized the server header for the tin-foil hat folks.
*/
   protected String server = null;
  @@ -356,6 +363,12 @@
   this.threadPool = threadPool;
   }
   
  +
  +public void setEndpoint(PoolTcpEndpoint endpoint) {
  +this.endpoint = endpoint;
  +}
  +
  +
   /**
* Add user-agent for which gzip compression didn't works
* The user agent String given will be exactly matched
  @@ -764,15 +777,33 @@
   
   int keepAliveLeft = maxKeepAliveRequests;
   int soTimeout = socket.getSoTimeout();
  +int oldSoTimeout = soTimeout;
   
  -float threadRatio =
  -(float) threadPool.getCurrentThreadsBusy()
  -/ (float) threadPool.getMaxThreads();
  -if ((threadRatio  0.33)  (threadRatio = 0.66)) {
  +int threadRatio = 0;
  +if (threadPool.getCurrentThreadsBusy()  0) {
  +threadRatio = (threadPool.getCurrentThreadsBusy() * 100)
  +/ threadPool.getMaxThreads();
  +} else {
  +threadRatio = (endpoint.getCurrentThreadsBusy() * 100)
  +/ endpoint.getMaxThreads();
  +}
  +if ((threadRatio  33)  (threadRatio = 66)) {
   soTimeout = soTimeout / 2;
  -   

cvs commit: jakarta-tomcat-connectors/http11/src/java/org/apache/coyote/http11 Http11Processor.java Http11Protocol.java

2004-09-14 Thread funkman
funkman 2004/09/14 17:16:05

  Modified:http11/src/java/org/apache/coyote/http11
Http11Processor.java Http11Protocol.java
  Log:
  Allow for customized server header at config time.
  So now one can do this:
  
  Connector port=8080 server=TinFoil Hats R US (1.00)  /
  
  Revision  ChangesPath
  1.110 +116 -90   
jakarta-tomcat-connectors/http11/src/java/org/apache/coyote/http11/Http11Processor.java
  
  Index: Http11Processor.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-connectors/http11/src/java/org/apache/coyote/http11/Http11Processor.java,v
  retrieving revision 1.109
  retrieving revision 1.110
  diff -u -r1.109 -r1.110
  --- Http11Processor.java  13 Sep 2004 21:39:39 -  1.109
  +++ Http11Processor.java  15 Sep 2004 00:16:05 -  1.110
  @@ -56,7 +56,7 @@
   
   /**
* Processes HTTP requests.
  - * 
  + *
* @author Remy Maucherat
*/
   public class Http11Processor implements Processor, ActionHook {
  @@ -65,7 +65,7 @@
   /**
* Logger.
*/
  -protected static org.apache.commons.logging.Log log 
  +protected static org.apache.commons.logging.Log log
   = org.apache.commons.logging.LogFactory.getLog(Http11Processor.class);
   
   
  @@ -210,31 +210,31 @@
* Remote Host associated with the current connection.
*/
   protected String remoteHost = null;
  -
  -
  +
  +
   /**
* Local Host associated with the current connection.
*/
   protected String localName = null;
  -
  -
  -
  +
  +
  +
   /**
* Local port to which the socket is connected
*/
   protected int localPort = -1;
  -
  -
  +
  +
   /**
* Remote port to which the socket is connected
*/
   protected int remotePort = -1;
  -
  -
  +
  +
   /**
* The local Host address.
*/
  -protected String localAddr = null; 
  +protected String localAddr = null;
   
   
   /**
  @@ -277,11 +277,11 @@
* List of user agents to not use gzip with
*/
   protected Pattern noCompressionUserAgents[] = null;
  -
  +
   /**
* List of MIMES which could be gzipped
*/
  -protected String[] compressableMimeTypes = 
  +protected String[] compressableMimeTypes =
   { text/html, text/xml, text/plain };
   
   
  @@ -297,6 +297,12 @@
   protected ThreadPool threadPool;
   
   
  +/**
  + * Allow a customized the server header for the tin-foil hat folks.
  + */
  +protected String server = Constants.SERVER;
  +
  +
   // - Properties
   
   
  @@ -344,7 +350,7 @@
   public void setCompressionMinSize(int compressionMinSize) {
   this.compressionMinSize = compressionMinSize;
   }
  -
  +
   
   public void setThreadPool(ThreadPool threadPool) {
   this.threadPool = threadPool;
  @@ -354,13 +360,13 @@
* Add user-agent for which gzip compression didn't works
* The user agent String given will be exactly matched
* to the user-agent header submitted by the client.
  - * 
  + *
* @param userAgent user-agent string
*/
   public void addNoCompressionUserAgent(String userAgent) {
   try {
   Pattern nRule = Pattern.compile(userAgent);
  -noCompressionUserAgents = 
  +noCompressionUserAgents =
   addREArray(noCompressionUserAgents, nRule);
   } catch (PatternSyntaxException pse) {
   log.error(Error parsing regular expression:  + userAgent, pse);
  @@ -369,8 +375,8 @@
   
   
   /**
  - * Set no compression user agent list (this method is best when used with 
  - * a large number of connectors, where it would be better to have all of 
  + * Set no compression user agent list (this method is best when used with
  + * a large number of connectors, where it would be better to have all of
* them referenced a single array).
*/
   public void setNoCompressionUserAgents(Pattern[] noCompressionUserAgents) {
  @@ -381,13 +387,13 @@
   /**
* Set no compression user agent list.
* List contains users agents separated by ',' :
  - * 
  + *
* ie: gorilla,desesplorer,tigrus
*/
   public void setNoCompressionUserAgents(String noCompressionUserAgents) {
   if (noCompressionUserAgents != null) {
   StringTokenizer st = new StringTokenizer(noCompressionUserAgents, ,);
  -
  +
   while (st.hasMoreTokens()) {
   addNoCompressionUserAgent(st.nextToken().trim());
   }
  @@ -398,18 +404,18 @@
* Add a mime-type which will be compressable
* The mime-type String will be exactly matched
* in the response 

cvs commit: jakarta-tomcat-connectors/http11/src/java/org/apache/coyote/http11 Http11Processor.java Http11Protocol.java

2004-01-22 Thread remm
remm2004/01/22 10:26:53

  Modified:http11/src/java/org/apache/coyote/http11
Http11Processor.java Http11Protocol.java
  Log:
  - Allow configuring the header size (for most use cases, it was too big, and since
it represents 75% of the memory allocated by Tomcat).
  - New default size: 4 KB (the whole HTTP header must fit inside that, for both
the request and the response).
  - Allocations of these buffers can't be dynamic: there are too many references
lying around, and this guarantees leaks. The only safe way to reallocate the
buffers if to get rid of the processor.
  - Note: In Tomcat 4.1.30, I'll integrate the same connectors as in 5.0.18, to
avoid possible problems.
  
  Revision  ChangesPath
  1.95  +7 -2  
jakarta-tomcat-connectors/http11/src/java/org/apache/coyote/http11/Http11Processor.java
  
  Index: Http11Processor.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-connectors/http11/src/java/org/apache/coyote/http11/Http11Processor.java,v
  retrieving revision 1.94
  retrieving revision 1.95
  diff -u -r1.94 -r1.95
  --- Http11Processor.java  14 Jan 2004 11:12:50 -  1.94
  +++ Http11Processor.java  22 Jan 2004 18:26:52 -  1.95
  @@ -119,14 +119,19 @@
* Default constructor.
*/
   public Http11Processor() {
  +this(Constants.DEFAULT_HTTP_HEADER_BUFFER_SIZE);
  +}
  +
  +
  +public Http11Processor(int headerBufferSize) {
   
   request = new Request();
  -inputBuffer = new InternalInputBuffer(request);
  +inputBuffer = new InternalInputBuffer(request, headerBufferSize);
   request.setInputBuffer(inputBuffer);
   
   response = new Response();
   response.setHook(this);
  -outputBuffer = new InternalOutputBuffer(response);
  +outputBuffer = new InternalOutputBuffer(response, headerBufferSize);
   response.setOutputBuffer(outputBuffer);
   request.setResponse(response);
   
  
  
  
  1.47  +12 -1 
jakarta-tomcat-connectors/http11/src/java/org/apache/coyote/http11/Http11Protocol.java
  
  Index: Http11Protocol.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-connectors/http11/src/java/org/apache/coyote/http11/Http11Protocol.java,v
  retrieving revision 1.46
  retrieving revision 1.47
  diff -u -r1.46 -r1.47
  --- Http11Protocol.java   15 Jan 2004 13:16:41 -  1.46
  +++ Http11Protocol.java   22 Jan 2004 18:26:52 -  1.47
  @@ -246,6 +246,7 @@
   private int maxKeepAliveRequests=100; // as in Apache HTTPD server
   private int timeout = 30;   // 5 minutes as in Apache HTTPD server
   private int maxPostSize = 2 * 1024 * 1024;
  +private int maxHttpHeaderSize = 4 * 1024;
   private String reportedname;
   private int socketCloseDelay=-1;
   private boolean disableUploadTimeout = true;
  @@ -397,6 +398,15 @@
   setAttribute(maxPostSize,  + valueI);
   }
   
  +public int getMaxHttpHeaderSize() {
  +return maxHttpHeaderSize;
  +}
  +
  +public void setMaxHttpHeaderSize(int valueI) {
  +maxHttpHeaderSize = valueI;
  +setAttribute(maxHttpHeaderSize,  + valueI);
  +}
  +
   public String getRestrictedUserAgents() {
   return restrictedUserAgents;
   }
  @@ -639,7 +649,8 @@
   public Object[] init() {
   Object thData[]=new Object[3];
   
  -Http11Processor  processor = new Http11Processor();
  +Http11Processor  processor = 
  +new Http11Processor(proto.maxHttpHeaderSize);
   processor.setAdapter( proto.adapter );
   processor.setThreadPool( proto.tp );
   processor.setMaxKeepAliveRequests( proto.maxKeepAliveRequests );
  
  
  

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



cvs commit: jakarta-tomcat-connectors/http11/src/java/org/apache/coyote/http11 Http11Processor.java Http11Protocol.java

2003-06-06 Thread luehe
luehe   2003/06/05 09:42:48

  Modified:coyote/src/java/org/apache/coyote Request.java
   http11/src/java/org/apache/coyote/http11
Http11Processor.java Http11Protocol.java
  Log:
  Removed setSocket() method from org.apache.catalina.Request, since it
  was never called in any of the classes implementing this interface.
  
  For example, setSocket() was never called on
  org.apache.coyote.tomcat5.CoyoteRequest, causing its getSocket()
  method to always return null, which broke the CertificatesValve, which
  relies on having access to the (SSL)Socket so that it can reinitiate a
  handshake if necessary.
  
  Instead, added setSocket() and getSocket() methods on org.apache.coyote.Request:
  
  - setSocket() is called as part of
org.apache.coyote.http11.Http11Processor.setSocket(), as follows:
  
  public void setSocket(Socket socket)
  throws IOException {
  this.socket = socket;
  this.request.setSocket(socket); // NEW
  }
  
  - getSocket() is called as part of
org.apache.coyote.tomcat5.CoyoteRequest.getSocket(), as follows:
  
  diff -u -r1.5 CoyoteRequest.java
  --- CoyoteRequest.java  31 May 2003 15:00:25 -  1.5
  +++ CoyoteRequest.java  5 Jun 2003 16:41:17 -
  @@ -633,20 +633,7 @@
* an SSLSocket.
*/
   public Socket getSocket() {
  -return (socket);
  -}
  -
  -/**
  - * Set the Socket (if any) through which this Request was received.
  - *
  - * @param socket The socket through which this request was received
  - */
  -public void setSocket(Socket socket) {
  -this.socket = socket;
  -remoteHost = null;
  -remoteAddr = null;
  -remotePort = -1;
  -localAddr = null;
  +return coyoteRequest.getSocket();
   }
  
  Revision  ChangesPath
  1.21  +20 -0 
jakarta-tomcat-connectors/coyote/src/java/org/apache/coyote/Request.java
  
  Index: Request.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-connectors/coyote/src/java/org/apache/coyote/Request.java,v
  retrieving revision 1.20
  retrieving revision 1.21
  diff -u -r1.20 -r1.21
  --- Request.java  23 Mar 2003 08:57:48 -  1.20
  +++ Request.java  5 Jun 2003 16:42:48 -   1.21
  @@ -62,6 +62,7 @@
   
   import java.io.IOException;
   import java.util.Hashtable;
  +import java.net.Socket;
   
   import org.apache.tomcat.util.buf.ByteChunk;
   import org.apache.tomcat.util.buf.MessageBytes;
  @@ -137,6 +138,8 @@
   
   private int remotePort;
   
  +private Socket socket;
  +
   private MessageBytes schemeMB = new MessageBytes();
   
   private MessageBytes methodMB = new MessageBytes();
  @@ -304,6 +307,23 @@
   this.remotePort = port;
   }
   
  +/**
  + * Sets the socket through which this request was received.
  + *
  + * @param socket The socket through which this request was received
  + */
  +public void setSocket(Socket socket) {
  + this.socket = socket;
  +}
  +
  +/**
  + * Gets the socket through which this request was received.
  + *
  + * @return The socket through which this request was received
  + */
  +public Socket getSocket() {
  + return socket;
  +}
   
   //  encoding/type 
   
  
  
  
  1.66  +1 -0  
jakarta-tomcat-connectors/http11/src/java/org/apache/coyote/http11/Http11Processor.java
  
  Index: Http11Processor.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-connectors/http11/src/java/org/apache/coyote/http11/Http11Processor.java,v
  retrieving revision 1.65
  retrieving revision 1.66
  diff -u -r1.65 -r1.66
  --- Http11Processor.java  13 May 2003 22:45:58 -  1.65
  +++ Http11Processor.java  5 Jun 2003 16:42:48 -   1.66
  @@ -517,6 +517,7 @@
   public void setSocket(Socket socket)
   throws IOException {
   this.socket = socket;
  + this.request.setSocket(socket);
   }
   
   /**
  
  
  
  1.27  +6 -5  
jakarta-tomcat-connectors/http11/src/java/org/apache/coyote/http11/Http11Protocol.java
  
  Index: Http11Protocol.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-connectors/http11/src/java/org/apache/coyote/http11/Http11Protocol.java,v
  retrieving revision 1.26
  retrieving revision 1.27
  diff -u -r1.26 -r1.27
  --- Http11Protocol.java   22 May 2003 04:51:03 -  1.26
  +++ Http11Protocol.java   5 Jun 2003 16:42:48 -   1.27
  @@ -86,8 +86,8 @@
*/
   public class Http11Protocol implements ProtocolHandler, MBeanRegistration
   {
  -
   public Http11Protocol() {
  + cHandler = new Http11ConnectionHandler( this );
   

Re: cvs commit: jakarta-tomcat-connectors/http11/src/java/org/apache/coyote/http11 Http11Processor.java Http11Protocol.java

2003-06-06 Thread Bill Barker
I'm very strongly -1 on this.  The o.a.coyote.Request should not have a
set/getSocket method for the simple reason that there is no reason that
Coyote should be assumed to be tied to a socket transport.

CertificatesValve doesn't do anything any more with Coyote.  It is only left
around to support the deprecated Http11Connector.

- Original Message -
From: [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Thursday, June 05, 2003 9:42 AM
Subject: cvs commit:
jakarta-tomcat-connectors/http11/src/java/org/apache/coyote/http11
Http11Processor.java Http11Protocol.java


 luehe   2003/06/05 09:42:48

   Modified:coyote/src/java/org/apache/coyote Request.java
http11/src/java/org/apache/coyote/http11
 Http11Processor.java Http11Protocol.java
   Log:
   Removed setSocket() method from org.apache.catalina.Request, since it
   was never called in any of the classes implementing this interface.

   For example, setSocket() was never called on
   org.apache.coyote.tomcat5.CoyoteRequest, causing its getSocket()
   method to always return null, which broke the CertificatesValve, which
   relies on having access to the (SSL)Socket so that it can reinitiate a
   handshake if necessary.

   Instead, added setSocket() and getSocket() methods on
org.apache.coyote.Request:

   - setSocket() is called as part of
 org.apache.coyote.http11.Http11Processor.setSocket(), as follows:

   public void setSocket(Socket socket)
   throws IOException {
   this.socket = socket;
   this.request.setSocket(socket); // NEW
   }

   - getSocket() is called as part of
 org.apache.coyote.tomcat5.CoyoteRequest.getSocket(), as follows:

   diff -u -r1.5 CoyoteRequest.java
   --- CoyoteRequest.java  31 May 2003 15:00:25 -  1.5
   +++ CoyoteRequest.java  5 Jun 2003 16:41:17 -
   @@ -633,20 +633,7 @@
 * an SSLSocket.
 */
public Socket getSocket() {
   -return (socket);
   -}
   -
   -/**
   - * Set the Socket (if any) through which this Request was received.
   - *
   - * @param socket The socket through which this request was received
   - */
   -public void setSocket(Socket socket) {
   -this.socket = socket;
   -remoteHost = null;
   -remoteAddr = null;
   -remotePort = -1;
   -localAddr = null;
   +return coyoteRequest.getSocket();
}

   Revision  ChangesPath
   1.21  +20 -0
jakarta-tomcat-connectors/coyote/src/java/org/apache/coyote/Request.java

   Index: Request.java
   ===
   RCS file:
/home/cvs/jakarta-tomcat-connectors/coyote/src/java/org/apache/coyote/Reques
t.java,v
   retrieving revision 1.20
   retrieving revision 1.21
   diff -u -r1.20 -r1.21
   --- Request.java 23 Mar 2003 08:57:48 - 1.20
   +++ Request.java 5 Jun 2003 16:42:48 - 1.21
   @@ -62,6 +62,7 @@

import java.io.IOException;
import java.util.Hashtable;
   +import java.net.Socket;

import org.apache.tomcat.util.buf.ByteChunk;
import org.apache.tomcat.util.buf.MessageBytes;
   @@ -137,6 +138,8 @@

private int remotePort;

   +private Socket socket;
   +
private MessageBytes schemeMB = new MessageBytes();

private MessageBytes methodMB = new MessageBytes();
   @@ -304,6 +307,23 @@
this.remotePort = port;
}

   +/**
   + * Sets the socket through which this request was received.
   + *
   + * @param socket The socket through which this request was received
   + */
   +public void setSocket(Socket socket) {
   + this.socket = socket;
   +}
   +
   +/**
   + * Gets the socket through which this request was received.
   + *
   + * @return The socket through which this request was received
   + */
   +public Socket getSocket() {
   + return socket;
   +}

//  encoding/type 




   1.66  +1 -0
jakarta-tomcat-connectors/http11/src/java/org/apache/coyote/http11/Http11Pro
cessor.java

   Index: Http11Processor.java
   ===
   RCS file:
/home/cvs/jakarta-tomcat-connectors/http11/src/java/org/apache/coyote/http11
/Http11Processor.java,v
   retrieving revision 1.65
   retrieving revision 1.66
   diff -u -r1.65 -r1.66
   --- Http11Processor.java 13 May 2003 22:45:58 - 1.65
   +++ Http11Processor.java 5 Jun 2003 16:42:48 - 1.66
   @@ -517,6 +517,7 @@
public void setSocket(Socket socket)
throws IOException {
this.socket = socket;
   + this.request.setSocket(socket);
}

/**



   1.27  +6 -5
jakarta-tomcat-connectors/http11/src/java/org/apache/coyote/http11/Http11Pro
tocol.java

   Index: Http11Protocol.java
   ===
   RCS file:
/home/cvs/jakarta

Re: cvs commit: jakarta-tomcat-connectors/http11/src/java/org/apache/coyote/http11 Http11Processor.java Http11Protocol.java

2003-06-06 Thread Bill Barker

- Original Message -
From: Remy Maucherat [EMAIL PROTECTED]
To: Tomcat Developers List [EMAIL PROTECTED]
Sent: Thursday, June 05, 2003 10:54 AM
Subject: Re: cvs commit:
jakarta-tomcat-connectors/http11/src/java/org/apache/coyote/http11
Http11Processor.java Http11Protocol.java


 Bill Barker wrote:
  I'm very strongly -1 on this.  The o.a.coyote.Request should not have a
  set/getSocket method for the simple reason that there is no reason that
  Coyote should be assumed to be tied to a socket transport.

 I plan to test the memory only protocol handler someday. The Netbeans
 folks should be happy about that (and the auto reload everything, of
 course).

  CertificatesValve doesn't do anything any more with Coyote.  It is only
left
  around to support the deprecated Http11Connector.

 Well, the connector won't work with TC 5 anyway, so ...

I'm +1 for removing CertificatesValve from TC 5.  Especially since it is
tied to JSSE 1.0.x, so it will almost certainly break Tomcat running on a
non-Sun 1.4 JVM.


 Remy


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



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



cvs commit: jakarta-tomcat-connectors/http11/src/java/org/apache/coyote/http11 Http11Processor.java Http11Protocol.java

2003-01-20 Thread costin
costin  2003/01/20 15:47:05

  Modified:http11/src/java/org/apache/coyote/http11
Http11Processor.java Http11Protocol.java
  Log:
  Update for RequestInfo and new group info.
  
  Revision  ChangesPath
  1.57  +1 -0  
jakarta-tomcat-connectors/http11/src/java/org/apache/coyote/http11/Http11Processor.java
  
  Index: Http11Processor.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-connectors/http11/src/java/org/apache/coyote/http11/Http11Processor.java,v
  retrieving revision 1.56
  retrieving revision 1.57
  diff -u -r1.56 -r1.57
  --- Http11Processor.java  16 Jan 2003 22:29:51 -  1.56
  +++ Http11Processor.java  20 Jan 2003 23:47:05 -  1.57
  @@ -577,6 +577,7 @@
   
   while (started  !error  keepAlive) {
   try {
  +request.setStartTime(System.currentTimeMillis());
   if( !disableUploadTimeout  keptAlive  soTimeout  0 ) {
   socket.setSoTimeout(soTimeout);
   }
  
  
  
  1.20  +9 -1  
jakarta-tomcat-connectors/http11/src/java/org/apache/coyote/http11/Http11Protocol.java
  
  Index: Http11Protocol.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-connectors/http11/src/java/org/apache/coyote/http11/Http11Protocol.java,v
  retrieving revision 1.19
  retrieving revision 1.20
  diff -u -r1.19 -r1.20
  --- Http11Protocol.java   16 Jan 2003 22:29:51 -  1.19
  +++ Http11Protocol.java   20 Jan 2003 23:47:05 -  1.20
  @@ -349,6 +349,7 @@
   static class Http11ConnectionHandler implements TcpConnectionHandler {
   Http11Protocol proto;
   static int count=0;
  +RequestGroupInfo global=null;
   
   Http11ConnectionHandler( Http11Protocol proto ) {
   this.proto=proto;
  @@ -381,7 +382,14 @@
   
   if( proto.getDomain() != null ) {
   try {
  -RequestProcessor rp=new 
RequestProcessor(processor.getRequest());
  +if( global==null ) {
  +global=new RequestGroupInfo();
  +Registry.getRegistry().registerComponent( global,
  +proto.getDomain(), GlobalRequestProcessor,
  +type=GlobalRequestProcessor,name=http);
  +}
  +RequestInfo rp=processor.getRequest().getRequestProcessor();
  +rp.setGlobalProcessor(global);
   Registry.getRegistry().registerComponent( rp,
   proto.getDomain(), RequestProcessor,
   type=RequestProcessor,name=HttpRequest + count++ );
  
  
  

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




cvs commit: jakarta-tomcat-connectors/http11/src/java/org/apache/coyote/http11 Http11Processor.java Http11Protocol.java

2003-01-16 Thread costin
costin  2003/01/16 14:29:52

  Modified:http11   build.xml
   http11/src/java/org/apache/coyote/http11
Http11Processor.java Http11Protocol.java
  Log:
  Same thing as in jk - threads and request processors are registered in
  JMX  (if coyote itself is registered and it registers the protocol adapter )
  
  Revision  ChangesPath
  1.10  +5 -1  jakarta-tomcat-connectors/http11/build.xml
  
  Index: build.xml
  ===
  RCS file: /home/cvs/jakarta-tomcat-connectors/http11/build.xml,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- build.xml 13 Nov 2002 00:14:25 -  1.9
  +++ build.xml 16 Jan 2003 22:29:51 -  1.10
  @@ -31,6 +31,8 @@
 property name=tomcat33-coyote.jar 
 value=../coyote/build/lib/tomcat33-coyote.jar/
 property name=junit.jarvalue=${junit.home}/junit.jar/
  +  property name=jmx.jar location=../lib/mx4j.jar /
  +  property name=commons-modeler.jar 
location=../../jakarta-commons/modeler/dist/commons-modeler.jar /
 property name=commons-logging.jar value=../lib/commons-logging.jar /
   
   !-- == Component Declarations  --
  @@ -75,6 +77,8 @@
   pathelement location=${tomcat-util.jar}/
   pathelement location=${tomcat-coyote.jar}/
   pathelement location=${commons-logging.jar}/
  +pathelement location=${commons-modeler.jar}/
  +pathelement location=${jmx.jar}/
 /path
   
   
  
  
  
  1.56  +28 -8 
jakarta-tomcat-connectors/http11/src/java/org/apache/coyote/http11/Http11Processor.java
  
  Index: Http11Processor.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-connectors/http11/src/java/org/apache/coyote/http11/Http11Processor.java,v
  retrieving revision 1.55
  retrieving revision 1.56
  diff -u -r1.55 -r1.56
  --- Http11Processor.java  4 Jan 2003 10:34:19 -   1.55
  +++ Http11Processor.java  16 Jan 2003 22:29:51 -  1.56
  @@ -59,7 +59,6 @@
   
   package org.apache.coyote.http11;
   
  -import java.io.EOFException;
   import java.io.InterruptedIOException;
   import java.io.InputStream;
   import java.io.IOException;
  @@ -74,12 +73,12 @@
   import org.apache.tomcat.util.buf.Ascii;
   import org.apache.tomcat.util.buf.HexUtils;
   import org.apache.tomcat.util.net.SSLSupport;
  +import org.apache.tomcat.util.threads.ThreadPool;
  +import org.apache.tomcat.util.threads.ThreadWithAttributes;
   
   import org.apache.coyote.ActionHook;
   import org.apache.coyote.ActionCode;
   import org.apache.coyote.Adapter;
  -import org.apache.coyote.InputBuffer;
  -import org.apache.coyote.OutputBuffer;
   import org.apache.coyote.Processor;
   import org.apache.coyote.Request;
   import org.apache.coyote.Response;
  @@ -279,6 +278,7 @@
*/
   protected char[] hostNameC = new char[0];
   
  +protected ThreadPool threadPool;
   
   // - Properties
   
  @@ -321,6 +321,9 @@
   }
   }
   
  +public void setThreadPool(ThreadPool threadPool) {
  +this.threadPool = threadPool;
  +}
   
   /**
* Add user-agent for which gzip compression didn't works
  @@ -532,17 +535,28 @@
   return timeout;
   }
   
  +/** Get the request associated with this processor.
  + *
  + * @return
  + */
  +public Request getRequest() {
  +return request;
  +}
  +
   /**
* Process pipelined HTTP requests using the specified input and output
* streams.
* 
  - * @param inputStream stream from which the HTTP requests will be read
  - * @param outputStream stream which will be used to output the HTTP 
  + * @param input stream from which the HTTP requests will be read
  + * @param output stream which will be used to output the HTTP
* responses
* @throws IOException error during an I/O operation
*/
   public void process(InputStream input, OutputStream output)
   throws IOException {
  +ThreadWithAttributes thrA=
  +(ThreadWithAttributes)Thread.currentThread();
  +thrA.setCurrentStage(threadPool, parsing http request);
   
   // Set the remote address
   remoteAddr = null;
  @@ -567,6 +581,7 @@
   socket.setSoTimeout(soTimeout);
   }
   inputBuffer.parseRequestLine();
  +thrA.setParam( threadPool, request.requestURI().toString());
   keptAlive = true;
   if (!disableUploadTimeout) {
   socket.setSoTimeout(timeout);
  @@ -583,6 +598,7 @@
   }
   
   // Setting up filters, and parse some request headers
  +thrA.setCurrentStage(threadPool, 

cvs commit: jakarta-tomcat-connectors/http11/src/java/org/apache/coyote/http11 Http11Processor.java Http11Protocol.java

2002-11-25 Thread billbarker
billbarker2002/11/25 19:32:51

  Modified:http11/src/java/org/apache/coyote/http11
Http11Processor.java Http11Protocol.java
  Log:
  Adding a flag to disable setting a seperate time-out for uploads.
  
  The effect of this is to have many fewer calls to setSoTimeout.  I've never seen 
that it makes much of a difference (at least on Solaris), but it shouldn't cause any 
problems as long as you don't plan on doing any big uploads.
  
  Revision  ChangesPath
  1.46  +21 -2 
jakarta-tomcat-connectors/http11/src/java/org/apache/coyote/http11/Http11Processor.java
  
  Index: Http11Processor.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-connectors/http11/src/java/org/apache/coyote/http11/Http11Processor.java,v
  retrieving revision 1.45
  retrieving revision 1.46
  diff -u -r1.45 -r1.46
  --- Http11Processor.java  24 Nov 2002 22:00:04 -  1.45
  +++ Http11Processor.java  26 Nov 2002 03:32:50 -  1.46
  @@ -238,6 +238,10 @@
*/
   protected int timeout = 30;   // 5 minutes as in Apache HTTPD server
   
  +/**
  + * Flag to disable setting a different time-out on uploads.
  + */
  +protected boolean disableUploadTimeout = false;
   
   /**
* Host name (used to avoid useless B2C conversion on the host name).
  @@ -341,6 +345,19 @@
   }
   
   /**
  + * Set the flag to control upload time-outs.
  + */
  +public void setDisableUploadTimeout(boolean isDisabled) {
  +disableUploadTimeout = isDisabled;
  +}
  +/**
  + * Get the flag that controls upload time-outs.
  + */
  +public boolean getDisableUploadTimeout() {
  +return disableUploadTimeout;
  +}
  +
  +/**
* Set the upload timeout.
*/
   public void setTimeout( int timeouts ) {
  @@ -380,10 +397,12 @@
   int keepAliveLeft = maxKeepAliveRequests;
   int soTimeout = socket.getSoTimeout();
   boolean keptAlive = false;
  -socket.setSoTimeout(timeout);
  +if( !disableUploadTimeout ) {
  +socket.setSoTimeout(timeout);
  +}
   while (started  !error  keepAlive) {
   try {
  -if( keptAlive  soTimeout  0 ) {
  +if( !disableUploadTimeout  keptAlive  soTimeout  0 ) {
   socket.setSoTimeout(soTimeout);
   }
   inputBuffer.parseRequestLine();
  
  
  
  1.17  +6 -0  
jakarta-tomcat-connectors/http11/src/java/org/apache/coyote/http11/Http11Protocol.java
  
  Index: Http11Protocol.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-connectors/http11/src/java/org/apache/coyote/http11/Http11Protocol.java,v
  retrieving revision 1.16
  retrieving revision 1.17
  diff -u -r1.16 -r1.17
  --- Http11Protocol.java   22 Oct 2002 09:23:32 -  1.16
  +++ Http11Protocol.java   26 Nov 2002 03:32:50 -  1.17
  @@ -185,6 +185,7 @@
   private int  timeout = 30;   // 5 minutes as in Apache HTTPD server
   private String reportedname;
   private int socketCloseDelay=-1;
  +private boolean disableUploadTimeout = false;
   
   //  Pool setup 
   
  @@ -246,6 +247,10 @@
   setAttribute(tcpNoDelay,  + b);
   }
   
  +public void setDisableUploadTimeout(boolean isDisabled) {
  +disableUploadTimeout = isDisabled;
  +}
  +
   public void setSoLinger( int i ) {
ep.setSoLinger( i );
   setAttribute(soLinger,  + i);
  @@ -346,6 +351,7 @@
   processor.setAdapter( proto.adapter );
   processor.setMaxKeepAliveRequests( proto.maxKeepAliveRequests );
   processor.setTimeout( proto.timeout );
  +processor.setDisableUploadTimeout( proto.disableUploadTimeout );
   
   //thData[0]=adapter;
   thData[1]=processor;
  
  
  

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




cvs commit: jakarta-tomcat-connectors/http11/src/java/org/apache/coyote/http11 Http11Processor.java Http11Protocol.java

2002-04-25 Thread billbarker

billbarker02/04/25 18:50:32

  Modified:http11/src/java/org/apache/coyote/http11
Http11Processor.java Http11Protocol.java
  Log:
  Fix problem with soTimeout.
  
  The makes Coyote act like httpd with respect to soTimeout (which is what it was 
trying to do before, but only worked on HTTP/1.0 connectors).
  
  Revision  ChangesPath
  1.30  +25 -0 
jakarta-tomcat-connectors/http11/src/java/org/apache/coyote/http11/Http11Processor.java
  
  Index: Http11Processor.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-connectors/http11/src/java/org/apache/coyote/http11/Http11Processor.java,v
  retrieving revision 1.29
  retrieving revision 1.30
  diff -u -r1.29 -r1.30
  --- Http11Processor.java  18 Apr 2002 09:11:44 -  1.29
  +++ Http11Processor.java  26 Apr 2002 01:50:32 -  1.30
  @@ -232,6 +232,11 @@
*/
   protected String remoteHost = null;
   
  +/**
  + * Maximum timeout on uploads.
  + */
  +protected int timeout = 30;   // 5 minutes as in Apache HTTPD server
  +
   // - Public Methods
   
   
  @@ -327,6 +332,18 @@
   this.socket = socket;
   }
   
  +/**
  + * Set the upload timeout.
  + */
  +public void setTimeout( int timeouts ) {
  +timeout = timeouts * 1000;
  +}
  +/**
  + * Get the upload timeout.
  + */
  +public int getTimeout() {
  +return timeout;
  +}
   
   /**
* Process pipelined HTTP requests using the specified input and output
  @@ -354,10 +371,18 @@
   keepAlive = true;
   
   int keepAliveLeft = maxKeepAliveRequests;
  +int soTimeout = socket.getSoTimeout();
  +boolean keptAlive = false;
  +socket.setSoTimeout(timeout);
   
   while (started  !error  keepAlive) {
   try {
  +if( keptAlive  soTimeout  0 ) {
  +socket.setSoTimeout(soTimeout);
  +}
   inputBuffer.parseRequestLine();
  +keptAlive = false;
  +socket.setSoTimeout(timeout);
   inputBuffer.parseHeaders();
   } catch (IOException e) {
   error = true;
  
  
  
  1.9   +0 -5  
jakarta-tomcat-connectors/http11/src/java/org/apache/coyote/http11/Http11Protocol.java
  
  Index: Http11Protocol.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-connectors/http11/src/java/org/apache/coyote/http11/Http11Protocol.java,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- Http11Protocol.java   17 Apr 2002 17:31:37 -  1.8
  +++ Http11Protocol.java   26 Apr 2002 01:50:32 -  1.9
  @@ -164,7 +164,6 @@
   protected String sslImplementationName=null;
   
   private int maxKeepAliveRequests=100; // as in Apache HTTPD server
  -private int  timeout = 30;   // 5 minutes as in Apache HTTPD server
   private String reportedname;
   private int socketCloseDelay=-1;
   
  @@ -289,9 +288,6 @@
return (ServerSocketFactory)chC.newInstance();
   }
   
  -public void setTimeout( int timeouts ) {
  - timeout = timeouts * 1000;
  -}
   public void setReportedname( String reportedName) {
reportedname = reportedName;
   }
  @@ -338,7 +334,6 @@
   ((ActionHook) processor).action(ActionCode.ACTION_START, null);
   }
   socket=connection.getSocket();
  -socket.setSoTimeout(proto.timeout);
   
   InputStream in = socket.getInputStream();
   OutputStream out = socket.getOutputStream();
  
  
  

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




Re: cvs commit: jakarta-tomcat-connectors/http11/src/java/org/apache/coyote/http11 Http11Processor.java Http11Protocol.java

2002-04-25 Thread Remy Maucherat

 billbarker02/04/25 18:50:32

   Modified:http11/src/java/org/apache/coyote/http11
 Http11Processor.java Http11Protocol.java
   Log:
   Fix problem with soTimeout.

   The makes Coyote act like httpd with respect to soTimeout (which is what
it was trying to do before, but only worked on HTTP/1.0 connectors).

So the SoTimeout was overwritten ... You actually call setSoTimeout *a lot*.
This is more flexible, since you can configure separately the connection
timeout, but unless that call is free or almost free, this is not a good
idea IMO.

Remy


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