tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From r...@apache.org
Subject cvs commit: jakarta-tomcat-connectors/jk/java/org/apache/coyote/ajp AjpAprProcessor.java AjpMessage.java
Date Thu, 23 Jun 2005 17:22:13 GMT
remm        2005/06/23 10:22:13

  Modified:    jk/java/org/apache/coyote/ajp AjpAprProcessor.java
                        AjpMessage.java
  Log:
  - Beautify a little.
  
  Revision  Changes    Path
  1.9       +28 -32    jakarta-tomcat-connectors/jk/java/org/apache/coyote/ajp/AjpAprProcessor.java
  
  Index: AjpAprProcessor.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-connectors/jk/java/org/apache/coyote/ajp/AjpAprProcessor.java,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- AjpAprProcessor.java	23 Jun 2005 16:35:26 -0000	1.8
  +++ AjpAprProcessor.java	23 Jun 2005 17:22:13 -0000	1.9
  @@ -52,6 +52,12 @@
    * Processes HTTP requests.
    *
    * @author Remy Maucherat
  + * @author Henri Gomez
  + * @author Dan Milstein
  + * @author Keith Wannamaker
  + * @author Kevin Seguin
  + * @author Costin Manolache
  + * @author Bill Barker
    */
   public class AjpAprProcessor implements ActionHook {
   
  @@ -412,6 +418,7 @@
           return request;
       }
   
  +
       /**
        * Process pipelined HTTP requests using the specified input and output
        * streams.
  @@ -465,7 +472,6 @@
                   // Check message type, process right away and break if 
                   // not regular request processing
                   int type = requestHeaderMessage.getByte();
  -                // FIXME: Any other types which should be checked ?
                   if (type == Constants.JK_AJP13_CPING_REQUEST) {
                       if (Socket.sendb(socket, pongMessageBuffer, 0, 
                               pongMessageBuffer.position()) < 0) {
  @@ -586,7 +592,7 @@
               if ((response.isCommitted()) || !expectation)
                   return;
   
  -            // FIXME: No way to reply to an expectation in AJP ?
  +            // No expectations in AJP
   
           } else if (actionCode == ActionCode.ACTION_CLIENT_FLUSH) {
   
  @@ -751,14 +757,9 @@
               }
               request.setLocalPort(localPort);
   
  -        } else if (actionCode == ActionCode.ACTION_REQ_SSL_CERTIFICATE) {
  -            
  -            // FIXME: Nothing needed here ?
  -            
           } else if (actionCode == ActionCode.ACTION_REQ_SET_BODY_REPLAY) {
               
  -            if( log.isTraceEnabled() )
  -                log.trace("Replay ");
  +            // Set the given bytes as the content
               ByteChunk bc = (ByteChunk) param;
               bodyBytes.setBytes(bc.getBytes(), bc.getStart(), bc.getLength());
               first = false;
  @@ -819,7 +820,6 @@
   
           boolean isSSL = requestHeaderMessage.getByte() != 0;
           if (isSSL) {
  -            // XXX req.setSecure( true );
               request.scheme().setString("https");
           }
   
  @@ -880,13 +880,10 @@
               if (attributeCode == Constants.SC_A_ARE_DONE)
                   break;
   
  -            /* Special case ( XXX in future API make it separate type !)
  -             */
               if (attributeCode == Constants.SC_A_SSL_KEY_SIZE) {
                   // Bug 1326: it's an Integer.
                   request.setAttribute(SSLSupport.KEY_SIZE_KEY,
                                    new Integer(requestHeaderMessage.getInt()));
  -               //Integer.toString(msg.getInt()));
               }
   
               if (attributeCode == Constants.SC_A_REQ_ATTRIBUTE ) {
  @@ -944,21 +941,21 @@
                   requestHeaderMessage.getBytes(certificates);
                   break;
                   
  -            case Constants.SC_A_SSL_CIPHER   :
  -                request.scheme().setString( "https" );
  +            case Constants.SC_A_SSL_CIPHER :
  +                request.scheme().setString("https");
                   requestHeaderMessage.getBytes(tmpMB);
                   request.setAttribute(SSLSupport.CIPHER_SUITE_KEY,
                                    tmpMB.toString());
                   break;
                   
  -            case Constants.SC_A_SSL_SESSION  :
  -                request.scheme().setString( "https" );
  +            case Constants.SC_A_SSL_SESSION :
  +                request.scheme().setString("https");
                   requestHeaderMessage.getBytes(tmpMB);
                   request.setAttribute(SSLSupport.SESSION_ID_KEY, 
                                     tmpMB.toString());
                   break;
                   
  -            case Constants.SC_A_SECRET  :
  +            case Constants.SC_A_SECRET :
                   requestHeaderMessage.getBytes(tmpMB);
                   String secret = tmpMB.toString();
                   if(log.isInfoEnabled())
  @@ -1097,8 +1094,9 @@
           
           responseHeaderMessage.reset();
           responseHeaderMessage.appendByte(Constants.JK_AJP13_SEND_HEADERS);
  -        responseHeaderMessage.appendInt(response.getStatus());
           
  +        // HTTP header contents
  +        responseHeaderMessage.appendInt(response.getStatus());
           String message = response.getMessage();
           if (message == null){
               message= HttpMessages.getMessage(response.getStatus());
  @@ -1108,8 +1106,7 @@
           tmpMB.setString(message);
           responseHeaderMessage.appendBytes(tmpMB);
   
  -        // XXX add headers
  -        
  +        // Special headers
           MimeHeaders headers = response.getMimeHeaders();
           String contentType = response.getContentType();
           if (contentType != null) {
  @@ -1123,6 +1120,8 @@
           if (contentLength >= 0) {
               headers.setValue("Content-Length").setInt(contentLength);
           }
  +        
  +        // Other headers
           int numHeaders = headers.size();
           responseHeaderMessage.appendInt(numHeaders);
           for (int i = 0; i < numHeaders; i++) {
  @@ -1131,6 +1130,8 @@
               MessageBytes hV=headers.getValue(i);
               responseHeaderMessage.appendBytes(hV);
           }
  +        
  +        // Write to buffer
           responseHeaderMessage.end();
           outputBuffer.put(responseHeaderMessage.getBuffer(), 0, responseHeaderMessage.getLen());
   
  @@ -1157,11 +1158,14 @@
               return;
           
           finished = true;
  +        
  +        // Add the end message
           if (outputBuffer.position() + endMessageArray.length > outputBuffer.capacity())
{
               flush();
           }
           outputBuffer.put(endMessageArray);
           flush();
  +        
       }
       
       
  @@ -1235,30 +1239,23 @@
        *  after we send a GET_BODY packet
        */
       public boolean receive() throws IOException {
  +        
           first = false;
           bodyMessage.reset();
           readMessage(bodyMessage, false, false);
  -        if( log.isDebugEnabled() )
  -            log.info( "Receiving: getting request body chunk " + bodyMessage.getLen() );
           
           // No data received.
  -        if( bodyMessage.getLen() == 0 ) { // just the header
  +        if (bodyMessage.getLen() == 0) {
  +            // just the header
               // Don't mark 'end of stream' for the first chunk.
  -            // end_of_stream = true;
               return false;
           }
           int blen = bodyMessage.peekInt();
  -        if( blen == 0 ) {
  +        if (blen == 0) {
               return false;
           }
   
  -        if( log.isTraceEnabled() ) {
  -            bodyMessage.dump("Body buffer");
  -        }
  -        
           bodyMessage.getBytes(bodyBytes);
  -        if( log.isTraceEnabled() )
  -            log.trace( "Data:\n" + bodyBytes);
           empty = false;
           return true;
       }
  @@ -1400,7 +1397,6 @@
   
           }
   
  -
       }
   
   
  
  
  
  1.2       +3 -7      jakarta-tomcat-connectors/jk/java/org/apache/coyote/ajp/AjpMessage.java
  
  Index: AjpMessage.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-connectors/jk/java/org/apache/coyote/ajp/AjpMessage.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- AjpMessage.java	9 Jun 2005 16:14:51 -0000	1.1
  +++ AjpMessage.java	23 Jun 2005 17:22:13 -0000	1.2
  @@ -29,11 +29,9 @@
    * Can be used (somewhat confusingly) for both incoming and outgoing
    * packets.  
    *
  - * See Ajp14/Ajp13Packet.java.
  - *
  - * @author Henri Gomez [hgomez@apache.org]
  - * @author Dan Milstein [danmil@shore.net]
  - * @author Keith Wannamaker [Keith@Wannamaker.org]
  + * @author Henri Gomez
  + * @author Dan Milstein
  + * @author Keith Wannamaker
    * @author Kevin Seguin
    * @author Costin Manolache
    */
  @@ -53,8 +51,6 @@
        */
       private int len; 
   
  -
  -    
       
       /**
        * Prepare this packet for accumulating a message from the container to
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-dev-help@jakarta.apache.org


Mime
View raw message