httpd-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jor...@apache.org
Subject cvs commit: httpd-2.0/modules/ssl ssl_engine_vars.c
Date Thu, 04 Mar 2004 13:42:09 GMT
jorton      2004/03/04 05:42:09

  Modified:    modules/ssl ssl_engine_vars.c
  Log:
  * modules/ssl/ssl_engine_vars (ssl_var_lookup): Optimise such that
  lookup of SSL_* variables (the common case) requires 2 rather than 29
  strcasecmp calls before getting to ssl_var_lookup_ssl().
  
  Revision  Changes    Path
  1.39      +76 -57    httpd-2.0/modules/ssl/ssl_engine_vars.c
  
  Index: ssl_engine_vars.c
  ===================================================================
  RCS file: /home/cvs/httpd-2.0/modules/ssl/ssl_engine_vars.c,v
  retrieving revision 1.38
  retrieving revision 1.39
  diff -w -d -u -r1.38 -r1.39
  --- ssl_engine_vars.c	4 Mar 2004 13:06:54 -0000	1.38
  +++ ssl_engine_vars.c	4 Mar 2004 13:42:09 -0000	1.39
  @@ -88,6 +88,9 @@
        * Request dependent stuff
        */
       if (r != NULL) {
  +        switch (var[0]) {
  +        case 'H':
  +        case 'h':
           if (strcEQ(var, "HTTP_USER_AGENT"))
               result = ssl_var_lookup_header(p, r, "User-Agent");
           else if (strcEQ(var, "HTTP_REFERER"))
  @@ -105,31 +108,32 @@
           else if (strlen(var) > 5 && strcEQn(var, "HTTP:", 5))
               /* all other headers from which we are still not know about */
               result = ssl_var_lookup_header(p, r, var+5);
  -        else if (strcEQ(var, "THE_REQUEST"))
  -            result = r->the_request;
  -        else if (strcEQ(var, "REQUEST_METHOD"))
  +            break;
  +
  +        case 'R':
  +        case 'r':
  +            if (strcEQ(var, "REQUEST_METHOD")) 
               result = (char *)(r->method);
           else if (strcEQ(var, "REQUEST_SCHEME"))
               result = (char *)ap_http_method(r);
           else if (strcEQ(var, "REQUEST_URI"))
               result = r->uri;
  -        else if (strcEQ(var, "SCRIPT_FILENAME") ||
  -                 strcEQ(var, "REQUEST_FILENAME"))
  +            else if (strcEQ(var, "REQUEST_FILENAME"))
               result = r->filename;
  -        else if (strcEQ(var, "PATH_INFO"))
  -            result = r->path_info;
  -        else if (strcEQ(var, "QUERY_STRING"))
  -            result = r->args;
           else if (strcEQ(var, "REMOTE_HOST"))
               result = (char *)ap_get_remote_host(r->connection,
   					r->per_dir_config, REMOTE_NAME, NULL);
           else if (strcEQ(var, "REMOTE_IDENT"))
               result = (char *)ap_get_remote_logname(r);
  -        else if (strcEQ(var, "IS_SUBREQ"))
  -            result = (r->main != NULL ? "true" : "false");
  -        else if (strcEQ(var, "DOCUMENT_ROOT"))
  -            result = (char *)ap_document_root(r);
  -        else if (strcEQ(var, "SERVER_ADMIN"))
  +            else if (strcEQ(var, "REMOTE_USER"))
  +                result = r->user;
  +            break;
  +
  +        case 'S':
  +        case 's':
  +            if (strcEQn(var, "SSL", 3)) break; /* shortcut common case */
  +            
  +            if (strcEQ(var, "SERVER_ADMIN"))
               result = r->server->server_admin;
           else if (strcEQ(var, "SERVER_NAME"))
               result = (char *)ap_get_server_name(r);
  @@ -137,10 +141,25 @@
               result = apr_psprintf(p, "%u", ap_get_server_port(r));
           else if (strcEQ(var, "SERVER_PROTOCOL"))
               result = r->protocol;
  -        else if (strcEQ(var, "REMOTE_USER"))
  -            result = r->user;
  +            else if (strcEQ(var, "SCRIPT_FILENAME"))
  +                result = r->filename;
  +            break;
  +            
  +        default:
  +            if (strcEQ(var, "PATH_INFO"))
  +                result = r->path_info;
  +            else if (strcEQ(var, "QUERY_STRING"))
  +                result = r->args;
  +            else if (strcEQ(var, "IS_SUBREQ"))
  +                result = (r->main != NULL ? "true" : "false");
  +            else if (strcEQ(var, "DOCUMENT_ROOT"))
  +                result = (char *)ap_document_root(r);
           else if (strcEQ(var, "AUTH_TYPE"))
               result = r->ap_auth_type;
  +            else if (strcEQ(var, "THE_REQUEST"))
  +                result = r->the_request;
  +            break;
  +        }
       }
   
       /*
  @@ -148,11 +167,11 @@
        */
       if (result == NULL && c != NULL) {
           SSLConnRec *sslconn = myConnConfig(c);
  -        if (strcEQ(var, "REMOTE_ADDR"))
  -            result = c->remote_ip;
  -        else if (strlen(var) > 4 && strcEQn(var, "SSL_", 4) 
  +        if (strlen(var) > 4 && strcEQn(var, "SSL_", 4) 
                    && sslconn && sslconn->ssl)
               result = ssl_var_lookup_ssl(p, c, var+4);
  +        else if (strcEQ(var, "REMOTE_ADDR"))
  +            result = c->remote_ip;
           else if (strcEQ(var, "HTTPS")) {
               if (sslconn && sslconn->ssl)
                   result = "on";
  
  
  

Mime
View raw message