httpd-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From do...@apache.org
Subject cvs commit: httpd-2.0/modules/ssl mod_ssl.h ssl_engine_kernel.c
Date Thu, 22 Nov 2001 02:23:09 GMT
dougm       01/11/21 18:23:09

  Modified:    modules/ssl mod_ssl.h ssl_engine_kernel.c
  Log:
  optimize lookup of ssl-{unclean,accurate}-shutdown flags:
  - only look through the table once, rather than 2 apr_table_gets()
  - case-sensitive and use strcmp() as little as possible
  - only lookup once per-connection, as the flags will not change across
    keepalive requests
  
  Revision  Changes    Path
  1.41      +1 -0      httpd-2.0/modules/ssl/mod_ssl.h
  
  Index: mod_ssl.h
  ===================================================================
  RCS file: /home/cvs/httpd-2.0/modules/ssl/mod_ssl.h,v
  retrieving revision 1.40
  retrieving revision 1.41
  diff -u -r1.40 -r1.41
  --- mod_ssl.h	2001/11/22 00:43:43	1.40
  +++ mod_ssl.h	2001/11/22 02:23:09	1.41
  @@ -446,6 +446,7 @@
   } SSLFilterRec;
   
   typedef enum {
  +    SSL_SHUTDOWN_TYPE_UNSET,
       SSL_SHUTDOWN_TYPE_STANDARD,
       SSL_SHUTDOWN_TYPE_UNCLEAN,
       SSL_SHUTDOWN_TYPE_ACCURATE
  
  
  
  1.28      +44 -9     httpd-2.0/modules/ssl/ssl_engine_kernel.c
  
  Index: ssl_engine_kernel.c
  ===================================================================
  RCS file: /home/cvs/httpd-2.0/modules/ssl/ssl_engine_kernel.c,v
  retrieving revision 1.27
  retrieving revision 1.28
  diff -u -r1.27 -r1.28
  --- ssl_engine_kernel.c	2001/11/22 01:40:26	1.27
  +++ ssl_engine_kernel.c	2001/11/22 02:23:09	1.28
  @@ -122,6 +122,7 @@
        * to force the type of handshake via SetEnvIf directive
        */
       switch (sslconn->shutdown_type) {
  +      case SSL_SHUTDOWN_TYPE_UNSET:
         case SSL_SHUTDOWN_TYPE_STANDARD:
           /* send close notify, but don't wait for clients close notify
              (standard compliant and safe, so it's the DEFAULT!) */
  @@ -192,6 +193,43 @@
   }
   
   /*
  + * Move SetEnvIf information from request_rec to conn_rec/BUFF
  + * to allow the close connection handler to use them.
  + */
  +
  +static void ssl_configure_env(request_rec *r, SSLConnRec *sslconn)
  +{
  +    int i;
  +    const apr_array_header_t *arr = apr_table_elts(r->subprocess_env);
  +    const apr_table_entry_t *elts = (const apr_table_entry_t *)arr->elts;
  +
  +    sslconn->shutdown_type = SSL_SHUTDOWN_TYPE_STANDARD;
  +
  +    for (i = 0; i < arr->nelts; i++) {
  +        const char *key = elts[i].key;
  +
  +        switch (*key) {
  +          case 's':
  +            /* being case-sensitive here.
  +             * and not checking for the -shutdown since these are the only
  +             * SetEnvIf "flags" we support
  +             */
  +            if (!strncmp(key+1, "sl-", 3)) {
  +                key += 4;
  +                if (!strncmp(key, "unclean", 7)) {
  +                    sslconn->shutdown_type = SSL_SHUTDOWN_TYPE_UNCLEAN;
  +                }
  +                else if (!strncmp(key, "accurate", 8)) {
  +                    sslconn->shutdown_type = SSL_SHUTDOWN_TYPE_ACCURATE;
  +                }
  +                return; /* should only ever be one ssl-*-shutdown */
  +            }
  +            break;
  +        }
  +    }
  +}
  +
  +/*
    *  URL Translation Handler
    */
   int ssl_hook_Translate(request_rec *r)
  @@ -214,16 +252,13 @@
                   r->connection->id,
                   ssl_util_vhostid(r->pool, r->server));
   
  -    /*
  -     * Move SetEnvIf information from request_rec to conn_rec/BUFF
  -     * to allow the close connection handler to use them.
  +    /* SetEnvIf ssl-*-shutdown flags can only be per-server,
  +     * so they won't change across keepalive requests
        */
  -    if (apr_table_get(r->subprocess_env, "ssl-unclean-shutdown") != NULL)
  -        sslconn->shutdown_type = SSL_SHUTDOWN_TYPE_UNCLEAN;
  -    else if (apr_table_get(r->subprocess_env, "ssl-accurate-shutdown") != NULL)
  -        sslconn->shutdown_type = SSL_SHUTDOWN_TYPE_ACCURATE;
  -    else
  -        sslconn->shutdown_type = SSL_SHUTDOWN_TYPE_STANDARD;
  +    if (sslconn->shutdown_type == SSL_SHUTDOWN_TYPE_UNSET) {
  +        ssl_configure_env(r, sslconn);
  +    }
  +
       return DECLINED;
   }
   
  
  
  

Mime
View raw message