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

2005-07-31 Thread remm
remm2005/07/31 02:23:02

  Modified:http11/src/java/org/apache/coyote/http11
Http11Processor.java Http11AprProcessor.java
  Log:
  - Maybe Eclipse created the bad imports to the AJP package for me.
  
  Revision  ChangesPath
  1.124 +0 -1  
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.123
  retrieving revision 1.124
  diff -u -r1.123 -r1.124
  --- Http11Processor.java  30 Jul 2005 16:18:14 -  1.123
  +++ Http11Processor.java  31 Jul 2005 09:23:02 -  1.124
  @@ -35,7 +35,6 @@
   import org.apache.coyote.Request;
   import org.apache.coyote.RequestInfo;
   import org.apache.coyote.Response;
  -import org.apache.coyote.http11.Constants;
   import org.apache.coyote.http11.filters.ChunkedInputFilter;
   import org.apache.coyote.http11.filters.ChunkedOutputFilter;
   import org.apache.coyote.http11.filters.GzipOutputFilter;
  
  
  
  1.30  +0 -1  
jakarta-tomcat-connectors/http11/src/java/org/apache/coyote/http11/Http11AprProcessor.java
  
  Index: Http11AprProcessor.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-connectors/http11/src/java/org/apache/coyote/http11/Http11AprProcessor.java,v
  retrieving revision 1.29
  retrieving revision 1.30
  diff -u -r1.29 -r1.30
  --- Http11AprProcessor.java   30 Jul 2005 16:18:14 -  1.29
  +++ Http11AprProcessor.java   31 Jul 2005 09:23:02 -  1.30
  @@ -34,7 +34,6 @@
   import org.apache.coyote.Request;
   import org.apache.coyote.RequestInfo;
   import org.apache.coyote.Response;
  -import org.apache.coyote.http11.Constants;
   import org.apache.coyote.http11.filters.ChunkedInputFilter;
   import org.apache.coyote.http11.filters.ChunkedOutputFilter;
   import org.apache.coyote.http11.filters.GzipOutputFilter;
  
  
  

-
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 Http11AprProcessor.java

2005-07-25 Thread remm
remm2005/07/25 08:32:48

  Modified:http11/src/java/org/apache/coyote/http11
Http11Processor.java Http11AprProcessor.java
  Log:
  - Oops, fix bad cut  paste error (the condition is inverted), which
causes problems when using the default ports.
  
  Revision  ChangesPath
  1.121 +1 -1  
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.120
  retrieving revision 1.121
  diff -u -r1.120 -r1.121
  --- Http11Processor.java  22 May 2005 17:12:11 -  1.120
  +++ Http11Processor.java  25 Jul 2005 15:32:48 -  1.121
  @@ -1375,7 +1375,7 @@
   
   if (colonPos  0) {
   if (sslSupport == null) {
  -// 80 - Default HTTTP port
  +// 80 - Default HTTP port
   request.setServerPort(80);
   } else {
   // 443 - Default HTTPS port
  
  
  
  1.26  +2 -2  
jakarta-tomcat-connectors/http11/src/java/org/apache/coyote/http11/Http11AprProcessor.java
  
  Index: Http11AprProcessor.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-connectors/http11/src/java/org/apache/coyote/http11/Http11AprProcessor.java,v
  retrieving revision 1.25
  retrieving revision 1.26
  diff -u -r1.25 -r1.26
  --- Http11AprProcessor.java   13 Jul 2005 13:03:51 -  1.25
  +++ Http11AprProcessor.java   25 Jul 2005 15:32:48 -  1.26
  @@ -1422,8 +1422,8 @@
   }
   
   if (colonPos  0) {
  -if (ssl) {
  -// 80 - Default HTTTP port
  +if (!ssl) {
  +// 80 - Default HTTP port
   request.setServerPort(80);
   } else {
   // 443 - Default HTTPS port
  
  
  

-
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

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

2005-02-27 Thread keith
keith   2005/02/27 13:30:52

  Modified:coyote/src/java/org/apache/coyote Tag: TOMCAT_5_0
Response.java
   coyote/src/java/org/apache/coyote/tomcat4 Tag: TOMCAT_5_0
OutputBuffer.java
   http11/src/java/org/apache/coyote/http11 Tag: TOMCAT_5_0
Http11Processor.java
  Log:
  Backport to 50 branch of fix to allow servlets to return
  multi-gb content-length headers
  
  - allow servlets to set content-length  Integer.MAX_VALUE via setHeader()
  - if servlet sets a content length in this manner, getContentLength will
return -1 if cl  Integer.MAX_VALUE, so test getContentLengthLong to see
if the cl was set.
  
  Revision  ChangesPath
  No   revision
  No   revision
  1.32.2.2  +5 -1  
jakarta-tomcat-connectors/coyote/src/java/org/apache/coyote/Response.java
  
  Index: Response.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-connectors/coyote/src/java/org/apache/coyote/Response.java,v
  retrieving revision 1.32.2.1
  retrieving revision 1.32.2.2
  diff -u -r1.32.2.1 -r1.32.2.2
  --- Response.java 10 Feb 2005 05:25:41 -  1.32.2.1
  +++ Response.java 27 Feb 2005 21:30:51 -  1.32.2.2
  @@ -350,7 +350,7 @@
   }
   if( name.equalsIgnoreCase( Content-Length ) ) {
   try {
  -int cL=Integer.parseInt( value );
  +long cL=Long.parseLong( value );
   setContentLength( cL );
   return true;
   } catch( NumberFormatException ex ) {
  @@ -528,6 +528,10 @@
   this.contentLength = contentLength;
   }
   
  +public void setContentLength(long contentLength) {
  +this.contentLength = contentLength;
  +}
  +
   public int getContentLength() {
   long length = getContentLengthLong();
   
  
  
  
  No   revision
  No   revision
  1.13.2.1  +1 -1  
jakarta-tomcat-connectors/coyote/src/java/org/apache/coyote/tomcat4/OutputBuffer.java
  
  Index: OutputBuffer.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-connectors/coyote/src/java/org/apache/coyote/tomcat4/OutputBuffer.java,v
  retrieving revision 1.13
  retrieving revision 1.13.2.1
  diff -u -r1.13 -r1.13.2.1
  --- OutputBuffer.java 24 Feb 2004 08:54:29 -  1.13
  +++ OutputBuffer.java 27 Feb 2005 21:30:51 -  1.13.2.1
  @@ -262,7 +262,7 @@
   return;
   
   if ((!coyoteResponse.isCommitted()) 
  - (coyoteResponse.getContentLength() == -1)) {
  + (coyoteResponse.getContentLengthLong() == -1)) {
   // Flushing the char buffer
   if (state == CHAR_STATE) {
   cb.flushBuffer();
  
  
  
  No   revision
  No   revision
  1.100.2.4 +1 -1  
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.100.2.3
  retrieving revision 1.100.2.4
  diff -u -r1.100.2.3 -r1.100.2.4
  --- Http11Processor.java  10 Feb 2005 05:25:41 -  1.100.2.3
  +++ Http11Processor.java  27 Feb 2005 21:30:51 -  1.100.2.4
  @@ -1385,7 +1385,7 @@
   }
   
   // Check if suffisant len to trig the compression
  -int contentLength = response.getContentLength();
  +long contentLength = response.getContentLengthLong();
   if ((contentLength == -1) 
   || (contentLength  compressionMinSize)) {
   // Check for compatible MIME-TYPE
  
  
  

-
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

2005-02-09 Thread keith
keith   2005/02/09 21:25:42

  Modified:http11/src/java/org/apache/coyote/http11/filters Tag:
TOMCAT_5_0 IdentityOutputFilter.java
   coyote/src/java/org/apache/coyote Tag: TOMCAT_5_0
Response.java
   util/java/org/apache/tomcat/util/buf Tag: TOMCAT_5_0
MessageBytes.java
   http11/src/java/org/apache/coyote/http11 Tag: TOMCAT_5_0
Http11Processor.java
  Log:
  Port fix from Mark Thomas for better Content-Length handling into the _5_0 
branch
  
  PR: 32585
  
  Revision  ChangesPath
  No   revision
  No   revision
  1.7.2.1   +1 -1  
jakarta-tomcat-connectors/http11/src/java/org/apache/coyote/http11/filters/IdentityOutputFilter.java
  
  Index: IdentityOutputFilter.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-connectors/http11/src/java/org/apache/coyote/http11/filters/IdentityOutputFilter.java,v
  retrieving revision 1.7
  retrieving revision 1.7.2.1
  diff -u -r1.7 -r1.7.2.1
  --- IdentityOutputFilter.java 24 Feb 2004 08:50:55 -  1.7
  +++ IdentityOutputFilter.java 10 Feb 2005 05:25:41 -  1.7.2.1
  @@ -141,7 +141,7 @@
* after the response header processing is complete.
*/
   public void setResponse(Response response) {
  -contentLength = response.getContentLength();
  +contentLength = response.getContentLengthLong();
   remaining = contentLength;
   }
   
  
  
  
  No   revision
  No   revision
  1.32.2.1  +11 -2 
jakarta-tomcat-connectors/coyote/src/java/org/apache/coyote/Response.java
  
  Index: Response.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-connectors/coyote/src/java/org/apache/coyote/Response.java,v
  retrieving revision 1.32
  retrieving revision 1.32.2.1
  diff -u -r1.32 -r1.32.2.1
  --- Response.java 24 Feb 2004 08:54:29 -  1.32
  +++ Response.java 10 Feb 2005 05:25:41 -  1.32.2.1
  @@ -100,7 +100,7 @@
   protected String contentType = null;
   protected String contentLanguage = null;
   protected String characterEncoding = 
Constants.DEFAULT_CHARACTER_ENCODING;
  -protected int contentLength = -1;
  +protected long contentLength = -1;
   private Locale locale = DEFAULT_LOCALE;
   
   // General informations
  @@ -529,7 +529,16 @@
   }
   
   public int getContentLength() {
  -return contentLength;
  +long length = getContentLengthLong();
  +
  +if (length  Integer.MAX_VALUE) {
  +return (int) length;
  +}
  +return -1;
  +}
  +
  +public long getContentLengthLong() {
  +  return contentLength;
   }
   
   
  
  
  
  No   revision
  No   revision
  1.14.2.2  +42 -0 
jakarta-tomcat-connectors/util/java/org/apache/tomcat/util/buf/MessageBytes.java
  
  Index: MessageBytes.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-connectors/util/java/org/apache/tomcat/util/buf/MessageBytes.java,v
  retrieving revision 1.14.2.1
  retrieving revision 1.14.2.2
  diff -u -r1.14.2.1 -r1.14.2.2
  --- MessageBytes.java 25 Aug 2004 20:44:15 -  1.14.2.1
  +++ MessageBytes.java 10 Feb 2005 05:25:41 -  1.14.2.2
  @@ -579,6 +579,48 @@
   type=T_BYTES;
   }
   
  +/** Set the buffer to the representation of an long
  + */
  +public void setLong(long l) {
  +byteC.allocate(32, 64);
  +long current = l;
  +byte[] buf = byteC.getBuffer();
  +int start = 0;
  +int end = 0;
  +if (l == 0) {
  +buf[end++] = (byte) '0';
  +}
  +if (l  0) {
  +current = -l;
  +buf[end++] = (byte) '-';
  +}
  +while (current  0) {
  +int digit = (int) (current % 10);
  +current = current / 10;
  +buf[end++] = HexUtils.HEX[digit];
  +}
  +byteC.setOffset(0);
  +byteC.setEnd(end);
  +// Inverting buffer
  +end--;
  +if (l  0) {
  +start++;
  +}
  +while (end  start) {
  +byte temp = buf[start];
  +buf[start] = buf[end];
  +buf[end] = temp;
  +start++;
  +end--;
  +}
  +longValue=l;
  +hasStrValue=false;
  +hasHashCode=false;
  +hasIntValue=false;
  +hasLongValue=true;
  +hasDateValue=false; 
  +type=T_BYTES;
  +}
   
   /**
*  @deprecated The buffer are general purpose, caching for headers 
should
  
  
  
  No   revision
  No   revision
  1.100.2.3 +2 -2

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

2005-01-06 Thread remm
remm2005/01/06 04:43:15

  Modified:http11/src/java/org/apache/coyote/http11
Http11Processor.java
  Log:
  - Content length should be ignored if there is chunking.
  
  Revision  ChangesPath
  1.117 +8 -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.116
  retrieving revision 1.117
  diff -u -r1.116 -r1.117
  --- Http11Processor.java  10 Dec 2004 00:00:00 -  1.116
  +++ Http11Processor.java  6 Jan 2005 12:43:15 -   1.117
  @@ -1222,14 +1222,6 @@
   // Input filter setup
   InputFilter[] inputFilters = inputBuffer.getFilters();
   
  -// Parse content-length header
  -long contentLength = request.getContentLengthLong();
  -if (contentLength = 0) {
  -inputBuffer.addActiveFilter
  -(inputFilters[Constants.IDENTITY_FILTER]);
  -contentDelimitation = true;
  -}
  -
   // Parse transfer-encoding header
   MessageBytes transferEncodingValueMB = null;
   if (http11)
  @@ -1260,6 +1252,14 @@
   // 501 - Unimplemented
   response.setStatus(501);
   }
  +}
  +
  +// Parse content-length header
  +long contentLength = request.getContentLengthLong();
  +if (contentLength = 0  !contentDelimitation) {
  +inputBuffer.addActiveFilter
  +(inputFilters[Constants.IDENTITY_FILTER]);
  +contentDelimitation = true;
   }
   
   MessageBytes valueMB = headers.getValue(host);
  
  
  

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



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

2004-11-22 Thread Remy Maucherat
[EMAIL PROTECTED] wrote:
billbarker2004/11/21 22:42:46
 Modified:http11/src/java/org/apache/coyote/http11
   Http11Processor.java
 Log:
 Reverting reversion of patch ;-)  

Sorry for the trouble ;)
Rémy
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


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

2004-11-21 Thread Remy Maucherat
Bill Barker wrote:

Bill Barker wrote:

[EMAIL PROTECTED] wrote:
billbarker2004/11/19 19:04:28
 Modified:http11/src/java/org/apache/coyote/http11
   Http11Processor.java
 Log:
 If we are in the error state, we aren't going to keep-alive.  So 
don't lie to the UA that we are.
 Fix for Bug #32292

-1. I disagree with this change, sorry. We are going to keepalive 
in this case (anything which isn't a status drop, which is the 
whole point). The error flag can be set by a sendError, which could 
send any status code.

You're vote would be more convincing if anything that you said was 
actually true ;-).  We're note going to keepalive, and you can't set 
if from sendError.

It's not true ? Did I miss something ? The thing with sendError and 
not closing the connection is that often sendError is used to trigger 
pretty standard error pages.

This is the 'error' flag in Http11Processor.  It's set in various 
'catch' blocks, and for a couple of places where the request can't be 
parsed (mostly the Host header and the Protocol).  In particular, it 
isn't visible to the Response :).  Once it is set, it is never 
cleared, and being set causes the Processor to drop out of the 
keep-alive loop.
Thanks for the explanation (you don't have to revert a patch right away, 
BTW). As the error flag is used in the loop, and does not depend on 
sendError, then the patch was fine. I didn't look in detail at that code 
for a while, and I forgot the subtelties.

Rémy
-
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

2004-11-21 Thread billbarker
billbarker2004/11/21 22:42:46

  Modified:http11/src/java/org/apache/coyote/http11
Http11Processor.java
  Log:
  Reverting reversion of patch ;-)
  
  Revision  ChangesPath
  1.115 +1 -1  
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.114
  retrieving revision 1.115
  diff -u -r1.114 -r1.115
  --- Http11Processor.java  20 Nov 2004 21:59:49 -  1.114
  +++ Http11Processor.java  22 Nov 2004 06:42:46 -  1.115
  @@ -1542,7 +1542,7 @@
   keepAlive = keepAlive  !statusDropsConnection(statusCode);
   if (!keepAlive) {
   
headers.addValue(Constants.CONNECTION).setString(Constants.CLOSE);
  -} else if (!http11) {
  +} else if (!http11  !error) {
   
headers.addValue(Constants.CONNECTION).setString(Constants.KEEPALIVE);
   }
   
  
  
  

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



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

2004-11-20 Thread Bill Barker
- Original Message - 
From: Remy Maucherat [EMAIL PROTECTED]
To: Tomcat Developers List [EMAIL PROTECTED]
Sent: Saturday, November 20, 2004 1:17 AM
Subject: Re: cvs commit: 
jakarta-tomcat-connectors/http11/src/java/org/apache/coyote/http11 
Http11Processor.java


[EMAIL PROTECTED] wrote:
billbarker2004/11/19 19:04:28
 Modified:http11/src/java/org/apache/coyote/http11
   Http11Processor.java
 Log:
 If we are in the error state, we aren't going to keep-alive.  So don't 
lie to the UA that we are.
 Fix for Bug #32292

-1. I disagree with this change, sorry. We are going to keepalive in this 
case (anything which isn't a status drop, which is the whole point). The 
error flag can be set by a sendError, which could send any status code.
You're vote would be more convincing if anything that you said was actually 
true ;-).  We're note going to keepalive, and you can't set if from 
sendError.


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/http11/src/java/org/apache/coyote/http11 Http11Processor.java

2004-11-20 Thread billbarker
billbarker2004/11/20 13:59:49

  Modified:http11/src/java/org/apache/coyote/http11
Http11Processor.java
  Log:
  Reverting patch per vote on tomcat-dev
  
  Revision  ChangesPath
  1.114 +1 -1  
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.113
  retrieving revision 1.114
  diff -u -r1.113 -r1.114
  --- Http11Processor.java  20 Nov 2004 03:04:28 -  1.113
  +++ Http11Processor.java  20 Nov 2004 21:59:49 -  1.114
  @@ -1542,7 +1542,7 @@
   keepAlive = keepAlive  !statusDropsConnection(statusCode);
   if (!keepAlive) {
   
headers.addValue(Constants.CONNECTION).setString(Constants.CLOSE);
  -} else if (!http11  !error) {
  +} else if (!http11) {
   
headers.addValue(Constants.CONNECTION).setString(Constants.KEEPALIVE);
   }
   
  
  
  

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



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

2004-11-20 Thread Remy Maucherat
Bill Barker wrote:

[EMAIL PROTECTED] wrote:
billbarker2004/11/19 19:04:28
 Modified:http11/src/java/org/apache/coyote/http11
   Http11Processor.java
 Log:
 If we are in the error state, we aren't going to keep-alive.  So 
don't lie to the UA that we are.
 Fix for Bug #32292

-1. I disagree with this change, sorry. We are going to keepalive in 
this case (anything which isn't a status drop, which is the whole 
point). The error flag can be set by a sendError, which could send 
any status code.

You're vote would be more convincing if anything that you said was 
actually true ;-).  We're note going to keepalive, and you can't set 
if from sendError. 
It's not true ? Did I miss something ? The thing with sendError and not 
closing the connection is that often sendError is used to trigger pretty 
standard error pages.

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


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

2004-11-20 Thread Bill Barker
- Original Message - 
From: Remy Maucherat [EMAIL PROTECTED]
To: Tomcat Developers List [EMAIL PROTECTED]
Sent: Saturday, November 20, 2004 2:40 PM
Subject: Re: cvs commit: 
jakarta-tomcat-connectors/http11/src/java/org/apache/coyote/http11 
Http11Processor.java


Bill Barker wrote:

[EMAIL PROTECTED] wrote:
billbarker2004/11/19 19:04:28
 Modified:http11/src/java/org/apache/coyote/http11
   Http11Processor.java
 Log:
 If we are in the error state, we aren't going to keep-alive.  So don't 
lie to the UA that we are.
 Fix for Bug #32292

-1. I disagree with this change, sorry. We are going to keepalive in 
this case (anything which isn't a status drop, which is the whole 
point). The error flag can be set by a sendError, which could send any 
status code.

You're vote would be more convincing if anything that you said was 
actually true ;-).  We're note going to keepalive, and you can't set if 
from sendError.
It's not true ? Did I miss something ? The thing with sendError and not 
closing the connection is that often sendError is used to trigger pretty 
standard error pages.
This is the 'error' flag in Http11Processor.  It's set in various 'catch' 
blocks, and for a couple of places where the request can't be parsed (mostly 
the Host header and the Protocol).  In particular, it isn't visible to the 
Response :).  Once it is set, it is never cleared, and being set causes the 
Processor to drop out of the keep-alive loop.

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/http11/src/java/org/apache/coyote/http11 Http11Processor.java

2004-11-19 Thread billbarker
billbarker2004/11/19 19:04:28

  Modified:http11/src/java/org/apache/coyote/http11
Http11Processor.java
  Log:
  If we are in the error state, we aren't going to keep-alive.  So don't lie to 
the UA that we are.
  
  Fix for Bug #32292
  
  Revision  ChangesPath
  1.113 +1 -1  
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.112
  retrieving revision 1.113
  diff -u -r1.112 -r1.113
  --- Http11Processor.java  1 Oct 2004 23:36:15 -   1.112
  +++ Http11Processor.java  20 Nov 2004 03:04:28 -  1.113
  @@ -1542,7 +1542,7 @@
   keepAlive = keepAlive  !statusDropsConnection(statusCode);
   if (!keepAlive) {
   
headers.addValue(Constants.CONNECTION).setString(Constants.CLOSE);
  -} else if (!http11) {
  +} else if (!http11  !error) {
   
headers.addValue(Constants.CONNECTION).setString(Constants.KEEPALIVE);
   }
   
  
  
  

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



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

2004-09-14 Thread Mark Thomas
From: Remy Maucherat [mailto:[EMAIL PROTECTED] 
 The issue is that there's no value in this: it would likely take 5 
 minutes for an attacker to figure out the webserver is 
 running Tomcat. 
 The Server header is maybe the less visible of them (and gives little 
 information when compared to the others).
 
 So why bother about this ? (that's my point)

Because users want the functionality.

If it can be done without hitting performance, why not do it?

Mark



-
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

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 

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

2004-09-14 Thread Remy Maucherat
Mark Thomas wrote:
From: Remy Maucherat [mailto:[EMAIL PROTECTED] 
 

The issue is that there's no value in this: it would likely take 5 
minutes for an attacker to figure out the webserver is 
running Tomcat. 
The Server header is maybe the less visible of them (and gives little 
information when compared to the others).

So why bother about this ? (that's my point)
   

Because users want the functionality.
 

Cool. Let the morons rule, then ;)
If it can be done without hitting performance, why not do it?
Because useless functionality is bloat, and should not be added.
Rémy
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


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

2004-09-13 Thread Remy Maucherat
[EMAIL PROTECTED] wrote:
markt   2004/08/23 12:29:35
 Modified:http11/src/java/org/apache/coyote/http11
   Http11Processor.java
 Log:
 Fix bug 16254 - Server header appears twice after a call to response.setHeader()
 
 Revision  ChangesPath
 1.105 +3 -1  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.104
 retrieving revision 1.105
 diff -u -r1.104 -r1.105
 --- Http11Processor.java	21 Aug 2004 02:51:37 -	1.104
 +++ Http11Processor.java	23 Aug 2004 19:29:35 -	1.105
 @@ -1511,7 +1511,9 @@
  }
   
  // Add server header
 -response.addHeader(Server, Constants.SERVER);
 +if (! response.containsHeader(Server)){
 +response.addHeader(Server, Constants.SERVER);
 +}
 

As I said way back then, I dislike this patch. I will now revert it (as 
Scott pointed out, the X-Powered-By header is used for that kind of 
purpose).

Rémy
-
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

2004-09-13 Thread remm
remm2004/09/13 11:25:08

  Modified:http11/src/java/org/apache/coyote/http11
Http11Processor.java
  Log:
  - Revert patch. I disalike patches which cause a performance hit for the sole 
interest of embeddors who don't contribute anything. The
X-Powered-By header may be used for the same purpose, and is actually specified in 
the spec.
  
  Revision  ChangesPath
  1.108 +1 -3  
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.107
  retrieving revision 1.108
  diff -u -r1.107 -r1.108
  --- Http11Processor.java  1 Sep 2004 10:10:11 -   1.107
  +++ Http11Processor.java  13 Sep 2004 18:25:08 -  1.108
  @@ -1511,9 +1511,7 @@
   }

   // Add server header
  -if (! response.containsHeader(Server)){
  -response.addHeader(Server, Constants.SERVER);
  -}
  +response.addHeader(Server, Constants.SERVER);
   
   // Add transfer encoding header
   // FIXME
  
  
  

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



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

2004-09-13 Thread Tim Funk
This is an often asked for feature. My pref is for it to be a configuration 
in the Connector. Then the only added overhead is in during init.
For example ...

   protected serverHeader  =  Constants.SERVER;
   ...
   setServerHeader() ...
   getServerHeader() ...
   ...
   response.addHeader(Server, serverHeader);
??
-Tim
Remy Maucherat wrote:
[EMAIL PROTECTED] wrote:
markt   2004/08/23 12:29:35
 Modified:http11/src/java/org/apache/coyote/http11
   Http11Processor.java
 Log:
 Fix bug 16254 - Server header appears twice after a call to 
response.setHeader()
 
 Revision  ChangesPath
 1.105 +3 -1  
jakarta-tomcat-connectors/http11/src/java/org/apache/coyote/http11/Http11Processor.java 

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


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

2004-09-13 Thread Mark Thomas
 I disalike patches which cause a 
 performance hit for the sole interest of embeddors who don't 
 contribute anything.

Agreed. But this wasn't the reasoning behind the patch.

From the original bug report (16254) I believe the reporter had a security
motive. To repeat some of my earlier comments on this change:
quote
...section 14.38 of RFC 2616 does state
spec-quote
Note: Revealing the specific software version of the server might
  allow the server machine to become more vulnerable to attacks
  against software that is known to contain security holes. Server
  implementors are encouraged to make this field a configurable
  option.
/spec-quote

The default doesn't include a specific version but I think allowing it to be
overridden is more inline with the quote above.

Further, I couldn't see anything in the servlet spec that limits the use of
response.setHeader() to a subset of HTTP headers.

The patch I applied was based on the handling of the date header immediately
previously in the same class.
/quote

My position remains that the above reasons are sufficient justification for the
patch to remain.

Mark



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



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

2004-09-13 Thread Remy Maucherat
Mark Thomas wrote:
I disalike patches which cause a 
performance hit for the sole interest of embeddors who don't 
contribute anything.
   

Agreed. But this wasn't the reasoning behind the patch.
From the original bug report (16254) I believe the reporter had a security
motive. To repeat some of my earlier comments on this change:
quote
...section 14.38 of RFC 2616 does state
spec-quote
Note: Revealing the specific software version of the server might
 allow the server machine to become more vulnerable to attacks
 against software that is known to contain security holes. Server
 implementors are encouraged to make this field a configurable
 option.
/spec-quote
The default doesn't include a specific version but I think allowing it to be
overridden is more inline with the quote above.
Further, I couldn't see anything in the servlet spec that limits the use of
response.setHeader() to a subset of HTTP headers.
 

There are a lot of protocol specific headers that you cannot set using that.
The patch I applied was based on the handling of the date header immediately
previously in the same class.
/quote
 

You are quite right that the date header special handling should probaly 
go as well ;)

My position remains that the above reasons are sufficient justification for the
patch to remain.
 

My position remains the same as well.
Rémy
-
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

2004-09-13 Thread remm
remm2004/09/13 14:39:40

  Modified:http11/src/java/org/apache/coyote/http11
Http11Processor.java
  Log:
  - Cleanup a little access to the headers using a local variable.
  - Use direct access to the headers whenever possible (extra checks were done in 
Response).
  - Use setValue for Server and Date headers.
  
  Revision  ChangesPath
  1.109 +25 -33
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.108
  retrieving revision 1.109
  diff -u -r1.108 -r1.109
  --- Http11Processor.java  13 Sep 2004 18:25:08 -  1.108
  +++ Http11Processor.java  13 Sep 2004 21:39:39 -  1.109
  @@ -1126,9 +1126,10 @@
   methodMB.setString(Constants.POST);
   }
   
  +MimeHeaders headers = request.getMimeHeaders();
  +
   // Check connection header
  -MessageBytes connectionValueMB = 
  -request.getMimeHeaders().getValue(connection);
  +MessageBytes connectionValueMB = headers.getValue(connection);
   if (connectionValueMB != null) {
   ByteChunk connectionValueBC = connectionValueMB.getByteChunk();
   if (findBytes(connectionValueBC, Constants.CLOSE_BYTES) != -1) {
  @@ -1141,7 +1142,7 @@
   
   MessageBytes expectMB = null;
   if (http11)
  -expectMB = request.getMimeHeaders().getValue(expect);
  +expectMB = headers.getValue(expect);
   if ((expectMB != null)
(expectMB.indexOfIgnoreCase(100-continue, 0) != -1)) {
   inputBuffer.setSwallowInput(false);
  @@ -1150,8 +1151,7 @@
   
   // Check user-agent header
   if ((restrictedUserAgents != null)  ((http11) || (keepAlive))) {
  -MessageBytes userAgentValueMB =  
  -request.getMimeHeaders().getValue(user-agent);
  +MessageBytes userAgentValueMB = headers.getValue(user-agent);
   // Check in the restricted list, and adjust the http11 
   // and keepAlive flags accordingly
   if(userAgentValueMB != null) {
  @@ -1186,8 +1186,7 @@
   (uriB, uriBCStart + slashPos, 
uriBC.getLength() - slashPos);
   }
  -MessageBytes hostMB = 
  -request.getMimeHeaders().setValue(host);
  +MessageBytes hostMB = headers.setValue(host);
   hostMB.setBytes(uriB, uriBCStart + pos + 3, 
   slashPos - pos - 3);
   }
  @@ -1208,8 +1207,7 @@
   // Parse transfer-encoding header
   MessageBytes transferEncodingValueMB = null;
   if (http11)
  -transferEncodingValueMB = 
  -request.getMimeHeaders().getValue(transfer-encoding);
  +transferEncodingValueMB = headers.getValue(transfer-encoding);
   if (transferEncodingValueMB != null) {
   String transferEncodingValue = transferEncodingValueMB.toString();
   // Parse the comma separated list. identity codings are ignored
  @@ -1238,7 +1236,7 @@
   }
   }
   
  -MessageBytes valueMB = request.getMimeHeaders().getValue(host);
  +MessageBytes valueMB = headers.getValue(host);
   
   // Check host header
   if (http11  (valueMB == null)) {
  @@ -1467,8 +1465,7 @@
   
   int contentLength = response.getContentLength();
   if (contentLength != -1) {
  -response.getMimeHeaders().setValue(Content-Length)
  -.setInt(contentLength);
  +headers.setValue(Content-Length).setInt(contentLength);
   outputBuffer.addActiveFilter
   (outputFilters[Constants.IDENTITY_FILTER]);
   contentDelimitation = true;
  @@ -1477,7 +1474,7 @@
   outputBuffer.addActiveFilter
   (outputFilters[Constants.CHUNKED_FILTER]);
   contentDelimitation = true;
  -response.addHeader(Transfer-Encoding, chunked);
  +headers.addValue(Transfer-Encoding).setString(chunked);
   } else {
   outputBuffer.addActiveFilter
   (outputFilters[Constants.IDENTITY_FILTER]);
  @@ -1486,35 +1483,30 @@
   
   if (useCompression) {
   outputBuffer.addActiveFilter(outputFilters[Constants.GZIP_FILTER]);
  -// FIXME: Make content-encoding generation dynamic
  -response.setHeader(Content-Encoding, gzip);
  +headers.setValue(Content-Encoding).setString(gzip);
   // Make Proxies happy via Vary (from 

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

2004-09-13 Thread Mark Thomas
From: Remy Maucherat [mailto:[EMAIL PROTECTED] 
 My position remains that the above reasons are sufficient 
 justification for the
 patch to remain.
   
 
 My position remains the same as well.

Making the value of the server header configurable, as per Tim's suggestion
earlier in this thread, would meet the user requirement described in bug 16254
which is my main concern. Providing this is done in a way that doesn't impact
performance, would you find this an acceptable compromise?

Mark



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



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

2004-09-13 Thread Remy Maucherat
Mark Thomas wrote:
Making the value of the server header configurable, as per Tim's suggestion
earlier in this thread, would meet the user requirement described in bug 16254
which is my main concern. Providing this is done in a way that doesn't impact
performance, would you find this an acceptable compromise?
 

The issue is that there's no value in this: it would likely take 5 
minutes for an attacker to figure out the webserver is running Tomcat. 
The Server header is maybe the less visible of them (and gives little 
information when compared to the others).

So why bother about this ? (that's my point)
Rémy
-
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

2004-09-12 Thread markt
markt   2004/09/12 13:39:12

  Modified:http11/src/java/org/apache/coyote/http11 Tag: TOMCAT_5_0
Http11Processor.java
  Log:
  Backport fix for bug 16254
  
  Revision  ChangesPath
  No   revision
  No   revision
  1.100.2.2 +3 -1  
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.100.2.1
  retrieving revision 1.100.2.2
  diff -u -r1.100.2.1 -r1.100.2.2
  --- Http11Processor.java  25 Aug 2004 20:44:15 -  1.100.2.1
  +++ Http11Processor.java  12 Sep 2004 20:39:12 -  1.100.2.2
  @@ -1507,7 +1507,9 @@
   }

   // Add server header
  -response.addHeader(Server, Constants.SERVER);
  +if (! response.containsHeader(Server)){
  +response.addHeader(Server, Constants.SERVER);
  +}
   
   // Add transfer encoding header
   // FIXME
  
  
  

-
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

2004-09-01 Thread remm
remm2004/09/01 03:10:11

  Modified:catalina/src/share/org/apache/catalina/valves
RequestFilterValve.java
   http11/src/java/org/apache/coyote/http11
Http11Processor.java
  Log:
  - Use the JDK 1.4 regexp API, which is a straight replacement for jakarta-regexp. 
It's easy to switch back and forth, obviously, which is
quite convinient :)
  
  Revision  ChangesPath
  1.9   +14 -14
jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/valves/RequestFilterValve.java
  
  Index: RequestFilterValve.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/valves/RequestFilterValve.java,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- RequestFilterValve.java   29 Aug 2004 16:46:14 -  1.8
  +++ RequestFilterValve.java   1 Sep 2004 10:10:10 -   1.9
  @@ -20,6 +20,8 @@
   
   import java.io.IOException;
   import java.util.ArrayList;
  +import java.util.regex.Pattern;
  +import java.util.regex.PatternSyntaxException;
   
   import javax.servlet.ServletException;
   import javax.servlet.http.HttpServletResponse;
  @@ -27,8 +29,6 @@
   import org.apache.catalina.connector.Request;
   import org.apache.catalina.connector.Response;
   import org.apache.catalina.util.StringManager;
  -import org.apache.regexp.RE;
  -import org.apache.regexp.RESyntaxException;
   import org.apache.tomcat.util.compat.JdkCompat;
   
   /**
  @@ -104,13 +104,13 @@
   /**
* The set of codeallow/code regular expressions we will evaluate.
*/
  -protected RE allows[] = new RE[0];
  +protected Pattern allows[] = new Pattern[0];
   
   
   /**
* The set of codedeny/code regular expressions we will evaluate.
*/
  -protected RE denies[] = new RE[0];
  +protected Pattern denies[] = new Pattern[0];
   
   
   /**
  @@ -214,13 +214,13 @@
* @exception IllegalArgumentException if one of the patterns has
*  invalid syntax
*/
  -protected RE[] precalculate(String list) {
  +protected Pattern[] precalculate(String list) {
   
   if (list == null)
  -return (new RE[0]);
  +return (new Pattern[0]);
   list = list.trim();
   if (list.length()  1)
  -return (new RE[0]);
  +return (new Pattern[0]);
   list += ,;
   
   ArrayList reList = new ArrayList();
  @@ -230,8 +230,8 @@
   break;
   String pattern = list.substring(0, comma).trim();
   try {
  -reList.add(new RE(pattern));
  -} catch (RESyntaxException e) {
  +reList.add(Pattern.compile(pattern));
  +} catch (PatternSyntaxException e) {
   IllegalArgumentException iae = new IllegalArgumentException
   (sm.getString(requestFilterValve.syntax, pattern));
   jdkCompat.chainException(iae, e);
  @@ -240,8 +240,8 @@
   list = list.substring(comma + 1);
   }
   
  -RE reArray[] = new RE[reList.size()];
  -return ((RE[]) reList.toArray(reArray));
  +Pattern reArray[] = new Pattern[reList.size()];
  +return ((Pattern[]) reList.toArray(reArray));
   
   }
   
  @@ -263,7 +263,7 @@
   
   // Check the deny patterns, if any
   for (int i = 0; i  denies.length; i++) {
  -if (denies[i].match(property)) {
  +if (denies[i].matcher(property).matches()) {
   response.sendError(HttpServletResponse.SC_FORBIDDEN);
   return;
   }
  @@ -271,7 +271,7 @@
   
   // Check the allow patterns, if any
   for (int i = 0; i  allows.length; i++) {
  -if (allows[i].match(property)) {
  +if (allows[i].matcher(property).matches()) {
   getNext().invoke(request, response);
   return;
   }
  
  
  
  1.107 +18 -18
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.106
  retrieving revision 1.107
  diff -u -r1.106 -r1.107
  --- Http11Processor.java  31 Aug 2004 23:52:51 -  1.106
  +++ Http11Processor.java  1 Sep 2004 10:10:11 -   1.107
  @@ -23,6 +23,8 @@
   import java.net.InetAddress;
   import java.net.Socket;
   import java.util.StringTokenizer;
  +import java.util.regex.Pattern;
  +import java.util.regex.PatternSyntaxException;
   import java.security.AccessController;
   import java.security.PrivilegedAction;
   
  @@ -41,8 +43,6 @@
   import 

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

2004-08-23 Thread markt
markt   2004/08/23 12:29:35

  Modified:http11/src/java/org/apache/coyote/http11
Http11Processor.java
  Log:
  Fix bug 16254 - Server header appears twice after a call to response.setHeader()
  
  Revision  ChangesPath
  1.105 +3 -1  
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.104
  retrieving revision 1.105
  diff -u -r1.104 -r1.105
  --- Http11Processor.java  21 Aug 2004 02:51:37 -  1.104
  +++ Http11Processor.java  23 Aug 2004 19:29:35 -  1.105
  @@ -1511,7 +1511,9 @@
   }

   // Add server header
  -response.addHeader(Server, Constants.SERVER);
  +if (! response.containsHeader(Server)){
  +response.addHeader(Server, Constants.SERVER);
  +}
   
   // Add transfer encoding header
   // FIXME
  
  
  

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



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

2004-08-23 Thread Remy Maucherat
[EMAIL PROTECTED] wrote:
markt   2004/08/23 12:29:35
 Modified:http11/src/java/org/apache/coyote/http11
   Http11Processor.java
 Log:
 Fix bug 16254 - Server header appears twice after a call to response.setHeader()
 

I don't see any use for this. IMO, the server header should reflect the 
HTTP stack.

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


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

2004-08-23 Thread Bill Barker

- Original Message -
From: Remy Maucherat [EMAIL PROTECTED]
To: Tomcat Developers List [EMAIL PROTECTED]
Sent: Monday, August 23, 2004 1:01 PM
Subject: Re: cvs commit:
jakarta-tomcat-connectors/http11/src/java/org/apache/coyote/http11
Http11Processor.java


[EMAIL PROTECTED] wrote:

markt   2004/08/23 12:29:35

  Modified:http11/src/java/org/apache/coyote/http11
Http11Processor.java
  Log:
  Fix bug 16254 - Server header appears twice after a call to
response.setHeader()


I don't see any use for this. IMO, the server header should reflect the
HTTP stack.

I agree with Remy. IMO, a better patch would be s/addHeader/setHeader/.

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]

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

2004-08-23 Thread Mark Thomas
The reporter of the bug was trying to use a filter to override the contents of
the server header and set it to no name. They didn't say so, but I am guessing
there was a security motive behind their actions.

Mark


 -Original Message-
 From: Remy Maucherat [mailto:[EMAIL PROTECTED] 
 Sent: Monday, August 23, 2004 9:01 PM
 To: Tomcat Developers List
 Subject: Re: cvs commit: 
 jakarta-tomcat-connectors/http11/src/java/org/apache/coyote/ht
 tp11 Http11Processor.java
 
 [EMAIL PROTECTED] wrote:
 
 markt   2004/08/23 12:29:35
 
   Modified:http11/src/java/org/apache/coyote/http11
 Http11Processor.java
   Log:
   Fix bug 16254 - Server header appears twice after a call 
 to response.setHeader()
   
 
 I don't see any use for this. IMO, the server header should 
 reflect the 
 HTTP stack.
 
 Rémy



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



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

2004-08-23 Thread Remy Maucherat
Mark Thomas wrote:
The reporter of the bug was trying to use a filter to override the contents of
the server header and set it to no name. They didn't say so, but I am guessing
there was a security motive behind their actions.
 

Well, that's not very convincing. Can't they recompile if they want to 
do specific stuff ?

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


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

2004-08-23 Thread Mark Thomas
 From: Bill Barker [mailto:[EMAIL PROTECTED] 
 - Original Message -
 From: Remy Maucherat [EMAIL PROTECTED]
 To: Tomcat Developers List [EMAIL PROTECTED]
 Sent: Monday, August 23, 2004 1:01 PM
 Subject: Re: cvs commit:
 jakarta-tomcat-connectors/http11/src/java/org/apache/coyote/http11
 Http11Processor.java
 
 
 [EMAIL PROTECTED] wrote:
 
 markt   2004/08/23 12:29:35
 
   Modified:http11/src/java/org/apache/coyote/http11
 Http11Processor.java
   Log:
   Fix bug 16254 - Server header appears twice after a call to
 response.setHeader()
 
 
 I don't see any use for this. IMO, the server header should 
 reflect the
 HTTP stack.
 
 I agree with Remy. IMO, a better patch would be 
 s/addHeader/setHeader/.

Not sure what you mean by s/addHeader/setHeader/.



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



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

2004-08-23 Thread Mark Thomas
From: Remy Maucherat [mailto:[EMAIL PROTECTED] 
 Mark Thomas wrote:
 
 The reporter of the bug was trying to use a filter to 
 override the contents of
 the server header and set it to no name. They didn't say 
 so, but I am guessing
 there was a security motive behind their actions.
   
 
 Well, that's not very convincing.

It was only a guess at a reason, based on a short bug report. However section
14.38 of RFC 2616 does state
quote
Note: Revealing the specific software version of the server might
  allow the server machine to become more vulnerable to attacks
  against software that is known to contain security holes. Server
  implementors are encouraged to make this field a configurable
  option.
/quote

The default doesn't include a specific version but I think allowing it to be
overridden is more inline with the quote above.

Further, I couldn't see anything in the servlet spec that limits the use of
response.setHeader() to a subset of HTTP headers.

The patch I applied was based on the handling of the date header immediately
previously in the same class.




-
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

2004-08-20 Thread billbarker
billbarker2004/08/20 19:51:37

  Modified:http11/src/java/org/apache/coyote/http11
Http11Processor.java
  Log:
  Check that the browser actually sent a user-agent header before using it.
  
  Fix for Bug #30770
  Reported By: Elmar Haneke  [EMAIL PROTECTED]
  
  Revision  ChangesPath
  1.104 +15 -11
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.103
  retrieving revision 1.104
  diff -u -r1.103 -r1.104
  --- Http11Processor.java  12 Aug 2004 21:46:41 -  1.103
  +++ Http11Processor.java  21 Aug 2004 02:51:37 -  1.104
  @@ -1154,12 +1154,14 @@
   request.getMimeHeaders().getValue(user-agent);
   // Check in the restricted list, and adjust the http11 
   // and keepAlive flags accordingly
  -String userAgentValue = userAgentValueMB.toString();
  -for (int i = 0; i  restrictedUserAgents.length; i++) {
  -if (restrictedUserAgents[i].match(userAgentValue)) {
  -http11 = false;
  -keepAlive = false;
  -break;
  +if(userAgentValueMB != null) {
  +String userAgentValue = userAgentValueMB.toString();
  +for (int i = 0; i  restrictedUserAgents.length; i++) {
  +if (restrictedUserAgents[i].match(userAgentValue)) {
  +http11 = false;
  +keepAlive = false;
  +break;
  +}
   }
   }
   }
  @@ -1376,12 +1378,14 @@
   if (noCompressionUserAgents != null) {
   MessageBytes userAgentValueMB =  
   request.getMimeHeaders().getValue(user-agent);
  -String userAgentValue = userAgentValueMB.toString();
  +if(userAgentValueMB != null) {
  +String userAgentValue = userAgentValueMB.toString();
   
  -// If one Regexp rule match, disable compression
  -for (int i = 0; i  noCompressionUserAgents.length; i++)
  -if (noCompressionUserAgents[i].match(userAgentValue))
  -return false;
  +// If one Regexp rule match, disable compression
  +for (int i = 0; i  noCompressionUserAgents.length; i++)
  +if (noCompressionUserAgents[i].match(userAgentValue))
  +return false;
  +}
   }
   
   // Check if suffisant len to trig the compression
  
  
  

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



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

2004-07-28 Thread Remy Maucherat
[EMAIL PROTECTED] wrote:
luehe   2004/07/27 17:43:44
 Modified:http11/src/java/org/apache/coyote/http11
   Http11Processor.java
 Log:
 Fixed Bugtraq 6152759 (Default charset not included in Content-Type
 response header if no char encoding was specified).
 
 According to the Servlet 2.4 spec, calling:
 
   ServletResponse.setContentType(text/html);
 
 must yield these results:
 
   ServletResponse.getContentType() - text/html
 
   Content-Type response header - text/html;charset=ISO-8859-1
 
 Notice the absence of a charset in the result of getContentType(), but
 its presence (set to the default ISO-8859-1) in the Content-Type
 response header.
 
 Tomcat is currently not including the default charset in the
 Content-Type response header if no char encoding was specified.
 
 Revision  ChangesPath
 1.101 +1 -1  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.100
 retrieving revision 1.101
 diff -u -r1.100 -r1.101
 --- Http11Processor.java	1 Jun 2004 14:34:22 -	1.100
 +++ Http11Processor.java	28 Jul 2004 00:43:44 -	1.101
 @@ -1450,7 +1450,7 @@
  if (!entityBody) {
  response.setContentLength(-1);
  } else {
 -String contentType = response.getContentType();
 +String contentType = response.getContentTypeResponseHeader();
  if (contentType != null) {
  headers.setValue(Content-Type).setString(contentType);
  }
 

Cool. So after all the efforts I'm doing to optimize, you casually add 
GC, because the servlet API is completely stupid ?
So -1 for your patch: you need to rework it. I also didn't read all that 
funny stuff in the specification, so where does it come from ? ;)

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


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

2004-07-28 Thread Service Client Fnac.com
Chère Cliente, Cher Client,

Merci de nous avoir contactés.

Vous venez d'envoyer un message à une adresse ne permettant pas
de recevoir d'e-mail.

Pour trouver les réponses à vos questions sur vos commandes, sur
les produits, sur le site, consultez nos pages d'aide en ligne
en cliquant sur :
http://www.fnac.com/Help/A01.asp

Vous pouvez également suivre en direct l'évolution de vos commandes
en cours, en consultant la rubrique Vos Commandes en un clin d'oeil
en cliquant sur :
https://www.fnac.com/Account/Profil/default.asp

Nous espérons que ces pages vous apporteront toutes les informations
nécessaires. Dans le cas contraire, vous pouvez nous contacter par
e-mail en cliquant sur le lien :
http://www.fnac.com/Service_Client/FnacSUGG.asp

Merci de votre fidélité a www.fnac.com

Très cordialement,

L'équipe Fnac.com

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



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

2004-07-28 Thread Henri Gomez
Service Client Fnac.com wrote:
Chère Cliente, Cher Client,
Merci de nous avoir contactés.
Vous venez d'envoyer un message à une adresse ne permettant pas
de recevoir d'e-mail.
Pour trouver les réponses à vos questions sur vos commandes, sur
les produits, sur le site, consultez nos pages d'aide en ligne
en cliquant sur :
http://www.fnac.com/Help/A01.asp
Vous pouvez également suivre en direct l'évolution de vos commandes
en cours, en consultant la rubrique Vos Commandes en un clin d'oeil
en cliquant sur :
https://www.fnac.com/Account/Profil/default.asp
Nous espérons que ces pages vous apporteront toutes les informations
nécessaires. Dans le cas contraire, vous pouvez nous contacter par
e-mail en cliquant sur le lien :
http://www.fnac.com/Service_Client/FnacSUGG.asp
Merci de votre fidélité a www.fnac.com
Très cordialement,
L'équipe Fnac.com
This account is still registered to tomcat-dev ?

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


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

2004-07-28 Thread Service Client Fnac.com
Chère Cliente, Cher Client,

Merci de nous avoir contactés.

Vous venez d'envoyer un message à une adresse ne permettant pas
de recevoir d'e-mail.

Pour trouver les réponses à vos questions sur vos commandes, sur
les produits, sur le site, consultez nos pages d'aide en ligne
en cliquant sur :
http://www.fnac.com/Help/A01.asp

Vous pouvez également suivre en direct l'évolution de vos commandes
en cours, en consultant la rubrique Vos Commandes en un clin d'oeil
en cliquant sur :
https://www.fnac.com/Account/Profil/default.asp

Nous espérons que ces pages vous apporteront toutes les informations
nécessaires. Dans le cas contraire, vous pouvez nous contacter par
e-mail en cliquant sur le lien :
http://www.fnac.com/Service_Client/FnacSUGG.asp

Merci de votre fidélité a www.fnac.com

Très cordialement,

L'équipe Fnac.com

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



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

2004-07-28 Thread Remy Maucherat
Henri Gomez wrote:
Service Client Fnac.com wrote:
Chère Cliente, Cher Client,
Merci de nous avoir contactés.
Vous venez d'envoyer un message à une adresse ne permettant pas
de recevoir d'e-mail.
Pour trouver les réponses à vos questions sur vos commandes, sur
les produits, sur le site, consultez nos pages d'aide en ligne
en cliquant sur :
http://www.fnac.com/Help/A01.asp
Vous pouvez également suivre en direct l'évolution de vos commandes
en cours, en consultant la rubrique Vos Commandes en un clin d'oeil
en cliquant sur :
https://www.fnac.com/Account/Profil/default.asp
Nous espérons que ces pages vous apporteront toutes les informations
nécessaires. Dans le cas contraire, vous pouvez nous contacter par
e-mail en cliquant sur le lien :
http://www.fnac.com/Service_Client/FnacSUGG.asp
Merci de votre fidélité a www.fnac.com
Très cordialement,
L'équipe Fnac.com

This account is still registered to tomcat-dev ?
It came back :( I tried banning it this time (I'm learning the mailing 
list comments at the same time).

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


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

2004-07-28 Thread Remy Maucherat
Remy Maucherat wrote:
Cool. So after all the efforts I'm doing to optimize, you casually add 
GC, because the servlet API is completely stupid ?
So -1 for your patch: you need to rework it. I also didn't read all 
that funny stuff in the specification, so where does it come from ? ;)
I thought about it some more, and in addition to the performance 
problem, it would lead to adding charset even for binaries. We already 
found out that this way very bad (in addition to being meaningless, it 
breaks some clients such as Acrobat which simply does a check on the 
MIME type without removing the charset, which is rather logical since 
they're dealing with binaries) - this was some unintended behavior in 
some 4.1.x release (if I remember well, it was introduced by you 
already: you do like charset related issues ;) ).
So what I suggest is that you send that you send that as feedback to the 
servlet API, and that they put a small errata for the specification.
-1 for implementing the requirements of the specificatrion (although I 
can't find them anywhere ;) ) to the letter right now, as they are 
broken (I didn't dislike the previous behavior, so I want it to remain).

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


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

2004-07-28 Thread Jan Luehe
Remy,
Remy Maucherat wrote:
Remy Maucherat wrote:
Cool. So after all the efforts I'm doing to optimize, you casually add 
GC, because the servlet API is completely stupid ?
So -1 for your patch: you need to rework it. I also didn't read all 
that funny stuff in the specification, so where does it come from ? ;)

I thought about it some more, and in addition to the performance 
problem, it would lead to adding charset even for binaries. We already 
found out that this way very bad (in addition to being meaningless, it 
breaks some clients such as Acrobat which simply does a check on the 
MIME type without removing the charset, which is rather logical since 
they're dealing with binaries) - this was some unintended behavior in 
some 4.1.x release (if I remember well, it was introduced by you 
already: you do like charset related issues ;) ).
yes, sorry, I had forgotten about that case.
Believe, I didn't commit yesterday's patch simply because
I don't have anything better to do. It's come up as a compliance
issue which had been masked by an unrelated problem that was fixed.
So what I suggest is that you send that you send that as feedback to the 
servlet API, and that they put a small errata for the specification.
-1 for implementing the requirements of the specificatrion (although I 
can't find them anywhere ;) ) to the letter right now, as they are 
broken (I didn't dislike the previous behavior, so I want it to remain).
ServletResponse.setCharacterEncoding/setContentType/setLocale...
* pContainers must communicate the character encoding used for
* the servlet response's writer to the client if the protocol
* provides a way for doing so. In the case of HTTP, the character
* encoding is communicated as part of the codeContent-Type/code
* header for text media types. Note that the character encoding
* cannot be communicated via HTTP headers if the servlet does not
* specify a content type; however, it is still used to encode text
* written via the servlet response's writer.
Reason: Many browsers let the user choose which encoding to apply to
responses that don't declare their encoding, which will result in data
corruption if the response was encoded in ISO-8859-1 and the user
picks an incompatible encoding.
ServletResponse.getContentType...:
* If no character encoding has been specified, the
* charset parameter is omitted.
Reason: Allow setLocale() to set the response's char encoding
(corresponding to the locale) if the char encoding has not already
been set by setContentType() or setCharacterEncoding().
You can find corresponding wordings in the servlet spec.
Therefore, we need to add a charset to the Content-Type response header if:
- no response encoding has been specified (ie., the return value of
  ServletResponse.getContentType() has no charset), and
- the response is using a writer
My patch did not check for the latter.
Jan
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


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

2004-07-28 Thread Remy Maucherat
Jan Luehe wrote:
yes, sorry, I had forgotten about that case.
Believe, I didn't commit yesterday's patch simply because
I don't have anything better to do. It's come up as a compliance
issue which had been masked by an unrelated problem that was fixed.
I thought the issue caused enough trouble last time ;) I remember we got 
a huge amount of bug reports on that.

So what I suggest is that you send that you send that as feedback to 
the servlet API, and that they put a small errata for the specification.

ServletResponse.setCharacterEncoding/setContentType/setLocale...
* pContainers must communicate the character encoding used for
* the servlet response's writer to the client if the protocol
* provides a way for doing so. In the case of HTTP, the character
* encoding is communicated as part of the codeContent-Type/code
* header for text media types. Note that the character encoding
* cannot be communicated via HTTP headers if the servlet does not
* specify a content type; however, it is still used to encode text
* written via the servlet response's writer.
Reason: Many browsers let the user choose which encoding to apply to
responses that don't declare their encoding, which will result in data
corruption if the response was encoded in ISO-8859-1 and the user
picks an incompatible encoding.
The user can still manually override the charset on its client if it 
wants to do so. I don't see how the specified behavior fixes anything.

ServletResponse.getContentType...:
* If no character encoding has been specified, the
* charset parameter is omitted.
Reason: Allow setLocale() to set the response's char encoding
(corresponding to the locale) if the char encoding has not already
been set by setContentType() or setCharacterEncoding().
You can find corresponding wordings in the servlet spec.
Therefore, we need to add a charset to the Content-Type response 
header if:

- no response encoding has been specified (ie., the return value of
  ServletResponse.getContentType() has no charset), and
- the response is using a writer
My patch did not check for the latter.
Well, this would be a big improvement already (the implementation is 
inefficient, also, but either Bill or me can rework it). People who 
wanted to generate PDFs from JSPs had trouble (but it made sense), now 
it'll be worse. This doesn't seem very useable overall.

Rémy
-
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

2004-07-28 Thread luehe
luehe   2004/07/28 11:52:17

  Modified:http11/src/java/org/apache/coyote/http11
Http11Processor.java
  Log:
  Reverted previous patch, because it would reintroduce the problem of sending
  image/gif; charset=iso-8859-1, which nobody can read.
  
  Revision  ChangesPath
  1.102 +1 -1  
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.101
  retrieving revision 1.102
  diff -u -r1.101 -r1.102
  --- Http11Processor.java  28 Jul 2004 00:43:44 -  1.101
  +++ Http11Processor.java  28 Jul 2004 18:52:17 -  1.102
  @@ -1450,7 +1450,7 @@
   if (!entityBody) {
   response.setContentLength(-1);
   } else {
  -String contentType = response.getContentTypeResponseHeader();
  +String contentType = response.getContentType();
   if (contentType != null) {
   headers.setValue(Content-Type).setString(contentType);
   }
  
  
  

-
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

2004-07-27 Thread luehe
luehe   2004/07/27 17:43:44

  Modified:http11/src/java/org/apache/coyote/http11
Http11Processor.java
  Log:
  Fixed Bugtraq 6152759 (Default charset not included in Content-Type
  response header if no char encoding was specified).
  
  According to the Servlet 2.4 spec, calling:
  
ServletResponse.setContentType(text/html);
  
  must yield these results:
  
ServletResponse.getContentType() - text/html
  
Content-Type response header - text/html;charset=ISO-8859-1
  
  Notice the absence of a charset in the result of getContentType(), but
  its presence (set to the default ISO-8859-1) in the Content-Type
  response header.
  
  Tomcat is currently not including the default charset in the
  Content-Type response header if no char encoding was specified.
  
  Revision  ChangesPath
  1.101 +1 -1  
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.100
  retrieving revision 1.101
  diff -u -r1.100 -r1.101
  --- Http11Processor.java  1 Jun 2004 14:34:22 -   1.100
  +++ Http11Processor.java  28 Jul 2004 00:43:44 -  1.101
  @@ -1450,7 +1450,7 @@
   if (!entityBody) {
   response.setContentLength(-1);
   } else {
  -String contentType = response.getContentType();
  +String contentType = response.getContentTypeResponseHeader();
   if (contentType != null) {
   headers.setValue(Content-Type).setString(contentType);
   }
  
  
  

-
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 InternalInputBuffer.java

2004-06-01 Thread remm
remm2004/06/01 07:34:22

  Modified:http11/src/java/org/apache/coyote/http11
Http11Processor.java InternalInputBuffer.java
  Log:
  - Bug 29166: Tweak expectation handling so that if the expectation isn't satisfied,
we don't attempt to swallow the request's body (with a good client, it shouldn't
have been sent). Hopefully I'm not breaking anything.
  - Test requests (use telnet and a tomcat/tomcat user):
  GET /manager/list HTTP/1.1
  Host: localhost:8080
  Expect: 100-continue
  Content-Length: 10
  
  GET /manager/list HTTP/1.1
  Host: localhost:8080
  Authorization: Basic dG9tY2F0OnRvbWNhdA==
  Expect: 100-continue
  Content-Length: 10
  
  1234567890
  
  Revision  ChangesPath
  1.100 +23 -11
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.99
  retrieving revision 1.100
  diff -u -r1.99 -r1.100
  --- Http11Processor.java  30 Mar 2004 21:50:11 -  1.99
  +++ Http11Processor.java  1 Jun 2004 14:34:22 -   1.100
  @@ -171,6 +171,12 @@
   
   
   /**
  + * Is there an expectation ?
  + */
  +protected boolean expectation = false;
  +
  +
  +/**
* List of restricted user agents.
*/
   protected RE[] restrictedUserAgents = null;
  @@ -898,19 +904,15 @@
   // Send a 100 status back if it makes sense (response not committed
   // yet, and client specified an expectation for 100-continue)
   
  -if ((response.isCommitted()) || (!http11))
  +if ((response.isCommitted()) || !expectation)
   return;
   
  -MessageBytes expectMB = 
  -request.getMimeHeaders().getValue(expect);
  -if ((expectMB != null)
  - (expectMB.indexOfIgnoreCase(100-continue, 0) != -1)) {
  -try {
  -outputBuffer.sendAck();
  -} catch (IOException e) {
  -// Set error flag
  -error = true;
  -}
  +inputBuffer.setSwallowInput(true);
  +try {
  +outputBuffer.sendAck();
  +} catch (IOException e) {
  +// Set error flag
  +error = true;
   }
   
   } else if (actionCode == ActionCode.ACTION_CLIENT_FLUSH) {
  @@ -1092,6 +1094,7 @@
   http11 = true;
   http09 = false;
   contentDelimitation = false;
  +expectation = false;
   if (sslSupport != null) {
   request.scheme().setString(https);
   }
  @@ -1134,6 +1137,15 @@
Constants.KEEPALIVE_BYTES) != -1) {
   keepAlive = true;
   }
  +}
  +
  +MessageBytes expectMB = null;
  +if (http11)
  +expectMB = request.getMimeHeaders().getValue(expect);
  +if ((expectMB != null)
  + (expectMB.indexOfIgnoreCase(100-continue, 0) != -1)) {
  +inputBuffer.setSwallowInput(false);
  +expectation = true;
   }
   
   // Check user-agent header
  
  
  
  1.18  +18 -1 
jakarta-tomcat-connectors/http11/src/java/org/apache/coyote/http11/InternalInputBuffer.java
  
  Index: InternalInputBuffer.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-connectors/http11/src/java/org/apache/coyote/http11/InternalInputBuffer.java,v
  retrieving revision 1.17
  retrieving revision 1.18
  diff -u -r1.17 -r1.18
  --- InternalInputBuffer.java  24 Feb 2004 08:50:56 -  1.17
  +++ InternalInputBuffer.java  1 Jun 2004 14:34:22 -   1.18
  @@ -75,6 +75,7 @@
   lastActiveFilter = -1;
   
   parsingHeader = true;
  +swallowInput = true;
   
   }
   
  @@ -111,6 +112,12 @@
   
   
   /**
  + * Swallow input ? (in the case of an expectation)
  + */
  +protected boolean swallowInput;
  +
  +
  +/**
* Pointer to the current read buffer.
*/
   protected byte[] buf;
  @@ -277,6 +284,14 @@
   }
   
   
  +/**
  + * Set the swallow input flag.
  + */
  +public void setSwallowInput(boolean swallowInput) {
  +this.swallowInput = swallowInput;
  +}
  +
  +
   // - Public Methods
   
   
  @@ -295,6 +310,7 @@
   pos = 0;
   lastActiveFilter = -1;
   parsingHeader = true;
  +swallowInput = true;
   
   }
   
  @@ -335,6 +351,7 @@
   pos = 0;
   lastActiveFilter = -1;
   parsingHeader = true;
  +swallowInput = true;
   

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

2004-03-30 Thread hgomez
hgomez  2004/03/30 13:50:11

  Modified:http11/src/java/org/apache/coyote/http11
Http11Processor.java
  Log:
  gzip compression could also be used in HTTP 1.0
  
  Revision  ChangesPath
  1.99  +5 -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.98
  retrieving revision 1.99
  diff -u -r1.98 -r1.99
  --- Http11Processor.java  29 Feb 2004 22:51:56 -  1.98
  +++ Http11Processor.java  30 Mar 2004 21:50:11 -  1.99
  @@ -1333,9 +1333,12 @@
*/
   private boolean isCompressable() {
   
  +// Nope Compression could works in HTTP 1.0 also
  +// cf: mod_deflate
  +
   // Compression only since HTTP 1.1
  -if (! http11)
  -return false;
  +// if (! http11)
  +//return false;
   
   // Check if browser support gzip encoding
   MessageBytes acceptEncodingMB = 
  
  
  

-
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

2004-02-29 Thread remm
remm2004/02/29 14:51:56

  Modified:http11/src/java/org/apache/coyote/http11
Http11Processor.java
  Log:
  - Make sure HexUtils is accessed before some output is made.
  - Ugly fix for bug 27299, until a better one is found. Doing a PA on write is not
a good idea performance wise, though, so this seemed go enough to me
(and similar to the access which occurs in parseHost, while having zero
performance impact).
  
  Revision  ChangesPath
  1.98  +3 -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.97
  retrieving revision 1.98
  diff -u -r1.97 -r1.98
  --- Http11Processor.java  24 Feb 2004 08:50:56 -  1.97
  +++ Http11Processor.java  29 Feb 2004 22:51:56 -  1.98
  @@ -94,6 +94,9 @@
   
   initializeFilters();
   
  +// Cause loading of HexUtils
  +int foo = HexUtils.DEC[0];
  +
   }
   
   
  
  
  

-
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

2004-02-04 Thread remm
remm2004/02/04 08:32:50

  Modified:http11/src/java/org/apache/coyote/http11
Http11Processor.java
  Log:
  - Make sure a filter is always added in all cases. Likely the case where
there was an error wasn't handled well. Bug 26662.
  
  Revision  ChangesPath
  1.96  +3 -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.95
  retrieving revision 1.96
  diff -u -r1.95 -r1.96
  --- Http11Processor.java  22 Jan 2004 18:26:52 -  1.95
  +++ Http11Processor.java  4 Feb 2004 16:32:50 -   1.96
  @@ -1499,6 +1499,9 @@
   (outputFilters[Constants.CHUNKED_FILTER]);
   contentDelimitation = true;
   response.addHeader(Transfer-Encoding, chunked);
  +} else {
  +outputBuffer.addActiveFilter
  +(outputFilters[Constants.IDENTITY_FILTER]);
   }
   }
   
  
  
  

-
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

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

2004-01-14 Thread remm
remm2004/01/14 03:12:50

  Modified:http11/src/java/org/apache/coyote/http11
Http11Processor.java
  Log:
  - Correctly initialize arrays (Java is not C ;-) ).
  - Also add some logging.
  
  Revision  ChangesPath
  1.94  +33 -24
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.93
  retrieving revision 1.94
  diff -u -r1.93 -r1.94
  --- Http11Processor.java  8 Jan 2004 13:08:13 -   1.93
  +++ Http11Processor.java  14 Jan 2004 11:12:50 -  1.94
  @@ -389,8 +389,11 @@
   public void addNoCompressionUserAgent(String userAgent) {
   try {
   RE nRule = new RE(userAgent);
  -addREArray(noCompressionUserAgents, new RE(userAgent));
  -} catch (RESyntaxException ree) {}
  +noCompressionUserAgents = 
  +addREArray(noCompressionUserAgents, nRule);
  +} catch (RESyntaxException ree) {
  +log.error(Error parsing regular expression:  + userAgent, ree);
  +}
   }
   
   
  @@ -428,7 +431,8 @@
* @param userAgent user-agent string
*/
   public void addCompressableMimeType(String mimeType) {
  -addStringArray(compressableMimeTypes, mimeType);
  +compressableMimeTypes = 
  +addStringArray(compressableMimeTypes, mimeType);
   }
   
   
  @@ -485,10 +489,10 @@
   } else if (obj instanceof OutputFilter) {
   outputBuffer.addFilter((OutputFilter) obj);
   } else {
  -// Not a valid filter: log and ignore
  +log.warn(Unknown filter:  + className);
   }
   } catch (Exception e) {
  -// Log and ignore
  +log.error(Error intializing filter:  + className, e);
   }
   }
   
  @@ -499,18 +503,19 @@
* @param sArray the StringArray 
* @param value string
*/
  -private void addStringArray(String sArray[], String value) {
  +private String[] addStringArray(String sArray[], String value) {
  +String[] result = null;
   if (sArray == null) {
  -sArray = new String[1];
  -sArray[0] = value;
  +result = new String[1];
  +result[0] = value;
   }
   else {
  -String[] results = new String[sArray.length + 1];
  +result = new String[sArray.length + 1];
   for (int i = 0; i  sArray.length; i++)
  -results[i] = sArray[i];
  -results[sArray.length] = value;
  -sArray = results;
  +result[i] = sArray[i];
  +result[sArray.length] = value;
   }
  +return result;
   }
   
   
  @@ -520,18 +525,19 @@
* @param rArray the REArray 
* @param value Obj
*/
  -private void addREArray(RE rArray[], RE value) {
  +private RE[] addREArray(RE rArray[], RE value) {
  +RE[] result = null;
   if (rArray == null) {
  -rArray = new RE[1];
  -rArray[0] = value;
  -}
  +result = new RE[1];
  +result[0] = value;
  +}
   else {
  -RE[] results = new RE[rArray.length + 1];
  +result = new RE[rArray.length + 1];
   for (int i = 0; i  rArray.length; i++)
  -results[i] = rArray[i];
  -results[rArray.length] = value;
  -rArray = results;
  +result[i] = rArray[i];
  +result[rArray.length] = value;
   }
  +return result;
   }
   
   
  @@ -579,8 +585,10 @@
   public void addRestrictedUserAgent(String userAgent) {
   try {
   RE nRule = new RE(userAgent);
  -addREArray(restrictedUserAgents, new RE(userAgent));
  -} catch (RESyntaxException ree) {}
  +restrictedUserAgents = addREArray(restrictedUserAgents, nRule);
  +} catch (RESyntaxException ree) {
  +log.error(Error parsing regular expression:  + userAgent, ree);
  +}
   }
   
   
  @@ -593,6 +601,7 @@
   this.restrictedUserAgents = restrictedUserAgents;
   }
   
  +
   /**
* Set restricted user agent list (which will downgrade the connector
* to HTTP/1.0 mode). List contains users agents separated by ',' :
  @@ -601,8 +610,8 @@
*/
   public void setRestrictedUserAgents(String restrictedUserAgents) {
   if (restrictedUserAgents != null) {
  -StringTokenizer st = new StringTokenizer(restrictedUserAgents, ,);
  -
  +StringTokenizer st = 
  +new 

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

2004-01-14 Thread Henri Gomez
[EMAIL PROTECTED] a écrit :

remm2004/01/14 03:12:50

  Modified:http11/src/java/org/apache/coyote/http11
Http11Processor.java
  Log:
  - Correctly initialize arrays (Java is not C ;-) ).
Arg, my fault :)

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


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

2004-01-14 Thread Remy Maucherat
Henri Gomez wrote:
[EMAIL PROTECTED] a écrit :

remm2004/01/14 03:12:50

  Modified:http11/src/java/org/apache/coyote/http11
Http11Processor.java
  Log:
  - Correctly initialize arrays (Java is not C ;-) ).
 
Arg, my fault :)
The feature works very well. Very good :)

Rémy



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


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

2004-01-14 Thread Henri Gomez
Remy Maucherat a écrit :

Henri Gomez wrote:

[EMAIL PROTECTED] a écrit :

remm2004/01/14 03:12:50

  Modified:http11/src/java/org/apache/coyote/http11
Http11Processor.java
  Log:
  - Correctly initialize arrays (Java is not C ;-) ).
 
Arg, my fault :)


The feature works very well. Very good :)

Thanks, BTW it was needed by specs and also by respect to
our great HTTPD 2.0 ;)
-
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

2004-01-08 Thread remm
remm2004/01/08 05:08:13

  Modified:http11/src/java/org/apache/coyote/http11
Http11Processor.java
  Log:
  - Report an exception which occurred during a low level flush.
  
  Revision  ChangesPath
  1.93  +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.92
  retrieving revision 1.93
  diff -u -r1.92 -r1.93
  --- Http11Processor.java  2 Dec 2003 23:01:01 -   1.92
  +++ Http11Processor.java  8 Jan 2004 13:08:13 -   1.93
  @@ -946,6 +946,7 @@
   } catch (IOException e) {
   // Set error flag
   error = true;
  +response.setErrorException(e);
   }
   
   } else if (actionCode == ActionCode.ACTION_CLOSE) {
  
  
  

-
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

2003-12-02 Thread jfarcand
jfarcand2003/12/02 08:27:11

  Modified:coyote/src/java/org/apache/coyote Request.java
ActionCode.java
   catalina/src/share/org/apache/coyote/tomcat5
CoyoteRequest.java
   http11/src/java/org/apache/coyote/http11
Http11Processor.java
  Log:
  Implement getLocalPort using ActionCode instead of getServerPort. Associate 1 
ActionCode for each getXXX method.
  
  Please review.
  
  Revision  ChangesPath
  1.24  +11 -1 
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.23
  retrieving revision 1.24
  diff -u -r1.23 -r1.24
  --- Request.java  7 Sep 2003 18:03:21 -   1.23
  +++ Request.java  2 Dec 2003 16:27:11 -   1.24
  @@ -136,6 +136,7 @@
   private String localHost;
   
   private int remotePort;
  +private int localPort;
   
   private MessageBytes schemeMB = new MessageBytes();
   
  @@ -303,7 +304,14 @@
   public void setRemotePort(int port){
   this.remotePort = port;
   }
  -
  +
  +public int getLocalPort(){
  +return localPort;
  +}
  +
  +public void setLocalPort(int port){
  +this.localPort = port;
  +}
   
   //  encoding/type 
   
  @@ -502,6 +510,8 @@
   headers.recycle();
   serverNameMB.recycle();
   serverPort=-1;
  +localPort = -1;
  +remotePort = -1;
   
cookies.recycle();
   parameters.recycle();
  
  
  
  1.14  +17 -0 
jakarta-tomcat-connectors/coyote/src/java/org/apache/coyote/ActionCode.java
  
  Index: ActionCode.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-connectors/coyote/src/java/org/apache/coyote/ActionCode.java,v
  retrieving revision 1.13
  retrieving revision 1.14
  diff -u -r1.13 -r1.14
  --- ActionCode.java   1 Oct 2003 07:50:29 -   1.13
  +++ ActionCode.java   2 Dec 2003 16:27:11 -   1.14
  @@ -135,7 +135,24 @@
* (including forcing a re-handshake if necessary)
*/
   public static final ActionCode ACTION_REQ_SSL_CERTIFICATE = new ActionCode(15);
  +
  +
  +/**
  + * Callback for lazy evaluation - socket remote port.
  + **/
  +public static final ActionCode ACTION_REQ_REMOTEPORT_ATTRIBUTE = new 
ActionCode(16);
   
  +
  +/**
  + * Callback for lazy evaluation - socket local port.
  + **/
  +public static final ActionCode ACTION_REQ_LOCALPORT_ATTRIBUTE = new 
ActionCode(17);
  +
  +
  +/**
  + * Callback for lazy evaluation - local address.
  + **/
  +public static final ActionCode ACTION_REQ_LOCAL_ADDR_ATTRIBUTE = new 
ActionCode(18);
   
   // --- Constructors
   int code;
  
  
  
  1.24  +23 -7 
jakarta-tomcat-catalina/catalina/src/share/org/apache/coyote/tomcat5/CoyoteRequest.java
  
  Index: CoyoteRequest.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/coyote/tomcat5/CoyoteRequest.java,v
  retrieving revision 1.23
  retrieving revision 1.24
  diff -u -r1.23 -r1.24
  --- CoyoteRequest.java20 Nov 2003 20:56:28 -  1.23
  +++ CoyoteRequest.java2 Dec 2003 16:27:11 -   1.24
  @@ -366,6 +366,11 @@
   
   
   /**
  + * Local port
  + */
  +protected int localPort = -1;
  +
  +/**
* Remote address.
*/
   protected String remoteAddr = null;
  @@ -420,6 +425,7 @@
   remoteAddr = null;
   remoteHost = null;
   remotePort = -1;
  +localPort = -1;
   localAddr = null;
   
   attributes.clear();
  @@ -646,6 +652,7 @@
   remoteHost = null;
   remoteAddr = null;
   remotePort = -1;
  +localPort = -1;
   localAddr = null;
   }
   
  @@ -1236,7 +1243,7 @@
   remotePort = socket.getPort();
   } else {
   coyoteRequest.action
  -(ActionCode.ACTION_REQ_HOST_ATTRIBUTE, coyoteRequest);
  +(ActionCode.ACTION_REQ_REMOTEPORT_ATTRIBUTE, coyoteRequest);
   remotePort = coyoteRequest.getRemotePort();
   }
   }
  @@ -1262,7 +1269,7 @@
   localAddr = inet.getHostAddress();
   } else {
   coyoteRequest.action
  -(ActionCode.ACTION_REQ_HOST_ATTRIBUTE, coyoteRequest);
  +(ActionCode.ACTION_REQ_LOCAL_ADDR_ATTRIBUTE, coyoteRequest);
 

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

2003-12-02 Thread Jeanfrancois Arcand


Remy Maucherat wrote:

[EMAIL PROTECTED] wrote:

jfarcand2003/12/02 08:27:11

Modified:coyote/src/java/org/apache/coyote Request.java 
ActionCode.java catalina/src/share/org/apache/coyote/tomcat5 
CoyoteRequest.java http11/src/java/org/apache/coyote/http11 
Http11Processor.java Log: Implement getLocalPort using ActionCode
instead of getServerPort. Associate 1 ActionCode for each getXXX
method.

Please review.


I'll have to vote -0 for implementing getLocalPort as mandated in the
specification, since I think this is a huge mistake, and the spec
authors intention is misinterpreted (or they didn't think about all 
the consequences of the wording they used, thinking only about the 
case of a server without any proxies, or using an AJP-like scheme). 
BTW, I also think your patch has a sky high likelihood of breaking the 
JK 2 connector ;-)
Can you explain how? The only changes I did was to remove the code 
associated with remoteAddr (which was duplicated and useless IMO).

I said it would be ok, yesterday, but I changed my mind, as this looks 
wrong.
If Bill votes -1 to this, I'll change my vote to -1.
I should start reverting my patch ;-)

The problem is that this call is likely intended to allow users to build
URLs to the server. Actually, this won't work, since the server may not
be accessible with the connector hostname or port. What actually should
be returned is what is in the Host header (HTTP/1.0 is a broken
spec, since it can't possibly work when behind a reverse proxy).
Otherwise, we're returning completely useless information to the user,
and the getLocalPort is simply useless.
Make sense.That will also apply to LocalAddr too then. What the specs 
states is:

 public java.lang.String getLocalAddr()
Returns the Internet Protocol (IP) address of the interface on
which the request  was received.
 public int getLocalPort()
Returns the Internet Protocol (IP) port number of the interface
on which the request was received.
I think parsing/using the Host header is the way to go, since it will 
work with/without proxy. Can I -1 on myself ;-)

-- Jeanfrancois

Note: Compliant HTTP/1.1 clients must send correct Host header, and 
proxy servers are not allowed to modify them.

Rémy



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



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


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

2003-12-02 Thread Remy Maucherat
Jeanfrancois Arcand wrote:
Remy Maucherat wrote:

[EMAIL PROTECTED] wrote:

jfarcand2003/12/02 08:27:11

Modified:coyote/src/java/org/apache/coyote Request.java 
ActionCode.java catalina/src/share/org/apache/coyote/tomcat5 
CoyoteRequest.java http11/src/java/org/apache/coyote/http11 
Http11Processor.java Log: Implement getLocalPort using ActionCode
instead of getServerPort. Associate 1 ActionCode for each getXXX
method.

Please review.
I'll have to vote -0 for implementing getLocalPort as mandated in the
specification, since I think this is a huge mistake, and the spec
authors intention is misinterpreted (or they didn't think about all 
the consequences of the wording they used, thinking only about the 
case of a server without any proxies, or using an AJP-like scheme). 
BTW, I also think your patch has a sky high likelihood of breaking the 
JK 2 connector ;-)
Can you explain how? The only changes I did was to remove the code 
associated with remoteAddr (which was duplicated and useless IMO).
I don't see how JK would set the localPort field (since the new action 
isn't handled yet), so I thought it would always return -1. Maybe I'm 
wrong, I didn't try it.

Make sense.That will also apply to LocalAddr too then. What the specs 
states is:

 public java.lang.String getLocalAddr()
Returns the Internet Protocol (IP) address of the interface on
which the request  was received.
 public int getLocalPort()
Returns the Internet Protocol (IP) port number of the interface
on which the request was received.
I think parsing/using the Host header is the way to go, since it will 
work with/without proxy. Can I -1 on myself ;-)
I don't know, maybe you can talk to the Servlet spec people first to see 
what they have to say on this issue ?

Rémy



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


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

2003-12-02 Thread Hans Bergsten
Remy Maucherat wrote:
[...]
Now the big question is actually what the new getLocalPort call should 
return. If you need an extra localPort (and its friend getLocalName - 
did you notice the getLocalName() call was always returning whatever 
hostname was in the host header) field in the request because it doesn't 
correspond to vhosting (I consider it would be yet another major blunder 
of the Servlet spec, but what can I do ...), then so be it.
The getLocalXXX() methods are intended to provide information about
where the request was _recieved_ by the container, rather than where
it was _sent_ by the client, which is useful information for some types
of applications, for instance to detect if there's any vhosting
involved.
So you have three sets of methods for getting address/port info.
* Where the request was received (server socket):
getLocalName()
getLocalPort()
getLocalAddr()
* Where the request was sent (Host header info):
getServerName()
getServerPort()
* Where the request comes from (client socket):
getRemoteName()
getRemotePort()
getRemoteAddr()
With an HTTP/1.1 request with a Host header foo.com value, proxied
through Apache to Tomcat listening on port 8005, from a client (or a
proxy) at 4.62.132.17 (bar.com) port 1766, the methods should return
these values:
getLocalName() - localhost (or some other local interface)
getLocalPort() - 8005
getLocalAddr() - 127.0.0.1 (or some other local interface)
getServerName() - foo.com
getServerPort() - 80
getRemoteName() - bar.com
getRemotePort() - 1766
getRemoteAddr() - 4.62.132.17
Without proxying through Apache, a Host header localhost:8080
value and Tomcat listening on port 8080, it would look like this
instead:
getLocalName() - localhost
getLocalPort() - 8080
getLocalAddr() - 127.0.0.1
getServerName() - localhost
getServerPort() - 8080
getRemoteName() - bar.com
getRemotePort() - 1766
getRemoteAddr() - 4.62.132.17
HTH,
Hans
--
Hans Bergsten[EMAIL PROTECTED]
Gefion Software   http://www.gefionsoftware.com/
Author of O'Reilly's JavaServer Pages, covering JSP 2.0 and JSTL 1.1
Details athttp://TheJSPBook.com/
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


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

2003-12-02 Thread Bill Barker

- Original Message -
From: Remy Maucherat [EMAIL PROTECTED]
To: Tomcat Developers List [EMAIL PROTECTED]
Sent: Tuesday, December 02, 2003 8:59 AM
Subject: Re: cvs commit:
jakarta-tomcat-connectors/http11/src/java/org/apache/coyote/http11
Http11Processor.java


 [EMAIL PROTECTED] wrote:

  jfarcand2003/12/02 08:27:11
 
  Modified:coyote/src/java/org/apache/coyote Request.java
  ActionCode.java catalina/src/share/org/apache/coyote/tomcat5
  CoyoteRequest.java http11/src/java/org/apache/coyote/http11
  Http11Processor.java Log: Implement getLocalPort using ActionCode
  instead of getServerPort. Associate 1 ActionCode for each getXXX
  method.
 
  Please review.

 I'll have to vote -0 for implementing getLocalPort as mandated in the
 specification, since I think this is a huge mistake, and the spec
 authors intention is misinterpreted (or they didn't think about all the
 consequences of the wording they used, thinking only about the case of a
 server without any proxies, or using an AJP-like scheme). BTW, I also
 think your patch has a sky high likelihood of breaking the JK 2
 connector ;-)

 I said it would be ok, yesterday, but I changed my mind, as this looks
 wrong.
 If Bill votes -1 to this, I'll change my vote to -1.

I'm fine with the patch (although not a great fan of getLocalPort :).


 The problem is that this call is likely intended to allow users to build
 URLs to the server. Actually, this won't work, since the server may not
 be accessible with the connector hostname or port. What actually should
 be returned is what is in the Host header (HTTP/1.0 is a broken
 spec, since it can't possibly work when behind a reverse proxy).
 Otherwise, we're returning completely useless information to the user,
 and the getLocalPort is simply useless.

Users should be using getServerPort to build URLs to the server.  The
problem with yesterdays patch is that it broke getServerPort (which is
defined to be the value of the Host header).  I agree that getLocalPort is
simply useless, but it's in the spec so we have to implement it :).  About
the only thing that it is good for is to grant rights to requests coming in
on one connector, but not on another (which points to a bad design).


 Note: Compliant HTTP/1.1 clients must send correct Host header, and
 proxy servers are not allowed to modify them.

 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]

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

2003-12-02 Thread Bill Barker

- Original Message -
From: Remy Maucherat [EMAIL PROTECTED]
To: Tomcat Developers List [EMAIL PROTECTED]
Sent: Tuesday, December 02, 2003 9:47 AM
Subject: Re: cvs commit:
jakarta-tomcat-connectors/http11/src/java/org/apache/coyote/http11
Http11Processor.java


 Jeanfrancois Arcand wrote:
  Remy Maucherat wrote:
 
  [EMAIL PROTECTED] wrote:
 
  jfarcand2003/12/02 08:27:11
 
  Modified:coyote/src/java/org/apache/coyote Request.java
  ActionCode.java catalina/src/share/org/apache/coyote/tomcat5
  CoyoteRequest.java http11/src/java/org/apache/coyote/http11
  Http11Processor.java Log: Implement getLocalPort using ActionCode
  instead of getServerPort. Associate 1 ActionCode for each getXXX
  method.
 
  Please review.
 
  I'll have to vote -0 for implementing getLocalPort as mandated in the
  specification, since I think this is a huge mistake, and the spec
  authors intention is misinterpreted (or they didn't think about all
  the consequences of the wording they used, thinking only about the
  case of a server without any proxies, or using an AJP-like scheme).
  BTW, I also think your patch has a sky high likelihood of breaking the
  JK 2 connector ;-)
 
  Can you explain how? The only changes I did was to remove the code
  associated with remoteAddr (which was duplicated and useless IMO).

 I don't see how JK would set the localPort field (since the new action
 isn't handled yet), so I thought it would always return -1. Maybe I'm
 wrong, I didn't try it.

Yes, the JK connector is going to need some changes to support this.
However they should be pretty minor.


  Make sense.That will also apply to LocalAddr too then. What the specs
  states is:
 
   public java.lang.String getLocalAddr()
  Returns the Internet Protocol (IP) address of the interface
on
  which the request  was received.
 
   public int getLocalPort()
  Returns the Internet Protocol (IP) port number of the
interface
  on which the request was received.
 
  I think parsing/using the Host header is the way to go, since it will
  work with/without proxy. Can I -1 on myself ;-)

 I don't know, maybe you can talk to the Servlet spec people first to see
 what they have to say on this issue ?

 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]

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

2003-12-02 Thread Jeanfrancois Arcand


Hans Bergsten wrote:

Remy Maucherat wrote:

[...]
Now the big question is actually what the new getLocalPort call 
should return. If you need an extra localPort (and its friend 
getLocalName - did you notice the getLocalName() call was always 
returning whatever hostname was in the host header) field in the 
request because it doesn't correspond to vhosting (I consider it 
would be yet another major blunder of the Servlet spec, but what can 
I do ...), then so be it.


The getLocalXXX() methods are intended to provide information about
where the request was _recieved_ by the container, rather than where
it was _sent_ by the client, which is useful information for some types
of applications, for instance to detect if there's any vhosting
involved.
So you have three sets of methods for getting address/port info.
* Where the request was received (server socket):
getLocalName()
getLocalPort()
getLocalAddr()
* Where the request was sent (Host header info):
getServerName()
getServerPort()
* Where the request comes from (client socket):
getRemoteName()
getRemotePort()
getRemoteAddr()
With an HTTP/1.1 request with a Host header foo.com value, proxied
through Apache to Tomcat listening on port 8005, from a client (or a
proxy) at 4.62.132.17 (bar.com) port 1766, the methods should return
these values:
getLocalName() - localhost (or some other local interface)
getLocalPort() - 8005
getLocalAddr() - 127.0.0.1 (or some other local interface)
getServerName() - foo.com
getServerPort() - 80
getRemoteName() - bar.com
getRemotePort() - 1766
getRemoteAddr() - 4.62.132.17
Without proxying through Apache, a Host header localhost:8080
value and Tomcat listening on port 8080, it would look like this
instead:
getLocalName() - localhost
getLocalPort() - 8080
getLocalAddr() - 127.0.0.1
getServerName() - localhost
getServerPort() - 8080
getRemoteName() - bar.com
getRemotePort() - 1766
getRemoteAddr() - 4.62.132.17
Then today's commit implemented that behaviour except for getLocalName(0 
which is still broken.Will fix it). Before getLocalPort() was calling 
getServerPort() (my mistake back in 03/05). I think the spec should be 
clarified with an example like this one ;-)

Thanks for the clarification.

-- Jeanfrancois




HTH,
Hans


-
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

2003-12-02 Thread jfarcand
jfarcand2003/12/02 15:01:01

  Modified:coyote/src/java/org/apache/coyote Request.java
ActionCode.java
   catalina/src/share/org/apache/coyote/tomcat5
CoyoteRequest.java
   http11/src/java/org/apache/coyote/http11
Http11Processor.java
  Log:
  Add proper getLocalName implementation.
  
  Please review
  
  Revision  ChangesPath
  1.25  +5 -1  
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.24
  retrieving revision 1.25
  diff -u -r1.24 -r1.25
  --- Request.java  2 Dec 2003 16:27:11 -   1.24
  +++ Request.java  2 Dec 2003 23:01:00 -   1.25
  @@ -149,7 +149,7 @@
   
   // remote address/host
   private MessageBytes remoteAddrMB = new MessageBytes();
  -private MessageBytes localAddr = new MessageBytes();
  +private MessageBytes localNameMB = new MessageBytes();
   private MessageBytes remoteHostMB = new MessageBytes();
   private MessageBytes localAddrMB = new MessageBytes();

  @@ -284,6 +284,10 @@
   public MessageBytes remoteHost() {
return remoteHostMB;
   }
  +
  +public MessageBytes localName() {
  + return localNameMB;
  +}
   
   public MessageBytes localAddr() {
return localAddrMB;
  
  
  
  1.15  +6 -0  
jakarta-tomcat-connectors/coyote/src/java/org/apache/coyote/ActionCode.java
  
  Index: ActionCode.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-connectors/coyote/src/java/org/apache/coyote/ActionCode.java,v
  retrieving revision 1.14
  retrieving revision 1.15
  diff -u -r1.14 -r1.15
  --- ActionCode.java   2 Dec 2003 16:27:11 -   1.14
  +++ ActionCode.java   2 Dec 2003 23:01:00 -   1.15
  @@ -153,6 +153,12 @@
* Callback for lazy evaluation - local address.
**/
   public static final ActionCode ACTION_REQ_LOCAL_ADDR_ATTRIBUTE = new 
ActionCode(18);
  +
  +
  +/**
  + * Callback for lazy evaluation - local address.
  + **/
  +public static final ActionCode ACTION_REQ_LOCAL_NAME_ATTRIBUTE = new 
ActionCode(19);
   
   // --- Constructors
   int code;
  
  
  
  1.25  +23 -5 
jakarta-tomcat-catalina/catalina/src/share/org/apache/coyote/tomcat5/CoyoteRequest.java
  
  Index: CoyoteRequest.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/coyote/tomcat5/CoyoteRequest.java,v
  retrieving revision 1.24
  retrieving revision 1.25
  diff -u -r1.24 -r1.25
  --- CoyoteRequest.java2 Dec 2003 16:27:11 -   1.24
  +++ CoyoteRequest.java2 Dec 2003 23:01:01 -   1.25
  @@ -391,7 +391,13 @@
* Local address
*/
   protected String localAddr = null;
  +
   
  +/**
  + * Local address
  + */
  +protected String localName = null;
  +
   /** After the request is mapped to a ServletContext, we can also
* map it to a logger.
*/ 
  @@ -427,6 +433,7 @@
   remotePort = -1;
   localPort = -1;
   localAddr = null;
  +localName = null;
   
   attributes.clear();
   notes.clear();
  @@ -654,6 +661,7 @@
   remotePort = -1;
   localPort = -1;
   localAddr = null;
  +localName = null;
   }
   
   
  @@ -1255,7 +1263,17 @@
* which the request was received.
*/
   public String getLocalName(){
  -return getServerName();
  +if (localName == null) {
  +if (socket != null) {
  +InetAddress inet = socket.getLocalAddress();
  +localAddr = inet.getHostName();
  +} else {
  +coyoteRequest.action
  +(ActionCode.ACTION_REQ_LOCAL_NAME_ATTRIBUTE, coyoteRequest);
  +localName = coyoteRequest.localName().toString();
  +}
  +}
  +return localName;
   }
   
   /**
  
  
  
  1.92  +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.91
  retrieving revision 1.92
  diff -u -r1.91 -r1.92
  --- Http11Processor.java  2 Dec 2003 16:27:11 -   1.91
  +++ Http11Processor.java  2 Dec 2003 23:01:01 -   1.92
  @@ -239,9 +239,17 @@
* Remote 

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

2003-12-02 Thread Remy Maucherat
Hans Bergsten wrote:
Remy Maucherat wrote:

[...]
Now the big question is actually what the new getLocalPort call should 
return. If you need an extra localPort (and its friend getLocalName - 
did you notice the getLocalName() call was always returning whatever 
hostname was in the host header) field in the request because it 
doesn't correspond to vhosting (I consider it would be yet another 
major blunder of the Servlet spec, but what can I do ...), then so be it.
The getLocalXXX() methods are intended to provide information about
where the request was _recieved_ by the container, rather than where
it was _sent_ by the client, which is useful information for some types
of applications, for instance to detect if there's any vhosting
involved.
So proxying would be detected as vhosting. I think it would indicate if 
the server is a pure standalone server, but that's it.

So you have three sets of methods for getting address/port info.
* Where the request was received (server socket):
getLocalName()
getLocalPort()
getLocalAddr()
* Where the request was sent (Host header info):
getServerName()
getServerPort()
* Where the request comes from (client socket):
getRemoteName()
getRemotePort()
getRemoteAddr()
With an HTTP/1.1 request with a Host header foo.com value, proxied
through Apache to Tomcat listening on port 8005, from a client (or a
proxy) at 4.62.132.17 (bar.com) port 1766, the methods should return
these values:
getLocalName() - localhost (or some other local interface)
getLocalPort() - 8005
getLocalAddr() - 127.0.0.1 (or some other local interface)
getServerName() - foo.com
getServerPort() - 80
getRemoteName() - bar.com
getRemotePort() - 1766
getRemoteAddr() - 4.62.132.17
Without proxying through Apache, a Host header localhost:8080
value and Tomcat listening on port 8080, it would look like this
instead:
getLocalName() - localhost
getLocalPort() - 8080
getLocalAddr() - 127.0.0.1
getServerName() - localhost
getServerPort() - 8080
getRemoteName() - bar.com
getRemotePort() - 1766
getRemoteAddr() - 4.62.132.17
This will likely confuse users a bit. If it's as intended, then fine :)

Remy



-
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

2003-12-01 Thread jfarcand
jfarcand2003/12/01 12:44:14

  Modified:http11/src/java/org/apache/coyote/http11
Http11Processor.java
  Log:
  Use the socket info instead of hardcoded value. HttpServletRequest.getLocalPort() is 
currently broken if the port are not the default one.
  
  Revision  ChangesPath
  1.89  +4 -4  
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.88
  retrieving revision 1.89
  diff -u -r1.88 -r1.89
  --- Http11Processor.java  21 Nov 2003 21:10:21 -  1.88
  +++ Http11Processor.java  1 Dec 2003 20:44:14 -   1.89
  @@ -1294,11 +1294,11 @@
   
   if (colonPos  0) {
   if (sslSupport == null) {
  -// 80 - Default HTTTP port
  -request.setServerPort(80);
  +// Default HTTTP port
  +request.setServerPort(socket.getLocalPort());
   } else {
  -// 443 - Default HTTPS port
  -request.setServerPort(443);
  +// Default HTTPS port
  +request.setServerPort(socket.getLocalPort());
   }
   request.serverName().setChars(hostNameC, 0, valueL);
   } else {
  
  
  

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



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

2003-12-01 Thread Remy Maucherat
[EMAIL PROTECTED] wrote:

jfarcand2003/12/01 12:44:14

Modified:http11/src/java/org/apache/coyote/http11 
Http11Processor.java Log: Use the socket info instead of hardcoded
value. HttpServletRequest.getLocalPort() is currently broken if the
port are not the default one.
This looks wrong. I am almost certain this was on purpose. These must 
return the default value for the protocol, not the values actually used 
by the socket.

Remy



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


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

2003-12-01 Thread Jeanfrancois Arcand


Remy Maucherat wrote:

[EMAIL PROTECTED] wrote:

jfarcand2003/12/01 12:44:14

Modified:http11/src/java/org/apache/coyote/http11 
Http11Processor.java Log: Use the socket info instead of hardcoded
value. HttpServletRequest.getLocalPort() is currently broken if the
port are not the default one.


This looks wrong. I am almost certain this was on purpose. These must 
return the default value for the protocol, not the values actually 
used by the socket.
Humm. Then maybe the way HttpServletRequest.getLocalPort() is 
implemented is wrong. Can socket.getLocalPort() returns something 
different that 80 if the connector supposed to  listen on 80 (maybe I'm 
missing something from the jk side here)

Also we are doing something similar if http 1.0 is used (just above):

// HTTP/1.0
// Default is what the socket tells us. Overriden if a 
host is
// found/parsed
request.setServerPort(socket.getLocalPort());
-- Jeanfrancois


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]


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

2003-12-01 Thread Remy Maucherat
Jeanfrancois Arcand wrote:
Remy Maucherat wrote:

[EMAIL PROTECTED] wrote:

jfarcand2003/12/01 12:44:14

Modified:http11/src/java/org/apache/coyote/http11 
Http11Processor.java Log: Use the socket info instead of hardcoded
value. HttpServletRequest.getLocalPort() is currently broken if the
port are not the default one.
This looks wrong. I am almost certain this was on purpose. These must 
return the default value for the protocol, not the values actually 
used by the socket.
Humm. Then maybe the way HttpServletRequest.getLocalPort() is 
implemented is wrong. Can socket.getLocalPort() returns something 
different that 80 if the connector supposed to  listen on 80 (maybe I'm 
missing something from the jk side here)
I don't remember. I think you should look into the version history. I 
will tomorrow.

Also we are doing something similar if http 1.0 is used (just above):

// HTTP/1.0
// Default is what the socket tells us. Overriden if a 
host is
// found/parsed
request.setServerPort(socket.getLocalPort());
It goes both ways. One possible explanation for that is that this code 
is much less used, and it never got fixed.

Remy



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


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

2003-12-01 Thread Jeanfrancois Arcand


Remy Maucherat wrote:

Jeanfrancois Arcand wrote:

Remy Maucherat wrote:

[EMAIL PROTECTED] wrote:

jfarcand2003/12/01 12:44:14

Modified:http11/src/java/org/apache/coyote/http11 
Http11Processor.java Log: Use the socket info instead of hardcoded
value. HttpServletRequest.getLocalPort() is currently broken if the
port are not the default one.


This looks wrong. I am almost certain this was on purpose. These 
must return the default value for the protocol, not the values 
actually used by the socket.


Humm. Then maybe the way HttpServletRequest.getLocalPort() is 
implemented is wrong. Can socket.getLocalPort() returns something 
different that 80 if the connector supposed to  listen on 80 (maybe 
I'm missing something from the jk side here)


I don't remember. I think you should look into the version history. I 
will tomorrow.
It was added with version 1.23.  Bill ? ;-)

I've just realized that the sslSupport variable is no longer needed (so 
my fix needs to be cleaned).  BTW the test I'm doing is:

telnet localhost 8080
GET /tomcat-test/ServletTest HTTP/1.1
Host: localhost
In the servlet, I'm doing request.getLocalPort(), which always returns 
80. But it works if I do

telnet localhost 8080
GET /tomcat-test/ServletTest HTTP/1.1
Host: localhost:8080
;-)

-- Jeanfrancois


Also we are doing something similar if http 1.0 is used (just above):

// HTTP/1.0
// Default is what the socket tells us. Overriden if a 
host is
// found/parsed
request.setServerPort(socket.getLocalPort());

It goes both ways. One possible explanation for that is that this code 
is much less used, and it never got fixed.

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]


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

2003-12-01 Thread Remy Maucherat
Jeanfrancois Arcand wrote:
Remy Maucherat wrote:

Jeanfrancois Arcand wrote:

Remy Maucherat wrote:

[EMAIL PROTECTED] wrote:

jfarcand2003/12/01 12:44:14

Modified:http11/src/java/org/apache/coyote/http11 
Http11Processor.java Log: Use the socket info instead of hardcoded
value. HttpServletRequest.getLocalPort() is currently broken if the
port are not the default one.
This looks wrong. I am almost certain this was on purpose. These 
must return the default value for the protocol, not the values 
actually used by the socket.
Humm. Then maybe the way HttpServletRequest.getLocalPort() is 
implemented is wrong. Can socket.getLocalPort() returns something 
different that 80 if the connector supposed to  listen on 80 (maybe 
I'm missing something from the jk side here)
I don't remember. I think you should look into the version history. I 
will tomorrow.
It was added with version 1.23.  Bill ? ;-)

I've just realized that the sslSupport variable is no longer needed (so 
my fix needs to be cleaned).  BTW the test I'm doing is:

telnet localhost 8080
GET /tomcat-test/ServletTest HTTP/1.1
Host: localhost
In the servlet, I'm doing request.getLocalPort(), which always returns 
80. But it works if I do

telnet localhost 8080
GET /tomcat-test/ServletTest HTTP/1.1
Host: localhost:8080
;-)
Thanks for the example, I now remember the reason for the code. So I'll 
have to veto your patch.

The rule for HTTP/1.1 is that:
- it should use whatever is specified in the host header
- it should return the protocol default otherwise, since this is the 
same as not specifying anything in the host header

This comes from vhosting. serverName and serverPort must contain teh 
vhosting information.

HTTP/1.0 doesn't have the host header, so the socket is used.

Now the big question is actually what the new getLocalPort call should 
return. If you need an extra localPort (and its friend getLocalName - 
did you notice the getLocalName() call was always returning whatever 
hostname was in the host header) field in the request because it doesn't 
correspond to vhosting (I consider it would be yet another major blunder 
of the Servlet spec, but what can I do ...), then so be it.

Rémy



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


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

2003-12-01 Thread Jeanfrancois Arcand


Remy Maucherat wrote:

Jeanfrancois Arcand wrote:

Remy Maucherat wrote:

Jeanfrancois Arcand wrote:

Remy Maucherat wrote:

[EMAIL PROTECTED] wrote:

jfarcand2003/12/01 12:44:14

Modified:http11/src/java/org/apache/coyote/http11 
Http11Processor.java Log: Use the socket info instead of hardcoded
value. HttpServletRequest.getLocalPort() is currently broken if the
port are not the default one.


This looks wrong. I am almost certain this was on purpose. These 
must return the default value for the protocol, not the values 
actually used by the socket.


Humm. Then maybe the way HttpServletRequest.getLocalPort() is 
implemented is wrong. Can socket.getLocalPort() returns something 
different that 80 if the connector supposed to  listen on 80 (maybe 
I'm missing something from the jk side here)


I don't remember. I think you should look into the version history. 
I will tomorrow.


It was added with version 1.23.  Bill ? ;-)

I've just realized that the sslSupport variable is no longer needed 
(so my fix needs to be cleaned).  BTW the test I'm doing is:

telnet localhost 8080
GET /tomcat-test/ServletTest HTTP/1.1
Host: localhost
In the servlet, I'm doing request.getLocalPort(), which always 
returns 80. But it works if I do

telnet localhost 8080
GET /tomcat-test/ServletTest HTTP/1.1
Host: localhost:8080
;-)


Thanks for the example, I now remember the reason for the code. So 
I'll have to veto your patch.

The rule for HTTP/1.1 is that:
- it should use whatever is specified in the host header
- it should return the protocol default otherwise, since this is the 
same as not specifying anything in the host header

This comes from vhosting. serverName and serverPort must contain teh 
vhosting information.

HTTP/1.0 doesn't have the host header, so the socket is used.

Now the big question is actually what the new getLocalPort call should 
return. If you need an extra localPort (and its friend getLocalName - 
did you notice the getLocalName() call was always returning whatever 
hostname was in the host header) field in the request because it 
doesn't correspond to vhosting (I consider it would be yet another 
major blunder of the Servlet spec, but what can I do ...), then so be it.


:-( OK I will revert the fix and see what I can do with the Servlet spec 
(and try to see if we can do something in another place that will not 
impact the current code). 

-- Jeanfrancois

Rémy



-
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

2003-12-01 Thread jfarcand
jfarcand2003/12/01 15:58:53

  Modified:http11/src/java/org/apache/coyote/http11
Http11Processor.java
  Log:
  Revert my last commit based on Remy's feedback.
  
  Revision  ChangesPath
  1.90  +4 -4  
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.89
  retrieving revision 1.90
  diff -u -r1.89 -r1.90
  --- Http11Processor.java  1 Dec 2003 20:44:14 -   1.89
  +++ Http11Processor.java  1 Dec 2003 23:58:53 -   1.90
  @@ -1294,11 +1294,11 @@
   
   if (colonPos  0) {
   if (sslSupport == null) {
  -// Default HTTTP port
  -request.setServerPort(socket.getLocalPort());
  +// 80 - Default HTTTP port
  +request.setServerPort(80);
   } else {
  -// Default HTTPS port
  -request.setServerPort(socket.getLocalPort());
  +// 443 - Default HTTPS port
  +request.setServerPort(443);
   }
   request.serverName().setChars(hostNameC, 0, valueL);
   } else {
  
  
  

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



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

2003-12-01 Thread Bill Barker

- Original Message -
From: [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Monday, December 01, 2003 12:44 PM
Subject: cvs commit:
jakarta-tomcat-connectors/http11/src/java/org/apache/coyote/http11
Http11Processor.java


 jfarcand2003/12/01 12:44:14

   Modified:http11/src/java/org/apache/coyote/http11
 Http11Processor.java
   Log:
   Use the socket info instead of hardcoded value.
HttpServletRequest.getLocalPort() is currently broken if the port are not
the default one.


-1 for the patch.  It breaks NATs, proxies, etc.  It also breaks the
servlet-spec for ServletRequest.getServerPort.


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/http11/src/java/org/apache/coyote/http11 Http11Processor.java

2003-11-21 Thread amyroh
amyroh  2003/11/21 13:10:22

  Modified:http11/src/java/org/apache/coyote/http11
Http11Processor.java
  Log:
  Fix NPE - was thrown from org.apache.coyote.RequestInfo.getRemoteAddr when getting 
remoteAddr via JMX.
  
  Revision  ChangesPath
  1.88  +18 -9 
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.87
  retrieving revision 1.88
  diff -u -r1.87 -r1.88
  --- Http11Processor.java  17 Nov 2003 09:42:40 -  1.87
  +++ Http11Processor.java  21 Nov 2003 21:10:21 -  1.88
  @@ -994,21 +994,30 @@
   
   } else if (actionCode == ActionCode.ACTION_REQ_HOST_ADDR_ATTRIBUTE) {
   
  -if ((remoteAddr == null)  (socket != null))
  -remoteAddr = socket.getInetAddress().getHostAddress();
  -
  +if ((remoteAddr == null)  (socket != null)) {
  +InetAddress inetAddr = socket.getInetAddress();
  +if (inetAddr != null) {
  +remoteAddr = inetAddr.getHostAddress();
  +}   
  +}
   request.remoteAddr().setString(remoteAddr);
   
   } else if (actionCode == ActionCode.ACTION_REQ_HOST_ATTRIBUTE) {
   
  -if (remoteAddr == null)
  -remoteAddr = socket.getInetAddress().getHostAddress();
  -
  +if ((remoteAddr == null)  (socket !=null)) {
  +InetAddress inetAddr = socket.getInetAddress();
  +if (inetAddr != null) {
  +remoteAddr = inetAddr.getHostAddress();
  +}
  +}
   request.remoteAddr().setString(remoteAddr);
   
  -if (remoteHost == null)
  -remoteHost = socket.getInetAddress().getHostName();
  -
  +if ((remoteHost == null)  (socket != null)) {
  +InetAddress inetAddr = socket.getInetAddress();
  +if (inetAddr != null) {
  +remoteHost = inetAddr.getHostName();
  +}
  +}
   request.remoteHost().setString(remoteHost);
  
   if (remotePort == -1)
  
  
  

-
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

2003-11-05 Thread remm
remm2003/11/05 03:38:47

  Modified:http11/src/java/org/apache/coyote/http11
Http11Processor.java
  Log:
  - Fix bug 24428: no continue if not HTTP/1.1.
  
  Revision  ChangesPath
  1.86  +1 -1  
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.85
  retrieving revision 1.86
  diff -u -r1.85 -r1.86
  --- Http11Processor.java  31 Oct 2003 01:30:01 -  1.85
  +++ Http11Processor.java  5 Nov 2003 11:38:47 -   1.86
  @@ -888,7 +888,7 @@
   // Send a 100 status back if it makes sense (response not committed
   // yet, and client specified an expectation for 100-continue)
   
  -if (response.isCommitted())
  +if ((response.isCommitted()) || (!http11))
   return;
   
   MessageBytes expectMB = 
  
  
  

-
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

2003-10-01 Thread hgomez
hgomez  2003/10/01 00:54:09

  Modified:http11/src/java/org/apache/coyote/http11
Http11Processor.java
  Log:
  More setters for gzip compression support.
  
  Fix problems with getRemoteAddr, getRemoteHost.
  
  Tested with TC 3.3.2-dev
  
  Revision  ChangesPath
  1.80  +112 -68   
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.79
  retrieving revision 1.80
  diff -u -r1.79 -r1.80
  --- Http11Processor.java  21 Sep 2003 19:28:11 -  1.79
  +++ Http11Processor.java  1 Oct 2003 07:54:09 -   1.80
  @@ -59,39 +59,37 @@
   
   package org.apache.coyote.http11;
   
  -import java.io.InterruptedIOException;
  -import java.io.InputStream;
   import java.io.IOException;
  +import java.io.InputStream;
  +import java.io.InterruptedIOException;
   import java.io.OutputStream;
  -import java.net.Socket;
   import java.net.InetAddress;
  +import java.net.Socket;
  +import java.util.StringTokenizer;
   
  -import org.apache.tomcat.util.buf.ByteChunk;
  -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.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.ActionHook;
   import org.apache.coyote.Adapter;
   import org.apache.coyote.Processor;
   import org.apache.coyote.Request;
   import org.apache.coyote.RequestInfo;
   import org.apache.coyote.Response;
  -
   import org.apache.coyote.http11.filters.ChunkedInputFilter;
   import org.apache.coyote.http11.filters.ChunkedOutputFilter;
  -//import org.apache.coyote.http11.filters.GzipInputFilter;
   import org.apache.coyote.http11.filters.GzipOutputFilter;
   import org.apache.coyote.http11.filters.IdentityInputFilter;
   import org.apache.coyote.http11.filters.IdentityOutputFilter;
   import org.apache.coyote.http11.filters.VoidInputFilter;
   import org.apache.coyote.http11.filters.VoidOutputFilter;
  +import org.apache.tomcat.util.buf.Ascii;
  +import org.apache.tomcat.util.buf.ByteChunk;
  +import org.apache.tomcat.util.buf.HexUtils;
  +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.SSLSupport;
  +import org.apache.tomcat.util.threads.ThreadPool;
  +import org.apache.tomcat.util.threads.ThreadWithAttributes;
   
   
   /**
  @@ -324,27 +322,35 @@
   }
   
   
  -/**
  - * Set compression level.
  - */
  -public void setCompression(String compression) {
  -if (compression.equals(on)) {
  -this.compressionLevel = 1;
  -} else if (compression.equals(force)) {
  -this.compressionLevel = 2;
  -} else if (compression.equals(off)) {
  -this.compressionLevel = 0;
  -} else {
  -try {
  -// Try to parse compression as an int, which would give the
  -// minimum compression size
  -compressionMinSize = Integer.parseInt(compression);
  -this.compressionLevel = 1;
  -} catch (Exception e) {
  -this.compressionLevel = 0;
  -}
  -}
  -}
  + /**
  +  * Set compression level.
  +  */
  + public void setCompression(String compression) {
  + if (compression.equals(on)) {
  + this.compressionLevel = 1;
  + } else if (compression.equals(force)) {
  + this.compressionLevel = 2;
  + } else if (compression.equals(off)) {
  + this.compressionLevel = 0;
  + } else {
  + try {
  + // Try to parse compression as an int, which would 
give the
  + // minimum compression size
  + compressionMinSize = Integer.parseInt(compression);
  + this.compressionLevel = 1;
  + } catch (Exception e) {
  + this.compressionLevel = 0;
  + }
  + }
  + }
  +
  + /**
  +  * Set Minimum size to trigger compression.
  +  */
  + public void setCompressionMinSize(int compressionMinSize) {
  + this.compressionMinSize = compressionMinSize;
  + }
  +   

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

2003-10-01 Thread Henri Gomez
[EMAIL PROTECTED] a écrit :
hgomez  2003/10/01 00:54:09

  Modified:http11/src/java/org/apache/coyote/http11
Http11Processor.java
  Log:
  More setters for gzip compression support.
Here is the correction for getRemoteAddr(), getRemoteHost(), 
getRemotePort().

I detected that I got null instead of IP address while playing with 
Coyote 2 HTTP 1.1 connector with Tomcat 3.3.2-dev.

Thanks to verify it didn't break anything with TC 4.1.x and 5.0.x :)

Also here is an example of gzip settings in Coyote2 Connector :

CoyoteConnector2   port=8081
   secure=false
   maxThreads=100
   maxSpareThreads=50
   minSpareThreads=10
   compression=on
   compressionMinSize=2048
   noCompressionUserAgents=gozilla, reloo
   compressableMimeType=text/html,text/xml /
Regards :-)

   
   /**
  @@ -885,29 +925,32 @@
   
   } else if (actionCode == ActionCode.ACTION_REQ_HOST_ADDR_ATTRIBUTE) {
   
  -if ((remoteAddr == null)  (socket != null)) {
  +if ((remoteAddr == null)  (socket != null))
   remoteAddr = socket.getInetAddress().getHostAddress();
  -request.remoteAddr().setString(remoteAddr);
  -}
  +
  +request.remoteAddr().setString(remoteAddr);
   
   } else if (actionCode == ActionCode.ACTION_REQ_HOST_ATTRIBUTE) {
   
  -if (remoteAddr == null) {
  +if (remoteAddr == null)
   remoteAddr = socket.getInetAddress().getHostAddress();
  -request.remoteAddr().setString(remoteAddr);
  -}
  -if (remoteHost == null) {
  +
  +			request.remoteAddr().setString(remoteAddr);
  +
  +if (remoteHost == null)
   remoteHost = socket.getInetAddress().getHostName();
  -request.remoteHost().setString(remoteHost);
  -}   
  -if (remotePort == -1){
  +
  +			request.remoteHost().setString(remoteHost);
  +   
  +if (remotePort == -1)
   remotePort = socket.getPort();
  -request.setRemotePort(remotePort);
  -}
  -if (localAddr == null){
  +
  +request.setRemotePort(remotePort);
  +
  +if (localAddr == null)
  localAddr = socket.getLocalAddress().getHostAddress();
  -   request.localAddr().setString(localAddr);
  -}
  +
  +			request.localAddr().setString(localAddr);
   
   } else if (actionCode == ActionCode.ACTION_REQ_SSL_CERTIFICATE) {
   if( sslSupport != null) { 
  @@ -1230,6 +1273,7 @@
   request.getMimeHeaders().getValue(user-agent);
   String userAgentValue = userAgentValueMB.toString();
   
  +			// TODO: Use regexp instead of simple string compare (cf: Apache 2.x)
   	if (inStringArray(noCompressionUserAgents, userAgentValue))
   		return false;
   }
  
  
  

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




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


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

2003-10-01 Thread Remy Maucherat
Henri Gomez wrote:

[EMAIL PROTECTED] a écrit :

hgomez  2003/10/01 00:54:09

  Modified:http11/src/java/org/apache/coyote/http11
Http11Processor.java
  Log:
  More setters for gzip compression support.


Here is the correction for getRemoteAddr(), getRemoteHost(), 
getRemotePort().

I detected that I got null instead of IP address while playing with 
Coyote 2 HTTP 1.1 connector with Tomcat 3.3.2-dev.

Thanks to verify it didn't break anything with TC 4.1.x and 5.0.x :)

Also here is an example of gzip settings in Coyote2 Connector :

CoyoteConnector2   port=8081
   secure=false
   maxThreads=100
   maxSpareThreads=50
   minSpareThreads=10
   compression=on
   compressionMinSize=2048
   noCompressionUserAgents=gozilla, reloo
   compressableMimeType=text/html,text/xml /
Regards :-)
I don't see a reason why it would be broken. The method call is likely 
redundant in TC 4.1/5.0, but it doesn't cause any performance problem, 
so I'm ok with the patch (except for the tabs, of course; can you remove 
them ?).

Remy



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


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

2003-10-01 Thread Henri Gomez
Remy Maucherat a écrit :

Henri Gomez wrote:

[EMAIL PROTECTED] a écrit :

hgomez  2003/10/01 00:54:09

  Modified:http11/src/java/org/apache/coyote/http11
Http11Processor.java
  Log:
  More setters for gzip compression support.


Here is the correction for getRemoteAddr(), getRemoteHost(), 
getRemotePort().

I detected that I got null instead of IP address while playing with 
Coyote 2 HTTP 1.1 connector with Tomcat 3.3.2-dev.

Thanks to verify it didn't break anything with TC 4.1.x and 5.0.x :)

Also here is an example of gzip settings in Coyote2 Connector :

CoyoteConnector2   port=8081
   secure=false
   maxThreads=100
   maxSpareThreads=50
   minSpareThreads=10
   compression=on
   compressionMinSize=2048
   noCompressionUserAgents=gozilla, reloo
   compressableMimeType=text/html,text/xml /
Regards :-)


I don't see a reason why it would be broken. The method call is likely 
redundant in TC 4.1/5.0, but it doesn't cause any performance problem, 
so I'm ok with the patch (except for the tabs, of course; can you remove 
them ?).
Urg, bad Eclipse setup. I update asap :)



-
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

2003-10-01 Thread hgomez
hgomez  2003/10/01 03:22:15

  Modified:http11/src/java/org/apache/coyote/http11
Http11Processor.java
  Log:
  Replace Tabs by Space (I forgot about Tab Police :)
  
  Revision  ChangesPath
  1.81  +98 -98
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.80
  retrieving revision 1.81
  diff -u -r1.80 -r1.81
  --- Http11Processor.java  1 Oct 2003 07:54:09 -   1.80
  +++ Http11Processor.java  1 Oct 2003 10:22:15 -   1.81
  @@ -322,35 +322,35 @@
   }
   
   
  - /**
  -  * Set compression level.
  -  */
  - public void setCompression(String compression) {
  - if (compression.equals(on)) {
  - this.compressionLevel = 1;
  - } else if (compression.equals(force)) {
  - this.compressionLevel = 2;
  - } else if (compression.equals(off)) {
  - this.compressionLevel = 0;
  - } else {
  - try {
  - // Try to parse compression as an int, which would 
give the
  - // minimum compression size
  - compressionMinSize = Integer.parseInt(compression);
  - this.compressionLevel = 1;
  - } catch (Exception e) {
  - this.compressionLevel = 0;
  - }
  - }
  - }
  -
  - /**
  -  * Set Minimum size to trigger compression.
  -  */
  - public void setCompressionMinSize(int compressionMinSize) {
  - this.compressionMinSize = compressionMinSize;
  - }
  - 
  +/**
  + * Set compression level.
  + */
  +public void setCompression(String compression) {
  +if (compression.equals(on)) {
  +this.compressionLevel = 1;
  +} else if (compression.equals(force)) {
  +this.compressionLevel = 2;
  +} else if (compression.equals(off)) {
  +this.compressionLevel = 0;
  +} else {
  +try {
  +// Try to parse compression as an int, which would give the
  +// minimum compression size
  +compressionMinSize = Integer.parseInt(compression);
  +this.compressionLevel = 1;
  +} catch (Exception e) {
  +this.compressionLevel = 0;
  +}
  +}
  +}
  +
  +/**
  + * Set Minimum size to trigger compression.
  + */
  +public void setCompressionMinSize(int compressionMinSize) {
  +this.compressionMinSize = compressionMinSize;
  +}
  +
   
   public void setThreadPool(ThreadPool threadPool) {
   this.threadPool = threadPool;
  @@ -364,35 +364,35 @@
* @param userAgent user-agent string
*/
   public void addNoCompressionUserAgent(String userAgent) {
  - addStringArray(noCompressionUserAgents, userAgent);
  +addStringArray(noCompressionUserAgents, userAgent);
   }
   
   
  - /**
  -  * 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(String[] noCompressionUserAgents) {
  - this.noCompressionUserAgents = noCompressionUserAgents;
  - }
  -
  -
  - /**
  -  * 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());
  - }
  - }
  - }
  +/**
  + * 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(String[] noCompressionUserAgents) {
  +this.noCompressionUserAgents = noCompressionUserAgents;
  +}
  +
  +
  +/**
  + * Set no compression user agent list.
  + * List contains users agents separated by ',' :
  + * 
  + * ie: gorilla,desesplorer,tigrus
  + */
  +public void 

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

2003-09-07 Thread remm
remm2003/09/07 11:04:58

  Modified:http11/src/java/org/apache/coyote/http11
Http11Processor.java
  Log:
  - Make the update of the stats an explicit call (I believe it is valid to call
recycle multiple times, and it is hard to avoid with HTTP keepalive).
  - Decrease the timeout reduction ratio.
  - Add a setStatus so an error is counted.
  
  Revision  ChangesPath
  1.77  +12 -3 
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.76
  retrieving revision 1.77
  diff -u -r1.76 -r1.77
  --- Http11Processor.java  30 Aug 2003 02:38:06 -  1.76
  +++ Http11Processor.java  7 Sep 2003 18:04:58 -   1.77
  @@ -595,13 +595,15 @@
   if ((threadRatio  0.33)  (threadRatio = 0.66)) {
   soTimeout = soTimeout / 2;
   } else if (threadRatio  0.66) {
  -soTimeout = soTimeout / 5;
  +soTimeout = soTimeout / 3;
   keepAliveLeft = 1;
   }
   
   boolean keptAlive = false;
   
   while (started  !error  keepAlive) {
  +
  +// Parsing the request header
   try {
   if( !disableUploadTimeout  keptAlive  soTimeout  0 ) {
   socket.setSoTimeout(soTimeout);
  @@ -617,8 +619,8 @@
   } catch (IOException e) {
   error = true;
   break;
  -} catch (Exception e) {
  -log.debug(Error parsing HTTP request, e);
  +} catch (Throwable t) {
  +log.debug(Error parsing HTTP request, t);
   // 400 - Bad Request
   response.setStatus(400);
   error = true;
  @@ -688,6 +690,13 @@
   log.error(Error finishing response, t);
   error = true;
   }
  +
  +// If there was an error, make sure the request is counted as
  +// and error, and update the statistics counter
  +if (error) {
  +response.setStatus(500);
  +}
  +request.updateCounters();
   
   thrA.setCurrentStage(threadPool, ended);
   rp.setStage(org.apache.coyote.Constants.STAGE_KEEPALIVE);
  
  
  

-
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

2003-08-30 Thread billbarker
billbarker2003/08/29 19:38:06

  Modified:http11/src/java/org/apache/coyote/http11
Http11Processor.java
  Log:
  Make certain that we are still in an https session before looking for certs.
  
  Submitted By: Mark Thomas [EMAIL PROTECTED]
  
  Revision  ChangesPath
  1.76  +9 -9  
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.75
  retrieving revision 1.76
  diff -u -r1.75 -r1.76
  --- Http11Processor.java  19 Aug 2003 16:15:21 -  1.75
  +++ Http11Processor.java  30 Aug 2003 02:38:06 -  1.76
  @@ -845,17 +845,17 @@
   }
   
   } else if (actionCode == ActionCode.ACTION_REQ_SSL_CERTIFICATE) {
  -
  -try {
  -Object sslO = sslSupport.getPeerCertificateChain(true);
  -if( sslO != null) {
  -request.setAttribute
  -(SSLSupport.CERTIFICATE_KEY, sslO);
  +if( sslSupport != null) { 
  +try {
  +Object sslO = sslSupport.getPeerCertificateChain(true);
  +if( sslO != null) {
  +request.setAttribute
  +(SSLSupport.CERTIFICATE_KEY, sslO);
  +}
  +} catch (Exception e) {
  +log.warn(Exception getting SSL Cert,e);
   }
  -} catch (Exception e) {
  -log.warn(Exception getting SSL Cert,e);
   }
  -
   }
   
   }
  
  
  

-
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

2003-08-30 Thread billbarker
billbarker2003/08/29 19:45:02

  Modified:http11/src/java/org/apache/coyote/http11 Tag: coyote_10
Http11Processor.java
  Log:
  Port patch.
  
  Submitted by: Mark Thomas [EMAIL PROTECTED]
  
  Revision  ChangesPath
  No   revision
  No   revision
  1.55.2.4  +9 -9  
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.2.3
  retrieving revision 1.55.2.4
  diff -u -r1.55.2.3 -r1.55.2.4
  --- Http11Processor.java  13 Jul 2003 21:53:07 -  1.55.2.3
  +++ Http11Processor.java  30 Aug 2003 02:45:02 -  1.55.2.4
  @@ -781,17 +781,17 @@
   }
   
   } else if (actionCode == ActionCode.ACTION_REQ_SSL_CERTIFICATE) {
  -
  -try {
  -Object sslO = sslSupport.getPeerCertificateChain(true);
  -if( sslO != null) {
  -request.setAttribute
  -(SSLSupport.CERTIFICATE_KEY, sslO);
  +if( sslSupport != null) {
  +try {
  +Object sslO = sslSupport.getPeerCertificateChain(true);
  +if( sslO != null) {
  +request.setAttribute
  +(SSLSupport.CERTIFICATE_KEY, sslO);
  +}
  +} catch (Exception e) {
  +log.warn(Exception getting SSL Cert,e);
   }
  -} catch (Exception e) {
  -log.warn(Exception getting SSL Cert,e);
   }
  -
   }
   
   }
  
  
  

-
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

2003-08-19 Thread remm
remm2003/08/19 09:15:21

  Modified:http11/src/java/org/apache/coyote/http11
Http11Processor.java
  Log:
  - Avoid a NPE if requesting the remote address between requests or before
processing any request.
  
  Revision  ChangesPath
  1.75  +1 -1  
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.74
  retrieving revision 1.75
  diff -u -r1.74 -r1.75
  --- Http11Processor.java  17 Aug 2003 14:52:30 -  1.74
  +++ Http11Processor.java  19 Aug 2003 16:15:21 -  1.75
  @@ -820,7 +820,7 @@
   
   } else if (actionCode == ActionCode.ACTION_REQ_HOST_ADDR_ATTRIBUTE) {
   
  -if (remoteAddr == null) {
  +if ((remoteAddr == null)  (socket != null)) {
   remoteAddr = socket.getInetAddress().getHostAddress();
   request.remoteAddr().setString(remoteAddr);
   }
  
  
  

-
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

2003-08-17 Thread remm
remm2003/08/17 07:52:30

  Modified:http11/src/java/org/apache/coyote/http11
Http11Processor.java
  Log:
  - Use less aggressive socket timout reduction.
  - Fix calculation of a request processing time (it must not include the time
waiting for data in keepalive mode, or the time waiting for data for an initial
request on a connection).
  
  Revision  ChangesPath
  1.74  +3 -3  
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.73
  retrieving revision 1.74
  diff -u -r1.73 -r1.74
  --- Http11Processor.java  5 Aug 2003 12:26:54 -   1.73
  +++ Http11Processor.java  17 Aug 2003 14:52:30 -  1.74
  @@ -593,9 +593,9 @@
   (float) threadPool.getCurrentThreadsBusy() 
   / (float) threadPool.getMaxThreads();
   if ((threadRatio  0.33)  (threadRatio = 0.66)) {
  -soTimeout = soTimeout / 5;
  +soTimeout = soTimeout / 2;
   } else if (threadRatio  0.66) {
  -soTimeout = soTimeout / 10;
  +soTimeout = soTimeout / 5;
   keepAliveLeft = 1;
   }
   
  @@ -603,11 +603,11 @@
   
   while (started  !error  keepAlive) {
   try {
  -request.setStartTime(System.currentTimeMillis());
   if( !disableUploadTimeout  keptAlive  soTimeout  0 ) {
   socket.setSoTimeout(soTimeout);
   }
   inputBuffer.parseRequestLine();
  +request.setStartTime(System.currentTimeMillis());
   thrA.setParam( threadPool, request.requestURI() );
   keptAlive = true;
   if (!disableUploadTimeout) {
  
  
  

-
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

2003-08-14 Thread remm
remm2003/08/05 05:26:54

  Modified:http11/src/java/org/apache/coyote/http11
Http11Processor.java
  Log:
  - Fix bug 9351: parsing IPv6 hostnames (in IP form, obviously).
  - Submitted by Masashi Yamaguchi. Thanks !
  
  Revision  ChangesPath
  1.73  +9 -3  
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.72
  retrieving revision 1.73
  diff -u -r1.72 -r1.73
  --- Http11Processor.java  29 Jul 2003 18:53:20 -  1.72
  +++ Http11Processor.java  5 Aug 2003 12:26:54 -   1.73
  @@ -1081,12 +1081,18 @@
   hostNameC = new char[valueL];
   }
   
  +boolean ipv6 = (valueB[valueS] == '[');
  +boolean bracketClosed = false;
   for (int i = 0; i  valueL; i++) {
   char b = (char) valueB[i + valueS];
   hostNameC[i] = b;
  -if (b == ':') {
  -colonPos = i;
  -break;
  +if (b == ']') {
  +bracketClosed = true;
  +} else if (b == ':') {
  +if (!ipv6 || bracketClosed) {
  +colonPos = i;
  +break;
  +}
   }
   }
   
  
  
  

-
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

2003-07-29 Thread remm
remm2003/07/29 11:53:20

  Modified:http11/src/java/org/apache/coyote/http11
Http11Processor.java
  Log:
  - Reduce timeout and disable keepalive when the server starts running out
or processors (of course, if servlet processing times are too long, or is under
a DoS attack, it might still run out of processors).
  - The policy is really simple, and could obviously be tweaked (and a flag can
be added to make it optional, etc).
  
  Revision  ChangesPath
  1.72  +10 -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.71
  retrieving revision 1.72
  diff -u -r1.71 -r1.72
  --- Http11Processor.java  13 Jul 2003 21:52:05 -  1.71
  +++ Http11Processor.java  29 Jul 2003 18:53:20 -  1.72
  @@ -589,6 +589,16 @@
   int keepAliveLeft = maxKeepAliveRequests;
   int soTimeout = socket.getSoTimeout();
   
  +float threadRatio = 
  +(float) threadPool.getCurrentThreadsBusy() 
  +/ (float) threadPool.getMaxThreads();
  +if ((threadRatio  0.33)  (threadRatio = 0.66)) {
  +soTimeout = soTimeout / 5;
  +} else if (threadRatio  0.66) {
  +soTimeout = soTimeout / 10;
  +keepAliveLeft = 1;
  +}
  +
   boolean keptAlive = false;
   
   while (started  !error  keepAlive) {
  
  
  

-
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

2003-07-13 Thread billbarker
billbarker2003/07/13 14:52:06

  Modified:http11/src/java/org/apache/coyote/http11
Http11Processor.java
  Log:
  It seems I need to learn the difference between true and false :(.
  
  Revision  ChangesPath
  1.71  +1 -1  
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.70
  retrieving revision 1.71
  diff -u -r1.70 -r1.71
  --- Http11Processor.java  6 Jul 2003 06:16:00 -   1.70
  +++ Http11Processor.java  13 Jul 2003 21:52:05 -  1.71
  @@ -1269,7 +1269,7 @@
   
   // If we know that the request is bad this early, add the
   // Connection: close header.
  -keepAlive = keepAlive  statusDropsConnection(statusCode);
  +keepAlive = keepAlive  !statusDropsConnection(statusCode);
   if (!keepAlive) {
   response.addHeader(Connection, close);
   } else if (!http11) {
  
  
  

-
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

2003-07-13 Thread billbarker
billbarker2003/07/13 14:53:07

  Modified:http11/src/java/org/apache/coyote/http11 Tag: coyote_10
Http11Processor.java
  Log:
  Porting patch.
  
  Revision  ChangesPath
  No   revision
  
  
  No   revision
  
  
  1.55.2.3  +1 -1  
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.2.2
  retrieving revision 1.55.2.3
  diff -u -r1.55.2.2 -r1.55.2.3
  --- Http11Processor.java  6 Jul 2003 06:23:40 -   1.55.2.2
  +++ Http11Processor.java  13 Jul 2003 21:53:07 -  1.55.2.3
  @@ -1215,7 +1215,7 @@
   
   // If we know that the request is bad this early, add the
   // Connection: close header.
  -keepAlive = keepAlive  statusDropsConnection(statusCode);
  +keepAlive = keepAlive  !statusDropsConnection(statusCode);
   if (!keepAlive) {
   response.addHeader(Connection, close);
   } else if (!http11) {
  
  
  

-
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

2003-07-06 Thread billbarker
billbarker2003/07/05 23:16:00

  Modified:http11/src/java/org/apache/coyote/http11
Http11Processor.java
  Log:
  Re-activate dropping the connection on serious protocol errors.
  
  Also adding Remy's suggestion to check the exception, as well as checking the status 
code in the commit so that we can be nice enough to tell the client that we're not 
talking to them anymore if we discover the error soon enough.
  
  Revision  ChangesPath
  1.70  +13 -3 
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.69
  retrieving revision 1.70
  diff -u -r1.69 -r1.70
  --- Http11Processor.java  5 Jul 2003 01:39:42 -   1.69
  +++ Http11Processor.java  6 Jul 2003 06:16:00 -   1.70
  @@ -635,9 +635,16 @@
   thrA.setCurrentStage(threadPool, service);
   rp.setStage(org.apache.coyote.Constants.STAGE_SERVICE);
   adapter.service(request, response);
  -  /* Mimic httpd (currently disabled)
  -error = statusDropsConnection(response.getStatus());
  -  */
  +// Handle when the response was committed before a serious
  +// error occurred.  Throwing a ServletException should both
  +// set the status to 500 and set the errorException.
  +// If we fail here, then the response is likely already 
  +// committed, so we can't try and set headers.
  +if(keepAlive  !error) { // Avoid checking twice.
  +error = response.getErrorException() != null ||
  +statusDropsConnection(response.getStatus());
  +}
  +
   } catch (InterruptedIOException e) {
   error = true;
   } catch (Throwable t) {
  @@ -1260,6 +1267,9 @@
   keepAlive = false;
   }
   
  +// If we know that the request is bad this early, add the
  +// Connection: close header.
  +keepAlive = keepAlive  statusDropsConnection(statusCode);
   if (!keepAlive) {
   response.addHeader(Connection, close);
   } else if (!http11) {
  
  
  

-
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

2003-07-06 Thread billbarker
billbarker2003/07/05 23:23:40

  Modified:http11/src/java/org/apache/coyote/http11 Tag: coyote_10
Http11Processor.java
  Log:
  Port Patch for closing connections on bad requests.
  
  Revision  ChangesPath
  No   revision
  
  
  No   revision
  
  
  1.55.2.2  +26 -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.55.2.1
  retrieving revision 1.55.2.2
  diff -u -r1.55.2.1 -r1.55.2.2
  --- Http11Processor.java  13 May 2003 22:47:00 -  1.55.2.1
  +++ Http11Processor.java  6 Jul 2003 06:23:40 -   1.55.2.2
  @@ -599,6 +599,15 @@
   if (!error) {
   try {
   adapter.service(request, response);
  +// Handle when the response was committed before a serious
  +// error occurred.  Throwing a ServletException should both
  +// set the status to 500 and set the errorException.
  +// If we fail here, then the response is likely already 
  +// committed, so we can't try and set headers.
  +if(keepAlive  !error) { // Avoid checking twice.
  +error = response.getErrorException() != null ||
  +statusDropsConnection(response.getStatus());
  +}
   } catch (InterruptedIOException e) {
   error = true;
   } catch (Throwable t) {
  @@ -1204,6 +1213,9 @@
   keepAlive = false;
   }
   
  +// If we know that the request is bad this early, add the
  +// Connection: close header.
  +keepAlive = keepAlive  statusDropsConnection(statusCode);
   if (!keepAlive) {
   response.addHeader(Connection, close);
   } else if (!http11) {
  @@ -1302,5 +1314,19 @@
   
   }
   
  +/**
  + * Determine if we must drop the connection because of the HTTP status
  + * code.  Use the same list of codes as Apache/httpd.
  + */
  +protected boolean statusDropsConnection(int status) {
  +return status == 400 /* SC_BAD_REQUEST */ ||
  +   status == 408 /* SC_REQUEST_TIMEOUT */ ||
  +   status == 411 /* SC_LENGTH_REQUIRED */ ||
  +   status == 413 /* SC_REQUEST_ENTITY_TOO_LARGE */ ||
  +   status == 414 /* SC_REQUEST_URI_TOO_LARGE */ ||
  +   status == 500 /* SC_INTERNAL_SERVER_ERROR */ ||
  +   status == 503 /* SC_SERVICE_UNAVAILABLE */ ||
  +   status == 501 /* SC_NOT_IMPLEMENTED */;
  +}
   
   }
  
  
  

-
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

2003-07-04 Thread billbarker
billbarker2003/07/04 01:17:37

  Modified:http11/src/java/org/apache/coyote/http11
Http11Processor.java
  Log:
  Drop connections on high HTTP errors.
  
  Fix for bug #21219
  Reported By: [EMAIL PROTECTED]
  
  Revision  ChangesPath
  1.68  +3 -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.67
  retrieving revision 1.68
  diff -u -r1.67 -r1.68
  --- Http11Processor.java  5 Jun 2003 19:46:49 -   1.67
  +++ Http11Processor.java  4 Jul 2003 08:17:37 -   1.68
  @@ -635,6 +635,9 @@
   thrA.setCurrentStage(threadPool, service);
   rp.setStage(org.apache.coyote.Constants.STAGE_SERVICE);
   adapter.service(request, response);
  +if(response.getStatus() = 403) {
  +error=true;
  +}
   } catch (InterruptedIOException e) {
   error = true;
   } catch (Throwable t) {
  
  
  

-
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

2003-07-04 Thread billbarker
billbarker2003/07/04 18:39:42

  Modified:http11/src/java/org/apache/coyote/http11
Http11Processor.java
  Log:
  Reverting previous patch.
  
  I included the code that httpd actually uses, in case somebody else likes the idea.  
However, I left it commented out, so that the only effect it has to to add a few bytes 
to the .class file.  If nobody else likes the idea, I'll clean it out later.
  
  Revision  ChangesPath
  1.69  +17 -3 
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.68
  retrieving revision 1.69
  diff -u -r1.68 -r1.69
  --- Http11Processor.java  4 Jul 2003 08:17:37 -   1.68
  +++ Http11Processor.java  5 Jul 2003 01:39:42 -   1.69
  @@ -635,9 +635,9 @@
   thrA.setCurrentStage(threadPool, service);
   rp.setStage(org.apache.coyote.Constants.STAGE_SERVICE);
   adapter.service(request, response);
  -if(response.getStatus() = 403) {
  -error=true;
  -}
  +  /* Mimic httpd (currently disabled)
  +error = statusDropsConnection(response.getStatus());
  +  */
   } catch (InterruptedIOException e) {
   error = true;
   } catch (Throwable t) {
  @@ -1358,5 +1358,19 @@
   
   }
   
  +/**
  + * Determine if we must drop the connection because of the HTTP status
  + * code.  Use the same list of codes as Apache/httpd.
  + */
  +protected boolean statusDropsConnection(int status) {
  +return status == 400 /* SC_BAD_REQUEST */ ||
  +   status == 408 /* SC_REQUEST_TIMEOUT */ ||
  +   status == 411 /* SC_LENGTH_REQUIRED */ ||
  +   status == 413 /* SC_REQUEST_ENTITY_TOO_LARGE */ ||
  +   status == 414 /* SC_REQUEST_URI_TOO_LARGE */ ||
  +   status == 500 /* SC_INTERNAL_SERVER_ERROR */ ||
  +   status == 503 /* SC_SERVICE_UNAVAILABLE */ ||
  +   status == 501 /* SC_NOT_IMPLEMENTED */;
  +}
   
   }
  
  
  

-
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

2003-06-06 Thread luehe
luehe   2003/06/05 12:46:49

  Modified:coyote/src/java/org/apache/coyote Request.java
   http11/src/java/org/apache/coyote/http11
Http11Processor.java
  Log:
  Undid previous changes
  
  Revision  ChangesPath
  1.22  +0 -20 
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.21
  retrieving revision 1.22
  diff -u -r1.21 -r1.22
  --- Request.java  5 Jun 2003 16:42:48 -   1.21
  +++ Request.java  5 Jun 2003 19:46:49 -   1.22
  @@ -62,7 +62,6 @@
   
   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;
  @@ -138,8 +137,6 @@
   
   private int remotePort;
   
  -private Socket socket;
  -
   private MessageBytes schemeMB = new MessageBytes();
   
   private MessageBytes methodMB = new MessageBytes();
  @@ -307,23 +304,6 @@
   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.67  +0 -1  
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.66
  retrieving revision 1.67
  diff -u -r1.66 -r1.67
  --- Http11Processor.java  5 Jun 2003 16:42:48 -   1.66
  +++ Http11Processor.java  5 Jun 2003 19:46:49 -   1.67
  @@ -517,7 +517,6 @@
   public void setSocket(Socket socket)
   throws IOException {
   this.socket = socket;
  - this.request.setSocket(socket);
   }
   
   /**
  
  
  

-
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

2003-03-23 Thread remm
remm2003/03/23 00:50:16

  Modified:http11/src/java/org/apache/coyote/http11
Http11Processor.java
  Log:
  - Also set the state in the request info.
  
  Revision  ChangesPath
  1.61  +8 -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.60
  retrieving revision 1.61
  diff -u -r1.60 -r1.61
  --- Http11Processor.java  5 Mar 2003 02:38:43 -   1.60
  +++ Http11Processor.java  23 Mar 2003 08:50:16 -  1.61
  @@ -81,6 +81,7 @@
   import org.apache.coyote.Adapter;
   import org.apache.coyote.Processor;
   import org.apache.coyote.Request;
  +import org.apache.coyote.RequestInfo;
   import org.apache.coyote.Response;
   
   import org.apache.coyote.http11.filters.ChunkedInputFilter;
  @@ -567,7 +568,9 @@
   throws IOException {
   ThreadWithAttributes thrA=
   (ThreadWithAttributes)Thread.currentThread();
  +RequestInfo rp = request.getRequestProcessor();
   thrA.setCurrentStage(threadPool, parsing http request);
  +rp.setStage(org.apache.coyote.Constants.STAGE_PARSE);
   
   // Set the remote address
   remoteAddr = null;
  @@ -613,6 +616,7 @@
   
   // Setting up filters, and parse some request headers
   thrA.setCurrentStage(threadPool, prepareRequest);
  +rp.setStage(org.apache.coyote.Constants.STAGE_PREPARE);
   prepareRequest();
   
   if (maxKeepAliveRequests  0  --keepAliveLeft == 0)
  @@ -622,6 +626,7 @@
   if (!error) {
   try {
   thrA.setCurrentStage(threadPool, service);
  +rp.setStage(org.apache.coyote.Constants.STAGE_SERVICE);
   adapter.service(request, response);
   } catch (InterruptedIOException e) {
   error = true;
  @@ -636,6 +641,7 @@
   // Finish the handling of the request
   try {
   thrA.setCurrentStage(threadPool, endRequestIB);
  +rp.setStage(org.apache.coyote.Constants.STAGE_ENDINPUT);
   inputBuffer.endRequest();
   } catch (IOException e) {
   error = true;
  @@ -647,6 +653,7 @@
   }
   try {
   thrA.setCurrentStage(threadPool, endRequestOB);
  +rp.setStage(org.apache.coyote.Constants.STAGE_ENDOUTPUT);
   outputBuffer.endRequest();
   } catch (IOException e) {
   error = true;
  @@ -656,6 +663,7 @@
   }
   
   thrA.setCurrentStage(threadPool, ended);
  +rp.setStage(org.apache.coyote.Constants.STAGE_ENDED);
   // Don't reset the param - we'll see it as ended. Next request
   // will reset it
   // thrA.setParam(null);
  
  
  

-
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

2003-03-23 Thread remm
remm2003/03/23 08:08:48

  Modified:http11/src/java/org/apache/coyote/http11
Http11Processor.java
  Log:
  - Make a difference between keepalive and ended.
  
  Revision  ChangesPath
  1.62  +5 -1  
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.61
  retrieving revision 1.62
  diff -u -r1.61 -r1.62
  --- Http11Processor.java  23 Mar 2003 08:50:16 -  1.61
  +++ Http11Processor.java  23 Mar 2003 16:08:48 -  1.62
  @@ -663,7 +663,11 @@
   }
   
   thrA.setCurrentStage(threadPool, ended);
  -rp.setStage(org.apache.coyote.Constants.STAGE_ENDED);
  +if (keepAlive) {
  +rp.setStage(org.apache.coyote.Constants.STAGE_KEEPALIVE);
  +} else {
  +rp.setStage(org.apache.coyote.Constants.STAGE_ENDED);
  +}
   // Don't reset the param - we'll see it as ended. Next request
   // will reset it
   // thrA.setParam(null);
  
  
  

-
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

2003-03-23 Thread remm
remm2003/03/23 10:58:29

  Modified:http11/src/java/org/apache/coyote/http11
Http11Processor.java
  Log:
  - Set the state as ended when going out of the loop (otherwise, threads
get reported as keepalive).
  
  Revision  ChangesPath
  1.63  +4 -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.62
  retrieving revision 1.63
  diff -u -r1.62 -r1.63
  --- Http11Processor.java  23 Mar 2003 16:08:48 -  1.62
  +++ Http11Processor.java  23 Mar 2003 18:58:29 -  1.63
  @@ -663,11 +663,8 @@
   }
   
   thrA.setCurrentStage(threadPool, ended);
  -if (keepAlive) {
  -rp.setStage(org.apache.coyote.Constants.STAGE_KEEPALIVE);
  -} else {
  -rp.setStage(org.apache.coyote.Constants.STAGE_ENDED);
  -}
  +rp.setStage(org.apache.coyote.Constants.STAGE_KEEPALIVE);
  +
   // Don't reset the param - we'll see it as ended. Next request
   // will reset it
   // thrA.setParam(null);
  @@ -676,6 +673,8 @@
   outputBuffer.nextRequest();
   
   }
  +
  +rp.setStage(org.apache.coyote.Constants.STAGE_ENDED);
   
   // Recycle
   inputBuffer.recycle();
  
  
  

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



  1   2   >