You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by cr...@locus.apache.org on 2000/04/17 02:52:18 UTC
cvs commit: jakarta-tomcat/proposals/catalina/src/share/org/apache/tomcat/connector/http HttpProcessor.java
craigmcc 00/04/16 17:52:17
Modified: proposals/catalina/src/share/org/apache/tomcat/connector/http
HttpProcessor.java
Log:
Parse the query string (if any) as well as the session ID before
setting the request URI for this request.
Revision Changes Path
1.6 +34 -20 jakarta-tomcat/proposals/catalina/src/share/org/apache/tomcat/connector/http/HttpProcessor.java
Index: HttpProcessor.java
===================================================================
RCS file: /home/cvs/jakarta-tomcat/proposals/catalina/src/share/org/apache/tomcat/connector/http/HttpProcessor.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- HttpProcessor.java 2000/04/16 05:13:37 1.5
+++ HttpProcessor.java 2000/04/17 00:52:17 1.6
@@ -1,7 +1,7 @@
/*
- * $Header: /home/cvs/jakarta-tomcat/proposals/catalina/src/share/org/apache/tomcat/connector/http/HttpProcessor.java,v 1.5 2000/04/16 05:13:37 craigmcc Exp $
- * $Revision: 1.5 $
- * $Date: 2000/04/16 05:13:37 $
+ * $Header: /home/cvs/jakarta-tomcat/proposals/catalina/src/share/org/apache/tomcat/connector/http/HttpProcessor.java,v 1.6 2000/04/17 00:52:17 craigmcc Exp $
+ * $Revision: 1.6 $
+ * $Date: 2000/04/17 00:52:17 $
*
* ====================================================================
*
@@ -97,7 +97,7 @@
* the request. When the processor is completed, it will recycle itself.
*
* @author Craig R. McClanahan
- * @version $Revision: 1.5 $ $Date: 2000/04/16 05:13:37 $
+ * @version $Revision: 1.6 $ $Date: 2000/04/17 00:52:17 $
*/
final class HttpProcessor
@@ -151,6 +151,13 @@
/**
+ * The match string for identifying a session ID parameter.
+ */
+ private static final String match =
+ ";" + Constants.SessionParameter + "=";
+
+
+ /**
* The output stream associated with this request.
*/
private OutputStream output = null;
@@ -396,24 +403,31 @@
(sm.getString("httpProcessor.parseRequest.uri"));
}
+ // Parse any query parameters out of the request URI
+ int question = uri.indexOf("?");
+ if (question >= 0) {
+ request.setQueryString(uri.substring(question + 1));
+ uri = uri.substring(0, question);
+ } else
+ request.setQueryString(null);
+
// Parse any requested session ID out of the request URI
- String match = ";" + Constants.SessionParameter + "=";
- int i = uri.indexOf(match);
- if (i >= 0) {
- StringBuffer sb = new StringBuffer(uri.substring(0, i));
- String rest = uri.substring(i + match.length());
- int j = rest.indexOf(";"); // Another parameter
- int k = rest.indexOf("?"); // Query string
- int l = rest.length();
- if ((j >= 0) && (j < l))
- l = j;
- if ((k >= 0) && (k < l))
- l = k;
- request.setRequestedSessionId(rest.substring(0, l));
+ int semicolon = uri.indexOf(match);
+ if (semicolon >= 0) {
+ String rest = uri.substring(semicolon + match.length());
+ int semicolon2 = rest.indexOf(";");
+ if (semicolon2 >= 0) {
+ request.setRequestedSessionId(rest.substring(0, semicolon2));
+ rest = rest.substring(semicolon2);
+ } else {
+ request.setRequestedSessionId(rest);
+ rest = "";
+ }
request.setRequestedSessionURL(true);
- request.setRequestedSessionCookie(false);
- sb.append(rest.substring(l));
- uri = sb.toString();
+ uri = uri.substring(0, semicolon) + rest;
+ } else {
+ request.setRequestedSessionId(null);
+ request.setRequestedSessionURL(false);
}
// Set the corresponding request properties