*** mod_proxy.c.orig	Wed Jun 19 08:55:52 2002
--- mod_proxy.c	Wed Jun 19 08:41:33 2002
***************
*** 218,223 ****
--- 218,226 ----
  static int proxy_fixup(request_rec *r)
  {
      char *url, *p;
+ #ifdef EAPI
+     int rc;
+ #endif /* EAPI */
  
      if (r->proxyreq == NOT_PROXY || strncmp(r->filename, "proxy:", 6) != 0)
          return DECLINED;
***************
*** 225,230 ****
--- 228,241 ----
      url = &r->filename[6];
  
  /* canonicalise each specific scheme */
+ #ifdef EAPI
+     if (ap_hook_use("ap::mod_proxy::canon",
+                     AP_HOOK_SIG3(int,ptr,ptr),
+                     AP_HOOK_DECLINE(DECLINED),
+                     &rc, r, url) && rc != DECLINED)
+         return rc;  
+     else
+ #endif /* EAPI */
      if (strncasecmp(url, "http:", 5) == 0)
          return ap_proxy_http_canon(r, url + 5, "http", DEFAULT_HTTP_PORT);
      else if (strncasecmp(url, "ftp:", 4) == 0)
***************
*** 240,249 ****
--- 251,295 ----
  static void proxy_init(server_rec *r, pool *p)
  {
      ap_proxy_garbage_init(r, p);
+ #ifdef EAPI
+     ap_hook_use("ap::mod_proxy::init", 
+                 AP_HOOK_SIG3(void,ptr,ptr), AP_HOOK_ALL, r, p);
+ #endif
  }
  
+ #ifdef EAPI
+ static void proxy_addmod(module *m)
+ {
+     /* export: ap_proxy_http_canon() as `ap::mod_proxy::http::canon' */
+     ap_hook_configure("ap::mod_proxy::http::canon", 
+                       AP_HOOK_SIG5(int,ptr,ptr,ptr,int), AP_HOOK_TOPMOST);
+     ap_hook_register("ap::mod_proxy::http::canon", 
+                      ap_proxy_http_canon, AP_HOOK_NOCTX);
  
+     /* export: ap_proxy_http_handler() as `ap::mod_proxy::http::handler' */
+     ap_hook_configure("ap::mod_proxy::http::handler", 
+                       AP_HOOK_SIG6(int,ptr,ptr,ptr,ptr,int), AP_HOOK_TOPMOST);
+     ap_hook_register("ap::mod_proxy::http::handler", 
+                      ap_proxy_http_handler, AP_HOOK_NOCTX);
  
+     /* export: ap_proxyerror() as `ap::mod_proxy::error' */
+     ap_hook_configure("ap::mod_proxy::error", 
+                       AP_HOOK_SIG3(int,ptr,ptr), AP_HOOK_TOPMOST);
+     ap_hook_register("ap::mod_proxy::error", 
+                      ap_proxyerror, AP_HOOK_NOCTX);
+     return;
+ }
+ 
+ static void proxy_remmod(module *m)
+ {
+ 	/* remove the hook references */
+     ap_hook_unregister("ap::mod_proxy::http::canon", ap_proxy_http_canon);
+     ap_hook_unregister("ap::mod_proxy::http::handler", ap_proxy_http_handler);
+     ap_hook_unregister("ap::mod_proxy::error", ap_proxyerror);
+     return;
+ }
+ #endif /* EAPI */
+ 
  /* Send a redirection if the request contains a hostname which is not */
  /* fully qualified, i.e. doesn't have a domain name appended. Some proxy */
  /* servers like Netscape's allow this and access hosts from the local */
***************
*** 374,379 ****
--- 420,433 ----
                   * CONNECT is a special method that bypasses the normal proxy
                   * code.
                   */
+ #ifdef EAPI
+ 		if (!ap_hook_use("ap::mod_proxy::handler",
+ 				 AP_HOOK_SIG7(int,ptr,ptr,ptr,ptr,int,ptr),
+ 				 AP_HOOK_DECLINE(DECLINED),
+ 				 &rc, r, cr, url, 
+ 				 ents[i].hostname, ents[i].port, 
+ 				 ents[i].protocol) || rc == DECLINED) {
+ #endif /* EAPI */
                  if (r->method_number == M_CONNECT)
                      rc = ap_proxy_connect_handler(r, cr, url, ents[i].hostname,
                                                    ents[i].port);
***************
*** 383,388 ****
--- 437,445 ----
                                                 ents[i].port);
                  else
                      rc = DECLINED;
+ #ifdef EAPI
+ 		}
+ #endif /* EAPI */
  
                  /* an error or success */
                  if (rc != DECLINED && rc != HTTP_BAD_GATEWAY)
***************
*** 396,401 ****
--- 453,466 ----
       * give up??
       */
  
+ #ifdef EAPI
+     if (ap_hook_use("ap::mod_proxy::handler",
+                   AP_HOOK_SIG7(int,ptr,ptr,ptr,ptr,int,ptr),
+                   AP_HOOK_DECLINE(DECLINED),
+                   &rc, r, cr, url,
+                     NULL, 0, scheme) && rc != DECLINED)
+         return rc;
+ #endif /* EAPI */
      /* handle the scheme */
      if (r->method_number == M_CONNECT) {
          return ap_proxy_connect_handler(r, cr, url, NULL, 0);
***************
*** 994,997 ****
--- 1059,1068 ----
      NULL,                       /* child_init */
      NULL,                       /* child_exit */
      proxy_detect                /* post read-request */
+ #ifdef EAPI
+    ,proxy_addmod,             /* EAPI: add_module */
+     proxy_remmod,             /* EAPI: remove_module */
+     NULL,                     /* EAPI: rewrite_command */
+     NULL                      /* EAPI: new_connection  */
+ #endif
  };
