²diff -Nru /home/ftp/pub/apache.org/jakarta-tomcat-connectors/jk/src/java/org/apache/ajp/Ajp13.java /home/ftp/pub/apache.org/jakarta-tomcat-connectors/jk/src/java/org/apache/ajp/Ajp13.java
--- /home/ftp/pub/apache.org/jakarta-tomcat-connectors/jk/src/java/org/apache/ajp/Ajp13.java Wed May 30 03:34:09 2001
+++ /home/ftp/pub/apache.org/jakarta-tomcat-connectors/jk/src/java/org/apache/ajp/Ajp13.java Tue Jun 5 16:43:46 2001
@@ -89,6 +89,7 @@
* @author Dan Milstein [danmil@shore.net]
* @author Keith Wannamaker [Keith@Wannamaker.org]
* @author Kevin Seguin [seguin@apache.org]
+ * @author Henri Gomez [hgomez@slib.fr]
*/
public class Ajp13 {
@@ -138,6 +139,9 @@
// Terminates list of attributes
public static final byte SC_A_ARE_DONE = (byte)0xFF;
+ // Indicate that SSL info was found in Extra Decode
+ public static final int DECODED_SSL_INFO = 0x0001;
+
// Translates integer codes to names of HTTP methods
public static final String []methodTransArray = {
"OPTIONS",
@@ -198,11 +202,11 @@
InputStream in;
// Buffer used of output body and headers
- Ajp13Packet outBuf = new Ajp13Packet( MAX_PACKET_SIZE );
+ Ajp13Packet outBuf;
// Buffer used for input body
- Ajp13Packet inBuf = new Ajp13Packet( MAX_PACKET_SIZE );
+ Ajp13Packet inBuf;
// Buffer used for request head ( and headers )
- Ajp13Packet hBuf=new Ajp13Packet( MAX_PACKET_SIZE );
+ Ajp13Packet hBuf;
// Holds incoming reads of request body data (*not* header data)
byte []bodyBuff = new byte[MAX_READ_SIZE];
@@ -227,6 +231,12 @@
}
}
+ public Ajp13() {
+ outBuf = new Ajp13Packet( MAX_PACKET_SIZE );
+ inBuf = new Ajp13Packet( MAX_PACKET_SIZE );
+ hBuf = new Ajp13Packet( MAX_PACKET_SIZE );
+ }
+
public void recycle() {
if (debug > 0) {
logger.log("recycle()");
@@ -251,6 +261,10 @@
pos = 0;
}
+ public int decodeExtra(byte ac, Ajp13Packet msg, AjpRequest req) {
+ return (500);
+ }
+
/**
* Read a new packet from the web server and decode it. If it's a
* forwarded request, store its properties in the passed-in AjpRequest
@@ -409,8 +423,17 @@
msg.getString());
break;
+ // Second chance to decode unknown attributes
+ // AJP14 will use it :)
default:
- return 500; // Error
+ int dcd = decodeExtra(attributeCode, msg, req);
+ if (dcd < 0)
+ return 500; // Error
+
+ if ((dcd & DECODED_SSL_INFO) != 0)
+ isSSL = true;
+
+ break;
}
}
diff -Nru /home/ftp/pub/apache.org/jakarta-tomcat-connectors/jk/src/java/org/apache/ajp/Ajp13Packet.java /home/ftp/pub/apache.org/jakarta-tomcat-connectors/jk/src/java/org/apache/ajp/Ajp13Packet.java
--- /home/ftp/pub/apache.org/jakarta-tomcat-connectors/jk/src/java/org/apache/ajp/Ajp13Packet.java Wed May 30 03:34:10 2001
+++ /home/ftp/pub/apache.org/jakarta-tomcat-connectors/jk/src/java/org/apache/ajp/Ajp13Packet.java Tue Jun 5 16:45:36 2001
@@ -69,10 +69,17 @@
* garbage. Understands the format of data types for these packets.
* Can be used (somewhat confusingly) for both incoming and outgoing
* packets.
+ *
+ * @author Dan Milstein [danmil@shore.net]
+ * @author Keith Wannamaker [Keith@Wannamaker.org]
+ * @author Kevin Seguin [seguin@apache.org]
+ * @author Henri Gomez [hgomez@slib.fr]
*/
public class Ajp13Packet {
public static final String DEFAULT_CHAR_ENCODING = "8859_1";
+ public static final int AJP13_WS_HEADER = 0x1234;
+ public static final int AJP13_SW_HEADER = 0x4142; // 'AB'
/**
* encoding to use when converting byte[] <-> string
@@ -179,7 +186,7 @@
int mark = getInt();
len = getInt();
- if( mark != 0x1234 ) {
+ if( mark != AJP13_WS_HEADER ) {
// XXX Logging
System.out.println("BAD packet " + mark);
dump( "In: " );
@@ -196,8 +203,8 @@
public void reset() {
len = 4;
pos = 4;
- buff[0] = (byte)'A';
- buff[1] = (byte)'B';
+ buff[0] = (byte)(AJP13_WS_HEADER >> 8);
+ buff[1] = (byte)(AJP13_WS_HEADER & 0xFF);
}
/**
diff -Nru /home/ftp/pub/apache.org/jakarta-tomcat-connectors/jk/src/java/org/apache/ajp/Ajp14.java /home/ftp/pub/apache.org/jakarta-tomcat-connectors/jk/src/java/org/apache/ajp/Ajp14.java
--- /home/ftp/pub/apache.org/jakarta-tomcat-connectors/jk/src/java/org/apache/ajp/Ajp14.java Thu Jan 1 01:00:00 1970
+++ /home/ftp/pub/apache.org/jakarta-tomcat-connectors/jk/src/java/org/apache/ajp/Ajp14.java Tue Jun 5 16:44:17 2001
@@ -0,0 +1,117 @@
+/*
+ * ====================================================================
+ *
+ * The Apache Software License, Version 1.1
+ *
+ * Copyright (c) 1999 The Apache Software Foundation. All rights
+ * reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * 3. The end-user documentation included with the redistribution, if
+ * any, must include the following acknowlegement:
+ * "This product includes software developed by the
+ * Apache Software Foundation (http://www.apache.org/)."
+ * Alternately, this acknowlegement may appear in the software itself,
+ * if and wherever such third-party acknowlegements normally appear.
+ *
+ * 4. The names "The Jakarta Project", "Tomcat", and "Apache Software
+ * Foundation" must not be used to endorse or promote products derived
+ * from this software without prior written permission. For written
+ * permission, please contact apache@apache.org.
+ *
+ * 5. Products derived from this software may not be called "Apache"
+ * nor may "Apache" appear in their names without prior written
+ * permission of the Apache Group.
+ *
+ * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
+ * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
+ * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ * ====================================================================
+ *
+ * This software consists of voluntary contributions made by many
+ * individuals on behalf of the Apache Software Foundation. For more
+ * information on the Apache Software Foundation, please see
+ *
+ *
+ * This class contains knowledge about how an individual packet is laid out
+ * (via the Ajp14Packet class), and also about the
+ * stages of communicaton between the server and the servlet container. It
+ * translates from Tomcat's internal servlet support methods
+ * (e.g. doWrite) to the correct packets to send to the web server.
+ *
+ * @see Ajp14Interceptor
+ *
+ * @author Dan Milstein [danmil@shore.net]
+ * @author Keith Wannamaker [Keith@Wannamaker.org]
+ * @author Kevin Seguin [seguin@apache.org]
+ * @author Henri Gomez [hgomez@slib.fr]
+ */
+public class Ajp14 extends Ajp13 {
+
+ // SSL_KEY_SIZE as required by Servlet 2.3 API
+ public static final byte SC_A_SSL_KEY_SIZE = 11;
+
+ public Ajp14() {
+ outBuf = new Ajp14Packet( MAX_PACKET_SIZE );
+ inBuf = new Ajp14Packet( MAX_PACKET_SIZE );
+ hBuf = new Ajp14Packet( MAX_PACKET_SIZE );
+ }
+
+ public int decodeExtra(byte ac, Ajp13Packet msg, AjpRequest req) {
+ switch (ac) {
+
+ case SC_A_SSL_KEY_SIZE : // Servlet API 2.3 (at least Proposed Final Draft 2) require key_size
+ req.setAttribute("javax.servlet.request.key_size",
+ Integer.toString(msg.getInt()));
+ return DECODED_SSL_INFO;
+
+ default:
+ return 500; // Error
+ }
+ }
+}
diff -Nru /home/ftp/pub/apache.org/jakarta-tomcat-connectors/jk/src/java/org/apache/ajp/Ajp14Packet.java /home/ftp/pub/apache.org/jakarta-tomcat-connectors/jk/src/java/org/apache/ajp/Ajp14Packet.java
--- /home/ftp/pub/apache.org/jakarta-tomcat-connectors/jk/src/java/org/apache/ajp/Ajp14Packet.java Thu Jan 1 01:00:00 1970
+++ /home/ftp/pub/apache.org/jakarta-tomcat-connectors/jk/src/java/org/apache/ajp/Ajp14Packet.java Tue Jun 5 16:46:05 2001
@@ -0,0 +1,131 @@
+/*
+ * ====================================================================
+ *
+ * The Apache Software License, Version 1.1
+ *
+ * Copyright (c) 1999 The Apache Software Foundation. All rights
+ * reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * 3. The end-user documentation included with the redistribution, if
+ * any, must include the following acknowlegement:
+ * "This product includes software developed by the
+ * Apache Software Foundation (http://www.apache.org/)."
+ * Alternately, this acknowlegement may appear in the software itself,
+ * if and wherever such third-party acknowlegements normally appear.
+ *
+ * 4. The names "The Jakarta Project", "Tomcat", and "Apache Software
+ * Foundation" must not be used to endorse or promote products derived
+ * from this software without prior written permission. For written
+ * permission, please contact apache@apache.org.
+ *
+ * 5. Products derived from this software may not be called "Apache"
+ * nor may "Apache" appear in their names without prior written
+ * permission of the Apache Group.
+ *
+ * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
+ * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
+ * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ * ====================================================================
+ *
+ * This software consists of voluntary contributions made by many
+ * individuals on behalf of the Apache Software Foundation. For more
+ * information on the Apache Software Foundation, please see
+ *