funkman     2004/09/14 17:16:05

  Modified:    http11/src/java/org/apache/coyote/http11
                        Http11Processor.java Http11Protocol.java
  Log:
  Allow for customized server header at config time.
  So now one can do this:
  
      <Connector port="8080" server="TinFoil Hats R US (1.00)"  />
  
  Revision  Changes    Path
  1.110     +116 -90   
jakarta-tomcat-connectors/http11/src/java/org/apache/coyote/http11/Http11Processor.java
  
  Index: Http11Processor.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-tomcat-connectors/http11/src/java/org/apache/coyote/http11/Http11Processor.java,v
  retrieving revision 1.109
  retrieving revision 1.110
  diff -u -r1.109 -r1.110
  --- Http11Processor.java      13 Sep 2004 21:39:39 -0000      1.109
  +++ Http11Processor.java      15 Sep 2004 00:16:05 -0000      1.110
  @@ -56,7 +56,7 @@
   
   /**
    * Processes HTTP requests.
  - * 
  + *
    * @author Remy Maucherat
    */
   public class Http11Processor implements Processor, ActionHook {
  @@ -65,7 +65,7 @@
       /**
        * Logger.
        */
  -    protected static org.apache.commons.logging.Log log 
  +    protected static org.apache.commons.logging.Log log
           = org.apache.commons.logging.LogFactory.getLog(Http11Processor.class);
   
   
  @@ -210,31 +210,31 @@
        * Remote Host associated with the current connection.
        */
       protected String remoteHost = null;
  -    
  -    
  +
  +
       /**
        * Local Host associated with the current connection.
        */
       protected String localName = null;
  -    
  -    
  -    
  +
  +
  +
       /**
        * Local port to which the socket is connected
        */
       protected int localPort = -1;
  -    
  -    
  +
  +
       /**
        * Remote port to which the socket is connected
        */
       protected int remotePort = -1;
  -    
  -    
  +
  +
       /**
        * The local Host address.
        */
  -    protected String localAddr = null; 
  +    protected String localAddr = null;
   
   
       /**
  @@ -277,11 +277,11 @@
        * List of user agents to not use gzip with
        */
       protected Pattern noCompressionUserAgents[] = null;
  -    
  +
       /**
        * List of MIMES which could be gzipped
        */
  -    protected String[] compressableMimeTypes = 
  +    protected String[] compressableMimeTypes =
       { "text/html", "text/xml", "text/plain" };
   
   
  @@ -297,6 +297,12 @@
       protected ThreadPool threadPool;
   
   
  +    /**
  +     * Allow a customized the server header for the tin-foil hat folks.
  +     */
  +    protected String server = Constants.SERVER;
  +
  +
       // ------------------------------------------------------------- Properties
   
   
  @@ -344,7 +350,7 @@
       public void setCompressionMinSize(int compressionMinSize) {
           this.compressionMinSize = compressionMinSize;
       }
  -    
  +
   
       public void setThreadPool(ThreadPool threadPool) {
           this.threadPool = threadPool;
  @@ -354,13 +360,13 @@
        * Add user-agent for which gzip compression didn't works
        * The user agent String given will be exactly matched
        * to the user-agent header submitted by the client.
  -     * 
  +     *
        * @param userAgent user-agent string
        */
       public void addNoCompressionUserAgent(String userAgent) {
           try {
               Pattern nRule = Pattern.compile(userAgent);
  -            noCompressionUserAgents = 
  +            noCompressionUserAgents =
                   addREArray(noCompressionUserAgents, nRule);
           } catch (PatternSyntaxException pse) {
               log.error("Error parsing regular expression: " + userAgent, pse);
  @@ -369,8 +375,8 @@
   
   
       /**
  -     * Set no compression user agent list (this method is best when used with 
  -     * a large number of connectors, where it would be better to have all of 
  +     * Set no compression user agent list (this method is best when used with
  +     * a large number of connectors, where it would be better to have all of
        * them referenced a single array).
        */
       public void setNoCompressionUserAgents(Pattern[] noCompressionUserAgents) {
  @@ -381,13 +387,13 @@
       /**
        * Set no compression user agent list.
        * List contains users agents separated by ',' :
  -     * 
  +     *
        * ie: "gorilla,desesplorer,tigrus"
        */
       public void setNoCompressionUserAgents(String noCompressionUserAgents) {
           if (noCompressionUserAgents != null) {
               StringTokenizer st = new StringTokenizer(noCompressionUserAgents, ",");
  -        
  +
               while (st.hasMoreTokens()) {
                   addNoCompressionUserAgent(st.nextToken().trim());
               }
  @@ -398,18 +404,18 @@
        * Add a mime-type which will be compressable
        * The mime-type String will be exactly matched
        * in the response mime-type header .
  -     * 
  +     *
        * @param mimeType mime-type string
        */
       public void addCompressableMimeType(String mimeType) {
  -        compressableMimeTypes = 
  +        compressableMimeTypes =
               addStringArray(compressableMimeTypes, mimeType);
       }
   
   
       /**
  -     * Set compressable mime-type list (this method is best when used with 
  -     * a large number of connectors, where it would be better to have all of 
  +     * Set compressable mime-type list (this method is best when used with
  +     * a large number of connectors, where it would be better to have all of
        * them referenced a single array).
        */
       public void setCompressableMimeTypes(String[] compressableMimeTypes) {
  @@ -420,7 +426,7 @@
       /**
        * Set compressable mime-type list
        * List contains users agents separated by ',' :
  -     * 
  +     *
        * ie: "text/html,text/xml,text/plain"
        */
       public void setCompressableMimeTypes(String compressableMimeTypes) {
  @@ -448,7 +454,7 @@
   
       /**
        * Add input or output filter.
  -     * 
  +     *
        * @param className class name of the filter
        */
       protected void addFilter(String className) {
  @@ -470,8 +476,8 @@
   
       /**
        * General use method
  -     * 
  -     * @param sArray the StringArray 
  +     *
  +     * @param sArray the StringArray
        * @param value string
        */
       private String[] addStringArray(String sArray[], String value) {
  @@ -492,8 +498,8 @@
   
       /**
        * General use method
  -     * 
  -     * @param rArray the REArray 
  +     *
  +     * @param rArray the REArray
        * @param value Obj
        */
       private Pattern[] addREArray(Pattern rArray[], Pattern value) {
  @@ -502,7 +508,7 @@
               result = new Pattern[1];
               result[0] = value;
           }
  -        else {    
  +        else {
               result = new Pattern[rArray.length + 1];
               for (int i = 0; i < rArray.length; i++)
                   result[i] = rArray[i];
  @@ -514,8 +520,8 @@
   
       /**
        * General use method
  -     * 
  -     * @param sArray the StringArray 
  +     *
  +     * @param sArray the StringArray
        * @param value string
        */
       private boolean inStringArray(String sArray[], String value) {
  @@ -547,10 +553,10 @@
   
   
       /**
  -     * Add restricted user-agent (which will downgrade the connector 
  +     * Add restricted user-agent (which will downgrade the connector
        * to HTTP/1.0 mode). The user agent String given will be matched
        * via regexp to the user-agent header submitted by the client.
  -     * 
  +     *
        * @param userAgent user-agent string
        */
       public void addRestrictedUserAgent(String userAgent) {
  @@ -564,8 +570,8 @@
   
   
       /**
  -     * Set restricted user agent list (this method is best when used with 
  -     * a large number of connectors, where it would be better to have all of 
  +     * Set restricted user agent list (this method is best when used with
  +     * a large number of connectors, where it would be better to have all of
        * them referenced a single array).
        */
       public void setRestrictedUserAgents(Pattern[] restrictedUserAgents) {
  @@ -576,12 +582,12 @@
       /**
        * Set restricted user agent list (which will downgrade the connector
        * to HTTP/1.0 mode). List contains users agents separated by ',' :
  -     * 
  +     *
        * ie: "gorilla,desesplorer,tigrus"
        */
       public void setRestrictedUserAgents(String restrictedUserAgents) {
           if (restrictedUserAgents != null) {
  -            StringTokenizer st = 
  +            StringTokenizer st =
                   new StringTokenizer(restrictedUserAgents, ",");
               while (st.hasMoreTokens()) {
                   addRestrictedUserAgent(st.nextToken().trim());
  @@ -595,10 +601,10 @@
        */
       public String[] findRestrictedUserAgents() {
           String[] sarr = new String [restrictedUserAgents.length];
  -        
  +
           for (int i = 0; i < restrictedUserAgents.length; i++)
               sarr[i] = restrictedUserAgents[i].toString();
  -            
  +
           return (sarr);
       }
   
  @@ -696,6 +702,26 @@
           return timeout;
       }
   
  +
  +    /**
  +     * Set the server header name.
  +     */
  +    public void setServer( String server ) {
  +        if (server==null || server.equals("")) {
  +            this.server = Constants.SERVER;
  +        } else {
  +            this.server = server;
  +        }
  +    }
  +
  +    /**
  +     * Get the server header name.
  +     */
  +    public String getServer() {
  +        return server;
  +    }
  +
  +
       /** Get the request associated with this processor.
        *
        * @return The request
  @@ -707,7 +733,7 @@
       /**
        * Process pipelined HTTP requests using the specified input and output
        * streams.
  -     * 
  +     *
        * @param input stream from which the HTTP requests will be read
        * @param output stream which will be used to output the HTTP
        * responses
  @@ -727,7 +753,7 @@
           localAddr = null;
           remotePort = -1;
           localPort = -1;
  -        
  +
           // Setting up the I/O
           inputBuffer.setInputStream(input);
           outputBuffer.setOutputStream(output);
  @@ -739,8 +765,8 @@
           int keepAliveLeft = maxKeepAliveRequests;
           int soTimeout = socket.getSoTimeout();
   
  -        float threadRatio = 
  -            (float) threadPool.getCurrentThreadsBusy() 
  +        float threadRatio =
  +            (float) threadPool.getCurrentThreadsBusy()
               / (float) threadPool.getMaxThreads();
           if ((threadRatio > 0.33) && (threadRatio <= 0.66)) {
               soTimeout = soTimeout / 2;
  @@ -800,7 +826,7 @@
                       // Handle when the response was committed before a serious
                       // error occurred.  Throwing a ServletException should both
                       // set the status to 500 and set the errorException.
  -                    // If we fail here, then the response is likely already 
  +                    // If we fail here, then the response is likely already
                       // committed, so we can't try and set headers.
                       if(keepAlive && !error) { // Avoid checking twice.
                           error = response.getErrorException() != null ||
  @@ -876,7 +902,7 @@
   
       /**
        * Send an action to the connector.
  -     * 
  +     *
        * @param actionCode Type of the action
        * @param param Action parameter
        */
  @@ -989,12 +1015,12 @@
                   InetAddress inetAddr = socket.getInetAddress();
                   if (inetAddr != null) {
                       remoteAddr = inetAddr.getHostAddress();
  -                }   
  +                }
               }
               request.remoteAddr().setString(remoteAddr);
   
           } else if (actionCode == ActionCode.ACTION_REQ_LOCAL_NAME_ATTRIBUTE) {
  -            
  +
               if ((localName == null) && (socket != null)) {
                   InetAddress inetAddr = socket.getLocalAddress();
                   if (inetAddr != null) {
  @@ -1004,7 +1030,7 @@
               request.localName().setString(localName);
   
           } else if (actionCode == ActionCode.ACTION_REQ_HOST_ATTRIBUTE) {
  -            
  +
               if ((remoteHost == null) && (socket != null)) {
                   InetAddress inetAddr = socket.getInetAddress();
                   if (inetAddr != null) {
  @@ -1012,28 +1038,28 @@
                   }
               }
               request.remoteHost().setString(remoteHost);
  -            
  +
           } else if (actionCode == ActionCode.ACTION_REQ_LOCAL_ADDR_ATTRIBUTE) {
  -                       
  +
               if (localAddr == null)
                  localAddr = socket.getLocalAddress().getHostAddress();
   
               request.localAddr().setString(localAddr);
  -            
  +
           } else if (actionCode == ActionCode.ACTION_REQ_REMOTEPORT_ATTRIBUTE) {
  -            
  +
               if ((remotePort == -1 ) && (socket !=null)) {
  -                remotePort = socket.getPort(); 
  -            }    
  +                remotePort = socket.getPort();
  +            }
               request.setRemotePort(remotePort);
   
           } else if (actionCode == ActionCode.ACTION_REQ_LOCALPORT_ATTRIBUTE) {
  -            
  +
               if ((localPort == -1 ) && (socket !=null)) {
  -                localPort = socket.getLocalPort(); 
  -            }            
  +                localPort = socket.getLocalPort();
  +            }
               request.setLocalPort(localPort);
  -       
  +
           } else if (actionCode == ActionCode.ACTION_REQ_SSL_CERTIFICATE) {
               if( sslSupport != null) {
                   /*
  @@ -1065,7 +1091,7 @@
   
       /**
        * Set the associated adapter.
  -     * 
  +     *
        * @param adapter the new adapter
        */
       public void setAdapter(Adapter adapter) {
  @@ -1075,7 +1101,7 @@
   
       /**
        * Get the associated adapter.
  -     * 
  +     *
        * @return the associated adapter
        */
       public Adapter getAdapter() {
  @@ -1127,14 +1153,14 @@
           }
   
           MimeHeaders headers = request.getMimeHeaders();
  -        
  +
           // Check connection header
           MessageBytes connectionValueMB = headers.getValue("connection");
           if (connectionValueMB != null) {
               ByteChunk connectionValueBC = connectionValueMB.getByteChunk();
               if (findBytes(connectionValueBC, Constants.CLOSE_BYTES) != -1) {
                   keepAlive = false;
  -            } else if (findBytes(connectionValueBC, 
  +            } else if (findBytes(connectionValueBC,
                                    Constants.KEEPALIVE_BYTES) != -1) {
                   keepAlive = true;
               }
  @@ -1152,7 +1178,7 @@
           // Check user-agent header
           if ((restrictedUserAgents != null) && ((http11) || (keepAlive))) {
               MessageBytes userAgentValueMB = headers.getValue("user-agent");
  -            // Check in the restricted list, and adjust the http11 
  +            // Check in the restricted list, and adjust the http11
               // and keepAlive flags accordingly
               if(userAgentValueMB != null) {
                   String userAgentValue = userAgentValueMB.toString();
  @@ -1183,11 +1209,11 @@
                           (uriB, uriBCStart + pos + 1, 1);
                   } else {
                       request.requestURI().setBytes
  -                        (uriB, uriBCStart + slashPos, 
  +                        (uriB, uriBCStart + slashPos,
                            uriBC.getLength() - slashPos);
                   }
                   MessageBytes hostMB = headers.setValue("host");
  -                hostMB.setBytes(uriB, uriBCStart + pos + 3, 
  +                hostMB.setBytes(uriB, uriBCStart + pos + 3,
                                   slashPos - pos - 3);
               }
   
  @@ -1248,7 +1274,7 @@
           parseHost(valueMB);
   
           if (!contentDelimitation) {
  -            // If there's no content length and we're using keep-alive 
  +            // If there's no content length and we're using keep-alive
               // (HTTP/1.0 with keep-alive or HTTP/1.1), assume
               // the client is not broken and didn't send a body
               if (keepAlive) {
  @@ -1271,11 +1297,11 @@
   
           if (valueMB == null || valueMB.isNull()) {
               // HTTP/1.0
  -            // Default is what the socket tells us. Overriden if a host is 
  +            // Default is what the socket tells us. Overriden if a host is
               // found/parsed
               request.setServerPort(socket.getLocalPort());
               InetAddress localAddress = socket.getLocalAddress();
  -            // Setting the socket-related fields. The adapter doesn't know 
  +            // Setting the socket-related fields. The adapter doesn't know
               // about socket.
               request.setLocalHost(localAddress.getHostName());
               request.serverName().setString(localAddress.getHostName());
  @@ -1347,16 +1373,16 @@
   
           // Nope Compression could works in HTTP 1.0 also
           // cf: mod_deflate
  -        
  +
           // Compression only since HTTP 1.1
           // if (! http11)
           //    return false;
   
           // Check if browser support gzip encoding
  -        MessageBytes acceptEncodingMB = 
  +        MessageBytes acceptEncodingMB =
               request.getMimeHeaders().getValue("accept-encoding");
  -            
  -        if ((acceptEncodingMB == null) 
  +
  +        if ((acceptEncodingMB == null)
               || (acceptEncodingMB.indexOf("gzip") == -1))
               return false;
   
  @@ -1364,7 +1390,7 @@
           MessageBytes contentEncodingMB =
               response.getMimeHeaders().getValue("Content-Encoding");
   
  -        if ((contentEncodingMB != null) 
  +        if ((contentEncodingMB != null)
               && (contentEncodingMB.indexOf("gzip") != -1))
               return false;
   
  @@ -1374,7 +1400,7 @@
   
           // Check for incompatible Browser
           if (noCompressionUserAgents != null) {
  -            MessageBytes userAgentValueMB =  
  +            MessageBytes userAgentValueMB =
                   request.getMimeHeaders().getValue("user-agent");
               if(userAgentValueMB != null) {
                   String userAgentValue = userAgentValueMB.toString();
  @@ -1386,13 +1412,13 @@
               }
           }
   
  -        // Check if suffisant len to trig the compression        
  +        // Check if suffisant len to trig the compression
           int contentLength = response.getContentLength();
  -        if ((contentLength == -1) 
  +        if ((contentLength == -1)
               || (contentLength > compressionMinSize)) {
               // Check for compatible MIME-TYPE
               if (compressableMimeTypes != null) {
  -                return (startsWithStringArray(compressableMimeTypes, 
  +                return (startsWithStringArray(compressableMimeTypes,
                                                 response.getContentType()));
               }
           }
  @@ -1420,7 +1446,7 @@
           }
   
           int statusCode = response.getStatus();
  -        if ((statusCode == 204) || (statusCode == 205) 
  +        if ((statusCode == 204) || (statusCode == 205)
               || (statusCode == 304)) {
               // No entity body
               outputBuffer.addActiveFilter
  @@ -1441,7 +1467,7 @@
           boolean useCompression = false;
           if (entityBody && (compressionLevel > 0)) {
               useCompression = isCompressable();
  -            
  +
               // Change content-length to -1 to force chunking
               if (useCompression) {
                   response.setContentLength(-1);
  @@ -1491,7 +1517,7 @@
           // Add date header
           String date = null;
           if (System.getSecurityManager() != null){
  -            date = (String)AccessController.doPrivileged( 
  +            date = (String)AccessController.doPrivileged(
                       new PrivilegedAction() {
                           public Object run(){
                               return FastHttpDateFormat.getCurrentDate();
  @@ -1504,12 +1530,12 @@
           headers.setValue("Date").setString(date);
   
           // Add server header
  -        headers.setValue("Server").setString(Constants.SERVER);
  +        headers.setValue("Server").setString(server);
   
           // FIXME: Add transfer encoding header
   
           if ((entityBody) && (!contentDelimitation)) {
  -            // Mark as close the connection after the request, and add the 
  +            // Mark as close the connection after the request, and add the
               // connection: close header
               keepAlive = false;
           }
  @@ -1564,11 +1590,11 @@
   
       /**
        * Add an input filter to the current request.
  -     * 
  -     * @return false if the encoding was not found (which would mean it is 
  +     *
  +     * @return false if the encoding was not found (which would mean it is
        * unsupported)
        */
  -    protected boolean addInputFilter(InputFilter[] inputFilters, 
  +    protected boolean addInputFilter(InputFilter[] inputFilters,
                                        String encodingName) {
           if (encodingName.equals("identity")) {
               // Skip
  @@ -1601,9 +1627,9 @@
           int start = bc.getStart();
           int end = bc.getEnd();
   
  -    // Look for first char 
  +    // Look for first char
       int srcEnd = b.length;
  -        
  +
       for (int i = start; i <= (end - srcEnd); i++) {
           if (Ascii.toLower(buff[i]) != first) continue;
           // found first char, now look for a match
  
  
  
  1.56      +88 -76    
jakarta-tomcat-connectors/http11/src/java/org/apache/coyote/http11/Http11Protocol.java
  
  Index: Http11Protocol.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-tomcat-connectors/http11/src/java/org/apache/coyote/http11/Http11Protocol.java,v
  retrieving revision 1.55
  retrieving revision 1.56
  diff -u -r1.55 -r1.56
  --- Http11Protocol.java       27 May 2004 18:29:35 -0000      1.55
  +++ Http11Protocol.java       15 Sep 2004 00:16:05 -0000      1.56
  @@ -100,7 +100,7 @@
           return (String)getAttribute(name);
       }
   
  -    /** The adapter, used to call the connector 
  +    /** The adapter, used to call the connector
        */
       public void setAdapter(Adapter adapter) {
           this.adapter=adapter;
  @@ -110,7 +110,7 @@
           return adapter;
       }
   
  -    
  +
       /** Start the protocol
        */
       public void init() throws Exception {
  @@ -142,10 +142,10 @@
           log.info(sm.getString("http11protocol.init", getName()));
   
       }
  -    
  +
       ObjectName tpOname;
       ObjectName rgOname;
  -    
  +
       public void start() throws Exception {
           if( this.domain != null ) {
               try {
  @@ -199,20 +199,20 @@
       public void destroy() throws Exception {
           log.info(sm.getString("http11protocol.stop", getName()));
           ep.stopEndpoint();
  -        if( tpOname!=null ) 
  +        if( tpOname!=null )
               Registry.getRegistry(null, null).unregisterComponent(tpOname);
  -        if( rgOname != null ) 
  +        if( rgOname != null )
               Registry.getRegistry(null, null).unregisterComponent(rgOname);
       }
  -    
  +
       // -------------------- Properties--------------------
       protected ThreadPool tp=ThreadPool.createThreadPool(true);
       protected PoolTcpEndpoint ep=new PoolTcpEndpoint(tp);
       protected boolean secure;
  -    
  +
       protected ServerSocketFactory socketFactory;
       protected SSLImplementation sslImplementation;
  -    // socket factory attriubtes ( XXX replace with normal setters ) 
  +    // socket factory attriubtes ( XXX replace with normal setters )
       protected Hashtable attributes = new Hashtable();
       protected String socketFactoryName=null;
       protected String sslImplementationName=null;
  @@ -236,13 +236,15 @@
       private String restrictedUserAgents = null;
       private String compressableMimeTypes = "text/html,text/xml,text/plain";
       private int compressionMinSize    = 2048;
  -    
  +
  +    private String server;
  +
       // -------------------- Pool setup --------------------
   
       public boolean getPools(){
           return ep.isPoolOn();
       }
  -    
  +
       public void setPools( boolean t ) {
           ep.setPoolOn(t);
           setAttribute("pools", "" + t);
  @@ -251,7 +253,7 @@
       public int getMaxThreads() {
           return ep.getMaxThreads();
       }
  -    
  +
       public void setMaxThreads( int maxThreads ) {
           ep.setMaxThreads(maxThreads);
           setAttribute("maxThreads", "" + maxThreads);
  @@ -260,12 +262,12 @@
       public int getMaxSpareThreads() {
           return ep.getMaxSpareThreads();
       }
  -    
  +
       public void setMaxSpareThreads( int maxThreads ) {
           ep.setMaxSpareThreads(maxThreads);
           setAttribute("maxSpareThreads", "" + maxThreads);
       }
  -    
  +
       public int getMinSpareThreads() {
           return ep.getMinSpareThreads();
       }
  @@ -289,16 +291,16 @@
       public int getBacklog() {
           return ep.getBacklog();
       }
  -    
  +
       public void setBacklog( int i ) {
           ep.setBacklog(i);
           setAttribute("backlog", "" + i);
       }
  -    
  +
       public int getPort() {
           return ep.getPort();
       }
  -    
  +
       public void setPort( int port ) {
           ep.setPort(port);
           setAttribute("port", "" + port);
  @@ -308,12 +310,12 @@
       public InetAddress getAddress() {
           return ep.getAddress();
       }
  -    
  +
       public void setAddress(InetAddress ia) {
           ep.setAddress( ia );
           setAttribute("address", "" + ia);
       }
  -    
  +
       public String getName() {
           String encodedAddr = "";
           if (getAddress() != null) {
  @@ -324,7 +326,7 @@
           }
           return ("http-" + encodedAddr + ep.getPort());
       }
  -    
  +
       // commenting out for now since it's not doing anything
       //public void setHostName( String name ) {
       // ??? Doesn't seem to be used in existing or prev code
  @@ -334,25 +336,25 @@
       public String getSocketFactory() {
           return socketFactoryName;
       }
  -    
  +
       public void setSocketFactory( String valueS ) {
           socketFactoryName = valueS;
           setAttribute("socketFactory", valueS);
       }
  -    
  +
       public String getSSLImplementation() {
           return sslImplementationName;
       }
  -    
  +
       public void setSSLImplementation( String valueS) {
           sslImplementationName = valueS;
           setAttribute("sslImplementation", valueS);
       }
  -    
  +
       public boolean getTcpNoDelay() {
           return ep.getTcpNoDelay();
       }
  -    
  +
       public void setTcpNoDelay( boolean b ) {
           ep.setTcpNoDelay( b );
           setAttribute("tcpNoDelay", "" + b);
  @@ -361,7 +363,7 @@
       public boolean getDisableUploadTimeout() {
           return disableUploadTimeout;
       }
  -    
  +
       public void setDisableUploadTimeout(boolean isDisabled) {
           disableUploadTimeout = isDisabled;
       }
  @@ -369,7 +371,7 @@
       public int getSocketBuffer() {
           return socketBuffer;
       }
  -    
  +
       public void setSocketBuffer(int valueI) {
           socketBuffer = valueI;
       }
  @@ -377,7 +379,7 @@
       public String getCompression() {
           return compression;
       }
  -    
  +
       public void setCompression(String valueS) {
           compression = valueS;
           setAttribute("compression", valueS);
  @@ -386,7 +388,7 @@
       public int getMaxPostSize() {
           return maxPostSize;
       }
  -    
  +
       public void setMaxPostSize(int valueI) {
           maxPostSize = valueI;
           setAttribute("maxPostSize", "" + valueI);
  @@ -395,7 +397,7 @@
       public int getMaxHttpHeaderSize() {
           return maxHttpHeaderSize;
       }
  -    
  +
       public void setMaxHttpHeaderSize(int valueI) {
           maxHttpHeaderSize = valueI;
           setAttribute("maxHttpHeaderSize", "" + valueI);
  @@ -404,7 +406,7 @@
       public String getRestrictedUserAgents() {
           return restrictedUserAgents;
       }
  -    
  +
       public void setRestrictedUserAgents(String valueS) {
           restrictedUserAgents = valueS;
           setAttribute("restrictedUserAgents", valueS);
  @@ -413,7 +415,7 @@
       public String getNoCompressionUserAgents() {
           return noCompressionUserAgents;
       }
  -    
  +
       public void setNoCompressionUserAgents(String valueS) {
           noCompressionUserAgents = valueS;
           setAttribute("noCompressionUserAgents", valueS);
  @@ -422,7 +424,7 @@
       public String getCompressableMimeType() {
           return compressableMimeTypes;
       }
  -    
  +
       public void setCompressableMimeType(String valueS) {
           compressableMimeTypes = valueS;
           setAttribute("compressableMimeTypes", valueS);
  @@ -431,7 +433,7 @@
       public int getCompressionMinSize() {
           return compressionMinSize;
       }
  -    
  +
       public void setCompressionMinSize(int valueI) {
           compressionMinSize = valueI;
           setAttribute("compressionMinSize", "" + valueI);
  @@ -440,7 +442,7 @@
       public int getSoLinger() {
           return ep.getSoLinger();
       }
  -    
  +
       public void setSoLinger( int i ) {
           ep.setSoLinger( i );
           setAttribute("soLinger", "" + i);
  @@ -449,25 +451,25 @@
       public int getSoTimeout() {
           return ep.getSoTimeout();
       }
  -    
  +
       public void setSoTimeout( int i ) {
           ep.setSoTimeout(i);
           setAttribute("soTimeout", "" + i);
       }
  -    
  +
       public int getServerSoTimeout() {
           return ep.getServerSoTimeout();
       }
  -    
  +
       public void setServerSoTimeout( int i ) {
           ep.setServerSoTimeout(i);
           setAttribute("serverSoTimeout", "" + i);
       }
  -    
  +
       public String getKeystore() {
           return getProperty("keystore");
       }
  -    
  +
       public void setKeystore( String k ) {
           setAttribute("keystore", k);
       }
  @@ -475,16 +477,16 @@
       public String getKeypass() {
           return getProperty("keypass");
       }
  -    
  +
       public void setKeypass( String k ) {
           attributes.put("keypass", k);
           //setAttribute("keypass", k);
       }
  -    
  +
       public String getKeytype() {
           return getProperty("keystoreType");
       }
  -    
  +
       public void setKeytype( String k ) {
           setAttribute("keystoreType", k);
       }
  @@ -492,7 +494,7 @@
       public String getClientauth() {
           return getProperty("clientauth");
       }
  -    
  +
       public void setClientauth( String k ) {
           setAttribute("clientauth", k);
       }
  @@ -500,7 +502,7 @@
       public String getProtocol() {
           return getProperty("protocol");
       }
  -    
  +
       public void setProtocol( String k ) {
           setAttribute("protocol", k);
       }
  @@ -508,7 +510,7 @@
       public String getProtocols() {
           return getProperty("protocols");
       }
  -    
  +
       public void setProtocols(String k) {
           setAttribute("protocols", k);
       }
  @@ -516,7 +518,7 @@
       public String getAlgorithm() {
           return getProperty("algorithm");
       }
  -    
  +
       public void setAlgorithm( String k ) {
           setAttribute("algorithm", k);
       }
  @@ -524,7 +526,7 @@
       public boolean getSecure() {
           return secure;
       }
  -    
  +
       public void setSecure( boolean b ) {
           secure=b;
           setAttribute("secure", "" + b);
  @@ -533,7 +535,7 @@
       public String getCiphers() {
           return getProperty("ciphers");
       }
  -    
  +
       public void setCiphers(String ciphers) {
           setAttribute("ciphers", ciphers);
       }
  @@ -541,7 +543,7 @@
       public String getKeyAlias() {
           return getProperty("keyAlias");
       }
  -    
  +
       public void setKeyAlias(String keyAlias) {
           setAttribute("keyAlias", keyAlias);
       }
  @@ -549,7 +551,7 @@
       public int getMaxKeepAliveRequests() {
           return maxKeepAliveRequests;
       }
  -    
  +
       /** Set the maximum number of Keep-Alive requests that we will honor.
        */
       public void setMaxKeepAliveRequests(int mkar) {
  @@ -560,12 +562,21 @@
       public int getSocketCloseDelay() {
           return socketCloseDelay;
       }
  -    
  +
       public void setSocketCloseDelay( int d ) {
           socketCloseDelay=d;
           setAttribute("socketCloseDelay", "" + d);
       }
   
  +    public void setServer( String server ) {
  +        this.server = server;
  +    }
  +
  +    public String getServer() {
  +        return server;
  +    }
  +
  +
       private static ServerSocketFactory string2SocketFactory( String val)
       throws ClassNotFoundException, IllegalAccessException,
       InstantiationException
  @@ -577,7 +588,7 @@
       public int getTimeout() {
           return timeout;
       }
  -    
  +
       public void setTimeout( int timeouts ) {
           timeout = timeouts * 1000;
           setAttribute("timeout", "" + timeouts);
  @@ -586,19 +597,19 @@
       public String getReportedname() {
           return reportedname;
       }
  -    
  +
       public void setReportedname( String reportedName) {
           reportedname = reportedName;
       }
  -    
  +
       // --------------------  Connection handler --------------------
       public static final int THREAD_DATA_PROCESSOR=1;
       public static final int THREAD_DATA_OBJECT_NAME=2;
  -    
  -    
  +
  +
       static class MXPoolListener implements ThreadPool.ThreadPoolListener {
           MXPoolListener( Http11Protocol proto, ThreadPool control ) {
  -            
  +
           }
   
           public void threadStart(ThreadPool tp, Thread t) {
  @@ -618,7 +629,7 @@
               ObjectName 
oname=(ObjectName)tpData[Http11Protocol.THREAD_DATA_OBJECT_NAME];
               if( oname==null ) return;
               Registry.getRegistry(null, null).unregisterComponent(oname);
  -            Http11Processor processor = 
  +            Http11Processor processor =
                   (Http11Processor) tpData[Http11Protocol.THREAD_DATA_PROCESSOR];
               RequestInfo rp=processor.getRequest().getRequestProcessor();
               rp.setGlobalProcessor(null);
  @@ -633,17 +644,17 @@
           Http11ConnectionHandler( Http11Protocol proto ) {
               this.proto=proto;
           }
  -        
  +
           public void setAttribute( String name, Object value ) {
           }
  -        
  +
           public void setServer( Object o ) {
           }
  -    
  +
           public Object[] init() {
               Object thData[]=new Object[3];
  -            
  -            Http11Processor  processor = 
  +
  +            Http11Processor  processor =
                   new Http11Processor(proto.maxHttpHeaderSize);
               processor.setAdapter( proto.adapter );
               processor.setThreadPool( proto.tp );
  @@ -657,15 +668,16 @@
               processor.setRestrictedUserAgents( proto.restrictedUserAgents);
               processor.setSocketBuffer( proto.socketBuffer );
               processor.setMaxPostSize( proto.maxPostSize );
  +            processor.setServer( proto.server );
   
               thData[Http11Protocol.THREAD_DATA_PROCESSOR]=processor;
  -            
  +
               if( proto.getDomain() != null ) {
                   try {
                       RequestInfo rp=processor.getRequest().getRequestProcessor();
                       rp.setGlobalProcessor(global);
                       ObjectName rpName=new ObjectName
  -                        (proto.getDomain() + ":type=RequestProcessor,worker=" 
  +                        (proto.getDomain() + ":type=RequestProcessor,worker="
                            + proto.getName() +",name=HttpRequest" + count++ );
                       Registry.getRegistry(null, null).registerComponent( rp, rpName, 
null);
                       thData[Http11Protocol.THREAD_DATA_OBJECT_NAME]=rpName;
  @@ -683,12 +695,12 @@
               Http11Processor  processor=null;
               try {
                   
processor=(Http11Processor)thData[Http11Protocol.THREAD_DATA_PROCESSOR];
  -                
  +
                   if (processor instanceof ActionHook) {
                       ((ActionHook) processor).action(ActionCode.ACTION_START, null);
                   }
                   socket=connection.getSocket();
  -                
  +
                   InputStream in = socket.getInputStream();
                   OutputStream out = socket.getOutputStream();
   
  @@ -701,9 +713,9 @@
                       processor.setSSLSupport( null );
                   }
                   processor.setSocket( socket );
  -                
  +
                   processor.process(in, out);
  -                
  +
                   // If unread input arrives after the shutdownInput() call
                   // below and before or during the socket.close(), an error
                   // may be reported to the client.  To help troubleshoot this
  @@ -715,7 +727,7 @@
                           Thread.sleep(proto.socketCloseDelay);
                       } catch (InterruptedException ie) { /* ignore */ }
                   }
  -                
  +
                   TcpConnection.shutdownInput( socket );
               } catch(java.net.SocketException e) {
                   // SocketExceptions are normal
  @@ -723,7 +735,7 @@
                       (sm.getString
                        ("http11protocol.proto.socketexception.debug"), e);
               } catch (java.io.IOException e) {
  -                // IOExceptions are normal 
  +                // IOExceptions are normal
                   Http11Protocol.log.debug
                       (sm.getString
                        ("http11protocol.proto.ioexception.debug"), e);
  @@ -740,7 +752,7 @@
               } finally {
                   //       if(proto.adapter != null) proto.adapter.recycle();
                   //                processor.recycle();
  -                
  +
                   if (processor instanceof ActionHook) {
                       ((ActionHook) processor).action(ActionCode.ACTION_STOP, null);
                   }
  @@ -751,7 +763,7 @@
           }
       }
   
  -    protected static org.apache.commons.logging.Log log 
  +    protected static org.apache.commons.logging.Log log
           = org.apache.commons.logging.LogFactory.getLog(Http11Protocol.class);
   
       // -------------------- Various implementation classes --------------------
  @@ -804,12 +816,12 @@
       public boolean isSecure() {
           return secure;
       }
  -   
  +
       public PoolTcpEndpoint getEndpoint() {
           return ep;
       }
       */
  -    
  +
       protected String domain;
       protected ObjectName oname;
       protected MBeanServer mserver;
  
  
  

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

Reply via email to