tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mt...@apache.org
Subject cvs commit: jakarta-tomcat-connectors/ajp/proxy mod_proxy.c
Date Wed, 04 Aug 2004 08:56:54 GMT
mturk       2004/08/04 01:56:54

  Modified:    ajp/proxy mod_proxy.c
  Log:
  Implement pre and post request hooks.
  
  Revision  Changes    Path
  1.16      +28 -1     jakarta-tomcat-connectors/ajp/proxy/mod_proxy.c
  
  Index: mod_proxy.c
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-connectors/ajp/proxy/mod_proxy.c,v
  retrieving revision 1.15
  retrieving revision 1.16
  diff -u -r1.15 -r1.16
  --- mod_proxy.c	4 Aug 2004 06:55:11 -0000	1.15
  +++ mod_proxy.c	4 Aug 2004 08:56:54 -0000	1.16
  @@ -473,6 +473,8 @@
       int direct_connect = 0;
       const char *str;
       long maxfwd;
  +    struct proxy_balancer *balancer = NULL;
  +    proxy_worker *worker = NULL;
   
       /* is this for us? */
       if (!r->proxyreq || !r->filename || strncmp(r->filename, "proxy:", 6) != 0)
  @@ -549,7 +551,12 @@
                         r->uri);
   #endif
       }
  -
  +    /* Try to obtain the most suitable worker */
  +    access_status = proxy_run_pre_request(&worker, &balancer, r, conf, &url);
  +    if (access_status != DECLINED && access_status != OK) {
  +        return access_status;
  +    }
  +                                          
       /* firstly, try a proxy, unless a NoProxy directive is active */
       if (!direct_connect) {
           for (i = 0; i < proxies->nelts; i++) {
  @@ -591,6 +598,11 @@
                       "using LoadModule.", r->uri);
           return HTTP_FORBIDDEN;
       }
  +    access_status = proxy_run_post_request(worker, balancer, r, conf);
  +    if (access_status == DECLINED) {
  +        access_status = OK; /* no post_request handler available */
  +        /* TODO: reclycle direct worker */
  +    }
       return access_status;
   }
   
  @@ -1481,6 +1493,8 @@
   APR_HOOK_STRUCT(
   	APR_HOOK_LINK(scheme_handler)
   	APR_HOOK_LINK(canon_handler)
  +	APR_HOOK_LINK(pre_request)
  +	APR_HOOK_LINK(post_request)
   )
   
   APR_IMPLEMENT_EXTERNAL_HOOK_RUN_FIRST(proxy, PROXY, int, scheme_handler, 
  @@ -1491,6 +1505,19 @@
   APR_IMPLEMENT_EXTERNAL_HOOK_RUN_FIRST(proxy, PROXY, int, canon_handler, 
                                        (request_rec *r, char *url),(r,
                                        url),DECLINED)
  +APR_IMPLEMENT_EXTERNAL_HOOK_RUN_FIRST(proxy, PROXY, int, pre_request, (
  +                                      proxy_worker **worker,
  +                                      struct proxy_balancer **balancer,
  +                                      request_rec *r, 
  +                                      proxy_server_conf *conf,
  +                                      char **url),(worker,balancer,
  +                                      r,conf,url),DECLINED)
  +APR_IMPLEMENT_EXTERNAL_HOOK_RUN_FIRST(proxy, PROXY, int, post_request,
  +                                      (proxy_worker *worker,
  +                                       struct proxy_balancer *balancer,
  +                                       request_rec *r,
  +                                       proxy_server_conf *conf),(worker,
  +                                       balancer,r,conf),DECLINED)
   APR_IMPLEMENT_OPTIONAL_HOOK_RUN_ALL(proxy, PROXY, int, fixups,
   				    (request_rec *r), (r),
   				    OK, DECLINED)
  
  
  

---------------------------------------------------------------------
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