costin 01/11/20 09:49:53 Modified: jk/java/org/apache/ajp Ajp13Packet.java Ajp14.java AjpHandler.java NegociationHandler.java RequestHandler.java Removed: jk/java/org/apache/ajp Ajp14Packet.java Log: Merge Ajp14Packet back into Ajp13Packet ( i.e. no more differences between the wire protocol - headers, etc ). Ajp14 workers should work with ajp13 clients. Revision Changes Path 1.9 +13 -2 jakarta-tomcat-connectors/jk/java/org/apache/ajp/Ajp13Packet.java Index: Ajp13Packet.java =================================================================== RCS file: /home/cvs/jakarta-tomcat-connectors/jk/java/org/apache/ajp/Ajp13Packet.java,v retrieving revision 1.8 retrieving revision 1.9 diff -u -r1.8 -r1.9 --- Ajp13Packet.java 2001/06/24 21:17:49 1.8 +++ Ajp13Packet.java 2001/11/20 17:49:53 1.9 @@ -60,10 +60,18 @@ import java.io.IOException; import java.io.UnsupportedEncodingException; +import java.io.InputStream; +import java.io.OutputStream; +import java.net.Socket; +import java.util.Enumeration; +import java.security.*; -import org.apache.tomcat.util.buf.MessageBytes; import org.apache.tomcat.util.http.MimeHeaders; +import org.apache.tomcat.util.buf.MessageBytes; +import org.apache.tomcat.util.http.HttpMessages; +import org.apache.tomcat.util.buf.HexUtils; + /** * A single packet for communication between the web server and the * container. Designed to be reused many times with no creation of @@ -71,6 +79,9 @@ * Can be used (somewhat confusingly) for both incoming and outgoing * packets. * + * @see Ajp14/Ajp13Packet + * + * @author Henri Gomez [[EMAIL PROTECTED]] * @author Dan Milstein [[EMAIL PROTECTED]] * @author Keith Wannamaker [[EMAIL PROTECTED]] * @author Kevin Seguin @@ -195,7 +206,7 @@ } return len; } - + /** * Prepare this packet for accumulating a message from the container to * the web server. Set the write position to just after the header 1.4 +10 -10 jakarta-tomcat-connectors/jk/java/org/apache/ajp/Ajp14.java Index: Ajp14.java =================================================================== RCS file: /home/cvs/jakarta-tomcat-connectors/jk/java/org/apache/ajp/Ajp14.java,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- Ajp14.java 2001/06/27 15:53:06 1.3 +++ Ajp14.java 2001/11/20 17:49:53 1.4 @@ -79,7 +79,7 @@ * at a time.<P> * * This class contains knowledge about how an individual packet is laid out - * (via the internal <CODE>Ajp14Packet</CODE> class), and also about the + * (via the internal <CODE>Ajp13Packet</CODE> 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. @@ -111,11 +111,11 @@ // XXX public fields are temp. solutions until the API stabilizes // Buffer used of output body and headers - public Ajp14Packet outBuf = new Ajp14Packet( MAX_PACKET_SIZE ); + public Ajp13Packet outBuf = new Ajp13Packet( MAX_PACKET_SIZE ); // Buffer used for input body - Ajp14Packet inBuf = new Ajp14Packet( MAX_PACKET_SIZE ); + Ajp13Packet inBuf = new Ajp13Packet( MAX_PACKET_SIZE ); // Buffer used for request head ( and headers ) - Ajp14Packet hBuf=new Ajp14Packet( MAX_PACKET_SIZE ); + Ajp13Packet hBuf=new Ajp13Packet( MAX_PACKET_SIZE ); // Holds incoming reads of request body data (*not* header data) byte []bodyBuff = new byte[MAX_READ_SIZE]; @@ -142,9 +142,9 @@ public void initBuf() { - outBuf = new Ajp14Packet( MAX_PACKET_SIZE ); - inBuf = new Ajp14Packet( MAX_PACKET_SIZE ); - hBuf = new Ajp14Packet( MAX_PACKET_SIZE ); + outBuf = new Ajp13Packet( MAX_PACKET_SIZE ); + inBuf = new Ajp13Packet( MAX_PACKET_SIZE ); + hBuf = new Ajp13Packet( MAX_PACKET_SIZE ); } public void recycle() { @@ -276,7 +276,7 @@ /** * Read in a packet from the web server and store it in the passed-in - * <CODE>Ajp14Packet</CODE> object. + * <CODE>Ajp13Packet</CODE> object. * * @param msg The object into which to store the incoming packet -- any * current contents will be overwritten. @@ -284,7 +284,7 @@ * @return The number of bytes read on a successful read or -1 if there * was an error. **/ - public int receive(Ajp14Packet msg) throws IOException { + public int receive(Ajp13Packet msg) throws IOException { // XXX If the length in the packet header doesn't agree with the // actual number of bytes read, it should probably return an error // value. Also, callers of this method never use the length @@ -325,7 +325,7 @@ * @param msg A packet with accumulated data to send to the server -- * this method will write out the length in the header. */ - public void send( Ajp14Packet msg ) throws IOException { + public void send( Ajp13Packet msg ) throws IOException { msg.end(); // Write the packet header byte b[] = msg.getBuff(); int len = msg.getLen(); 1.2 +1 -1 jakarta-tomcat-connectors/jk/java/org/apache/ajp/AjpHandler.java Index: AjpHandler.java =================================================================== RCS file: /home/cvs/jakarta-tomcat-connectors/jk/java/org/apache/ajp/AjpHandler.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- AjpHandler.java 2001/06/27 15:47:48 1.1 +++ AjpHandler.java 2001/11/20 17:49:53 1.2 @@ -94,7 +94,7 @@ /** Execute the callback */ public int handleAjpMessage( int type, Ajp14 channel, - Ajp14Packet ajp, BaseRequest req ) + Ajp13Packet ajp, BaseRequest req ) throws IOException { return UNKNOWN; 1.3 +12 -12 jakarta-tomcat-connectors/jk/java/org/apache/ajp/NegociationHandler.java Index: NegociationHandler.java =================================================================== RCS file: /home/cvs/jakarta-tomcat-connectors/jk/java/org/apache/ajp/NegociationHandler.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- NegociationHandler.java 2001/07/02 21:08:52 1.2 +++ NegociationHandler.java 2001/11/20 17:49:53 1.3 @@ -286,11 +286,11 @@ // -------------------- Dispatch -------------------- - public int handleAjpMessage( int type, Ajp14 ch, Ajp14Packet hBuf, + public int handleAjpMessage( int type, Ajp14 ch, Ajp13Packet hBuf, BaseRequest req ) throws IOException { - Ajp14Packet outBuf=ch.outBuf; + Ajp13Packet outBuf=ch.outBuf; // Valid requests when not logged: switch( type ) { case JK_AJP14_LOGINIT_CMD : @@ -326,8 +326,8 @@ * * Send Login Seed (MD5 of seed) */ - private int handleLogInit( Ajp14 ch, Ajp14Packet msg, - Ajp14Packet outBuf ) + private int handleLogInit( Ajp14 ch, Ajp13Packet msg, + Ajp13Packet outBuf ) throws IOException { webserverNegociation = msg.getLongInt(); @@ -353,8 +353,8 @@ * If the authentification is valid send back LogOk * If the authentification failed send back LogNok */ - private int handleLogComp( Ajp14 ch, Ajp14Packet msg, - Ajp14Packet outBuf ) + private int handleLogComp( Ajp14 ch, Ajp13Packet msg, + Ajp13Packet outBuf ) throws IOException { // log("in handleLogComp :"); @@ -403,8 +403,8 @@ return (304); } - private int handleContextQuery( Ajp14 ch, Ajp14Packet msg, - Ajp14Packet outBuf ) + private int handleContextQuery( Ajp14 ch, Ajp13Packet msg, + Ajp13Packet outBuf ) throws IOException { log("in handleContextQuery :"); @@ -434,25 +434,25 @@ return (304); } - private int handleStatus( Ajp14Packet msg, Ajp14Packet outBuf ) throws IOException + private int handleStatus( Ajp13Packet msg, Ajp13Packet outBuf ) throws IOException { log("in handleStatus :"); return (304); } - private int handleShutdown( Ajp14Packet msg, Ajp14Packet outBuf ) throws IOException + private int handleShutdown( Ajp13Packet msg, Ajp13Packet outBuf ) throws IOException { log("in handleShutdown :"); return (304); } - private int handleContextState( Ajp14Packet msg , Ajp14Packet outBuf) throws IOException + private int handleContextState( Ajp13Packet msg , Ajp13Packet outBuf) throws IOException { log("in handleContextState :"); return (304); } - private int handleUnknowPacket( Ajp14Packet msg, Ajp14Packet outBuf ) throws IOException + private int handleUnknowPacket( Ajp13Packet msg, Ajp13Packet outBuf ) throws IOException { log("in handleUnknowPacket :"); return (304); 1.5 +9 -9 jakarta-tomcat-connectors/jk/java/org/apache/ajp/RequestHandler.java Index: RequestHandler.java =================================================================== RCS file: /home/cvs/jakarta-tomcat-connectors/jk/java/org/apache/ajp/RequestHandler.java,v retrieving revision 1.4 retrieving revision 1.5 diff -u -r1.4 -r1.5 --- RequestHandler.java 2001/10/09 18:07:37 1.4 +++ RequestHandler.java 2001/11/20 17:49:53 1.5 @@ -219,7 +219,7 @@ // -------------------- Incoming message -------------------- public int handleAjpMessage( int type, Ajp14 channel, - Ajp14Packet ajp, BaseRequest req ) + Ajp13Packet ajp, BaseRequest req ) throws IOException { switch( type ) { @@ -241,7 +241,7 @@ * * @return 200 in case of a successful decoduing, 500 in case of error. */ - protected int decodeRequest(Ajp14 ch, Ajp14Packet msg, BaseRequest req) + protected int decodeRequest(Ajp14 ch, Ajp13Packet msg, BaseRequest req) throws IOException { @@ -406,7 +406,7 @@ * @param statusMessage the HTTP status message to send. * @param headers The set of all headers. */ - public void sendHeaders(Ajp14 ch, Ajp14Packet outBuf, + public void sendHeaders(Ajp14 ch, Ajp13Packet outBuf, int status, String statusMessage, MimeHeaders headers) throws IOException { @@ -441,7 +441,7 @@ * Signal the web server that the servlet has finished handling this * request, and that the connection can be reused. */ - public void finish(Ajp14 ch, Ajp14Packet outBuf) throws IOException { + public void finish(Ajp14 ch, Ajp13Packet outBuf) throws IOException { if (debug > 0) log("finish()"); outBuf.reset(); @@ -459,7 +459,7 @@ * @param off The offset into the buffer from which to start sending. * @param len The number of bytes to send. */ - public void doWrite(Ajp14 ch, Ajp14Packet outBuf, + public void doWrite(Ajp14 ch, Ajp13Packet outBuf, byte b[], int off, int len) throws IOException { @@ -670,7 +670,7 @@ /** */ - public void beginSendHeaders(Ajp14 ch, Ajp14Packet outBuf, + public void beginSendHeaders(Ajp14 ch, Ajp13Packet outBuf, int status, String statusMessage, int numHeaders) throws IOException { @@ -697,7 +697,7 @@ outBuf.appendInt(numHeaders); } - public void sendHeader(Ajp14Packet outBuf, + public void sendHeader(Ajp13Packet outBuf, String name, String value) throws IOException { @@ -710,7 +710,7 @@ outBuf.appendString(value); } - public void endSendHeaders(Ajp14 ch, Ajp14Packet outBuf) + public void endSendHeaders(Ajp14 ch, Ajp13Packet outBuf) throws IOException { outBuf.end(); @@ -723,7 +723,7 @@ * @param status The HTTP status code to send. * @param headers The set of all headers. */ - public void sendHeaders(Ajp14 ch, Ajp14Packet outBuf, + public void sendHeaders(Ajp14 ch, Ajp13Packet outBuf, int status, MimeHeaders headers) throws IOException { sendHeaders(ch, outBuf, status, HttpMessages.getMessage(status), headers);
-- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>