svn commit: r429001 - in /tomcat/tc6.0.x/trunk/java/org/apache/tomcat/util/net: AprEndpoint.java JIoEndpoint.java

2006-08-05 Thread remm
Author: remm
Date: Sat Aug  5 06:57:54 2006
New Revision: 429001

URL: http://svn.apache.org/viewvc?rev=429001&view=rev
Log:
- Fix the accept algorithm, that I had translated inaccurately in the new 
endpoints.

Modified:
tomcat/tc6.0.x/trunk/java/org/apache/tomcat/util/net/AprEndpoint.java
tomcat/tc6.0.x/trunk/java/org/apache/tomcat/util/net/JIoEndpoint.java

Modified: tomcat/tc6.0.x/trunk/java/org/apache/tomcat/util/net/AprEndpoint.java
URL: 
http://svn.apache.org/viewvc/tomcat/tc6.0.x/trunk/java/org/apache/tomcat/util/net/AprEndpoint.java?rev=429001&r1=429000&r2=429001&view=diff
==
--- tomcat/tc6.0.x/trunk/java/org/apache/tomcat/util/net/AprEndpoint.java 
(original)
+++ tomcat/tc6.0.x/trunk/java/org/apache/tomcat/util/net/AprEndpoint.java Sat 
Aug  5 06:57:54 2006
@@ -1012,6 +1012,26 @@
 /**
  * Process given socket.
  */
+protected boolean processSocketWithOptions(long socket) {
+try {
+if (executor == null) {
+getWorkerThread().assignWithOptions(socket);
+} else {
+executor.execute(new SocketWithOptionsProcessor(socket));
+}
+} catch (Throwable t) {
+// This means we got an OOM or similar creating a thread, or that
+// the pool and its queue are full
+log.error(sm.getString("endpoint.process.fail"), t);
+return false;
+}
+return true;
+}
+
+
+/**
+ * Process given socket.
+ */
 protected boolean processSocket(long socket) {
 try {
 if (executor == null) {
@@ -1080,7 +1100,7 @@
 // Accept the next incoming connection from the server 
socket
 long socket = Socket.accept(serverSock);
 // Hand this socket off to an appropriate processor
-if (!setSocketOptions(socket) || !processSocket(socket)) {
+if (!processSocketWithOptions(socket)) {
 // Close socket and pool right away
 Socket.destroy(socket);
 }
@@ -1346,6 +1366,37 @@
 protected long socket = 0;
 protected boolean event = false;
 protected boolean error = false;
+protected boolean options = false;
+
+
+/**
+ * Process an incoming TCP/IP connection on the specified socket.  Any
+ * exception that occurs during processing must be logged and 
swallowed.
+ * NOTE:  This method is called from our Connector's thread.  We
+ * must assign it to our own thread so that multiple simultaneous
+ * requests can be handled.
+ *
+ * @param socket TCP socket to process
+ */
+protected synchronized void assignWithOptions(long socket) {
+
+// Wait for the Processor to get the previous Socket
+while (available) {
+try {
+wait();
+} catch (InterruptedException e) {
+}
+}
+
+// Store the newly available Socket and notify our thread
+this.socket = socket;
+event = false;
+error = false;
+options = true;
+available = true;
+notifyAll();
+
+}
 
 
 /**
@@ -1371,6 +1422,7 @@
 this.socket = socket;
 event = false;
 error = false;
+options = false;
 available = true;
 notifyAll();
 
@@ -1391,6 +1443,7 @@
 this.socket = socket;
 event = true;
 this.error = error;
+options = false;
 available = true;
 notifyAll();
 
@@ -1440,7 +1493,8 @@
 // Close socket and pool
 Socket.destroy(socket);
 socket = 0;
-} else if ((!event) && (handler.process(socket) == 
Handler.SocketState.CLOSED)) {
+} else if ((!event) && ((options && !setSocketOptions(socket)) 
+|| handler.process(socket) == 
Handler.SocketState.CLOSED)) {
 // Close socket and pool
 Socket.destroy(socket);
 socket = 0;
@@ -1830,6 +1884,37 @@
 }
 
 
+// -- SocketProcessor Inner 
Class
+
+
+/**
+ * This class is the equivalent of the Worker, but will simply use in an
+ * external Executor thread pool. This will also set the socket options
+ * and do the handshake.
+ */
+protected class SocketWithOptionsProcessor implements Runnable {
+
+protected long socket = 0;
+
+public SocketWithOptionsProcessor(long socket) {
+this.socket = socket;
+}
+
+public void run() {
+
+// Process the request from this socket
+ 

svn commit: r429003 - /tomcat/connectors/trunk/util/java/org/apache/tomcat/util/net/AprEndpoint.java

2006-08-05 Thread remm
Author: remm
Date: Sat Aug  5 07:18:48 2006
New Revision: 429003

URL: http://svn.apache.org/viewvc?rev=429003&view=rev
Log:
- Similar fix of the bad translation of the algorithm.

Modified:

tomcat/connectors/trunk/util/java/org/apache/tomcat/util/net/AprEndpoint.java

Modified: 
tomcat/connectors/trunk/util/java/org/apache/tomcat/util/net/AprEndpoint.java
URL: 
http://svn.apache.org/viewvc/tomcat/connectors/trunk/util/java/org/apache/tomcat/util/net/AprEndpoint.java?rev=429003&r1=429002&r2=429003&view=diff
==
--- 
tomcat/connectors/trunk/util/java/org/apache/tomcat/util/net/AprEndpoint.java 
(original)
+++ 
tomcat/connectors/trunk/util/java/org/apache/tomcat/util/net/AprEndpoint.java 
Sat Aug  5 07:18:48 2006
@@ -998,16 +998,9 @@
 
 try {
 // Allocate a new worker thread
-Worker workerThread = getWorkerThread();
 // Accept the next incoming connection from the server 
socket
-long socket = Socket.accept(serverSock);
 // Hand this socket off to an appropriate processor
-if (setSocketOptions(socket)) {
-workerThread.assign(socket);
-} else {
-// Close socket and pool right away
-Socket.destroy(socket);
-}
+getWorkerThread().assign(Socket.accept(serverSock), true);
 } catch (Throwable t) {
 log.error(sm.getString("endpoint.accept.fail"), t);
 }
@@ -1166,7 +1159,7 @@
 continue;
 }
 // Hand this socket off to a worker
-getWorkerThread().assign(desc[n*2+1]);
+getWorkerThread().assign(desc[n*2+1], false);
 }
 } else if (rv < 0) {
 int errn = -rv;
@@ -1218,6 +1211,7 @@
 protected Thread thread = null;
 protected boolean available = false;
 protected long socket = 0;
+protected boolean options = false;
 
 
 /**
@@ -1229,7 +1223,7 @@
  *
  * @param socket TCP socket to process
  */
-protected synchronized void assign(long socket) {
+protected synchronized void assign(long socket, boolean options) {
 
 // Wait for the Processor to get the previous Socket
 while (available) {
@@ -1241,6 +1235,7 @@
 
 // Store the newly available Socket and notify our thread
 this.socket = socket;
+this.options = options;
 available = true;
 notifyAll();
 
@@ -1286,7 +1281,7 @@
 continue;
 
 // Process the request from this socket
-if (!handler.process(socket)) {
+if ((options && !setSocketOptions(socket)) || 
!handler.process(socket)) {
 // Close socket and pool
 Socket.destroy(socket);
 socket = 0;
@@ -1552,7 +1547,7 @@
 Socket.timeoutSet(state.socket, soTimeout 
* 1000);
 // If all done hand this socket off to a 
worker for
 // processing of further requests
-getWorkerThread().assign(state.socket);
+getWorkerThread().assign(state.socket, 
false);
 } else {
 // Close the socket since this is
 // the end of not keep-alive request.



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



DO NOT REPLY [Bug 40151] - mod_jk with Apache doesn't handle jsessionid encoded directory URLs

2006-08-05 Thread bugzilla
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG·
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND·
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=40151


[EMAIL PROTECTED] changed:

   What|Removed |Added

 Status|NEW |NEEDINFO




--- Additional Comments From [EMAIL PROTECTED]  2006-08-05 16:55 ---
Which Jk directives did you use, especially JkMount etc.?

-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
--- You are receiving this mail because: ---
You are the assignee for the bug, or are watching the assignee.

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



DO NOT REPLY [Bug 40192] New: - Tray icon is present when running Tomcat as a service

2006-08-05 Thread bugzilla
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG·
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND·
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=40192

   Summary: Tray icon is present when running Tomcat as a service
   Product: Tomcat 5
   Version: 5.5.17
  Platform: Other
   URL: http://tomcat.apache.org/tomcat-5.5-doc/setup.html
OS/Version: Windows 2000
Status: NEW
  Severity: minor
  Priority: P4
 Component: Unknown
AssignedTo: tomcat-dev@jakarta.apache.org
ReportedBy: [EMAIL PROTECTED]


Setup chapter of documentation says:

Tray icon: When Tomcat is run as a service, there will not be any tray icon
present when Tomcat is running. Note that when choosing to run Tomcat at the end
of installation, the tray icon will be used even if Tomcat was installed as a
service.

My own experience with 5.5.17 on Windows 2000 is that it's wrong, the tray icon
is present when running Tomcat as a service.

So, I suppose this feature has changed and the doc should be updated.
Or did I miss something?

Thanks

-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
--- You are receiving this mail because: ---
You are the assignee for the bug, or are watching the assignee.

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



DO NOT REPLY [Bug 40194] New: - isapi_redirect.dll corrupts query string when using a rewrite rule

2006-08-05 Thread bugzilla
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG·
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND·
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=40194

   Summary: isapi_redirect.dll corrupts query string when using a
rewrite rule
   Product: Tomcat 5
   Version: Unknown
  Platform: PC
OS/Version: Windows XP
Status: NEW
  Severity: normal
  Priority: P2
 Component: Connector:AJP
AssignedTo: tomcat-dev@jakarta.apache.org
ReportedBy: [EMAIL PROTECTED]
CC: [EMAIL PROTECTED]


I've installed isapi_redirect.dll (tomcat-connectors version 1.2.18) on IIS 5.1.
 Once I got it working it works fine so long as you don't invoke a rewrite rule
that ends up with a longer path and a query string.

In my rewrite_rule_file.properties:
/pub/=/widgetsample/

Hit a servlet that is served by that rewrite
example http://localhost/pub/pf/request.htm?myparam=foo

When the URL hits tomcat, the url is corrupt.
example result http://localhost//widgetsample/pf/request.htm?uest.htm
Should be http://localhost//widgetsample/pf/request.htm?myparam=foo

I debugged into it, and the problem is the call to simple_rewrite in
jk_isapi_plugin.c line 924 is trying to do an in place modification of the path,
which is also the same buffer that the query string is using.

An in place modification is only going to work if the target path is less than
or equal to the length of the starting path.

-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
--- You are receiving this mail because: ---
You are the assignee for the bug, or are watching the assignee.

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