You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modproxy-dev@apache.org by Daniel Lopez <da...@rawbyte.com> on 2001/10/19 20:52:59 UTC

New hook

Hi, 

I need an additional hook to process headers before they are sent to the
origin server in a reverse proxy configuration.
Please consider the following patch.

Best regards

Daniel

daniel@rawbyte.com


diff -u proxy.orig/mod_proxy.h proxy/mod_proxy.h
--- proxy.orig/mod_proxy.h	Thu Oct 18 16:42:42 2001
+++ proxy/mod_proxy.h	Thu Oct 18 17:14:12 2001
@@ -238,6 +237,7 @@
                           char *url))
 
 APR_DECLARE_EXTERNAL_HOOK(proxy, PROXY, int, create_req, (request_rec *r, request_rec *pr))
+APR_DECLARE_EXTERNAL_HOOK(proxy, PROXY, int, headers_origin, (request_rec *r))
 
 /* proxy_util.c */
 
diff -u proxy.orig/proxy_http.c proxy/proxy_http.c
--- proxy.orig/proxy_http.c	Thu Oct 18 16:42:42 2001
+++ proxy/proxy_http.c	Thu Oct 18 17:05:04 2001
@@ -61,7 +61,9 @@
 #include "mod_proxy.h"
 
 module AP_MODULE_DECLARE_DATA proxy_http_module;
-
+APR_IMPLEMENT_OPTIONAL_HOOK_RUN_ALL(proxy, PROXY, int, headers_origin,
+				    (request_rec *r), (r),
+				    OK, DECLINED)
 int ap_proxy_http_canon(request_rec *r, char *url);
 int ap_proxy_http_handler(request_rec *r, proxy_server_conf *conf,
                           char *url, const char *proxyname, 
@@ -549,6 +551,7 @@
     }
 
     /* send request headers */
+    proxy_run_headers_origin(r);
     headers_in_array = apr_table_elts(r->headers_in);
     headers_in = (apr_table_entry_t *) headers_in_array->elts;
     for (counter = 0; counter < headers_in_array->nelts; counter++) {

Re: New hook

Posted by Chuck Murcko <ch...@topsail.org>.
Cool, thanks Daniel! +1 from me.

There are a number of situations where this is useful.

Chuck

On Friday, October 19, 2001, at 02:52 PM, Daniel Lopez wrote:

>
> Hi,
>
> I need an additional hook to process headers before they are sent to the
> origin server in a reverse proxy configuration.
> Please consider the following patch.
>
> Best regards
>
> Daniel
>
> daniel@rawbyte.com
>
>
> diff -u proxy.orig/mod_proxy.h proxy/mod_proxy.h
> --- proxy.orig/mod_proxy.h	Thu Oct 18 16:42:42 2001
> +++ proxy/mod_proxy.h	Thu Oct 18 17:14:12 2001
> @@ -238,6 +237,7 @@
>                            char *url))
>
>  APR_DECLARE_EXTERNAL_HOOK(proxy, PROXY, int, create_req, (request_rec 
> *r, request_rec *pr))
> +APR_DECLARE_EXTERNAL_HOOK(proxy, PROXY, int, headers_origin, 
> (request_rec *r))
>
>  /* proxy_util.c */
>
> diff -u proxy.orig/proxy_http.c proxy/proxy_http.c
> --- proxy.orig/proxy_http.c	Thu Oct 18 16:42:42 2001
> +++ proxy/proxy_http.c	Thu Oct 18 17:05:04 2001
> @@ -61,7 +61,9 @@
>  #include "mod_proxy.h"
>
>  module AP_MODULE_DECLARE_DATA proxy_http_module;
> -
> +APR_IMPLEMENT_OPTIONAL_HOOK_RUN_ALL(proxy, PROXY, int, headers_origin,
> +				    (request_rec *r), (r),
> +				    OK, DECLINED)
>  int ap_proxy_http_canon(request_rec *r, char *url);
>  int ap_proxy_http_handler(request_rec *r, proxy_server_conf *conf,
>                            char *url, const char *proxyname,
> @@ -549,6 +551,7 @@
>      }
>
>      /* send request headers */
> +    proxy_run_headers_origin(r);
>      headers_in_array = apr_table_elts(r->headers_in);
>      headers_in = (apr_table_entry_t *) headers_in_array->elts;
>      for (counter = 0; counter < headers_in_array->nelts; counter++) {
>
>
Chuck Murcko
Topsail Group
http://www.topsail.org/