📄 eapi.patch
字号:
+#ifdef EAPI+ ap_hook_use("ap::mod_status::display",+ AP_HOOK_SIG4(void,ptr,int,int), AP_HOOK_ALL,+ r, no_table_report, short_report);+#endif+ } else { if (!short_report) {+---------------------------------------------------------------------------| Add hooks to the scheme processing to allow other modules to| recognize more schemes by intercepting this processing.+---------------------------------------------------------------------------Index: src/modules/proxy/mod_proxy.c--- src/modules/proxy/mod_proxy.c 28 Jul 2006 13:55:25 -0000 1.1.1.16+++ src/modules/proxy/mod_proxy.c 28 Jul 2006 13:56:29 -0000 1.23@@ -177,6 +177,9 @@ 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;@@ -184,6 +187,14 @@ 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)@@ -199,9 +210,44 @@ 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 */@@ -365,6 +411,14 @@ * 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);@@ -374,6 +428,9 @@ ents[i].port); else rc = DECLINED;+#ifdef EAPI+ }+#endif /* EAPI */ /* an error or success */ if (rc != DECLINED && rc != HTTP_BAD_GATEWAY)@@ -388,6 +445,14 @@ */ /* handle the scheme */+#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 */ if (r->method_number == M_CONNECT) { return ap_proxy_connect_handler(r, cr, url, NULL, 0); }@@ -985,4 +1050,10 @@ 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 };+---------------------------------------------------------------------------| Add hooks to the HTTP processing to allow other modules| to enhance it by intercepting this processing.+---------------------------------------------------------------------------Index: src/modules/proxy/proxy_http.c--- src/modules/proxy/proxy_http.c 28 Jul 2006 13:55:25 -0000 1.1.1.20+++ src/modules/proxy/proxy_http.c 28 Jul 2006 13:56:29 -0000 1.28@@ -128,6 +128,9 @@ const char *datestr, *urlstr; int result, major, minor; const char *content_length;+#ifdef EAPI+ char *peer;+#endif void *sconf = r->server->module_config; proxy_server_conf *conf =@@ -149,6 +152,12 @@ return HTTP_BAD_REQUEST; urlptr += 3; destport = DEFAULT_HTTP_PORT;+#ifdef EAPI+ ap_hook_use("ap::mod_proxy::http::handler::set_destport", + AP_HOOK_SIG2(int,ptr), + AP_HOOK_TOPMOST,+ &destport, r);+#endif /* EAPI */ strp = strchr(urlptr, '/'); if (strp == NULL) { desthost = ap_pstrdup(p, urlptr);@@ -186,12 +195,18 @@ err = ap_proxy_host2addr(proxyhost, &server_hp); if (err != NULL) return DECLINED; /* try another */+#ifdef EAPI+ peer = ap_psprintf(p, "%s:%u", proxyhost, proxyport); +#endif } else { server.sin_port = htons((unsigned short)destport); err = ap_proxy_host2addr(desthost, &server_hp); if (err != NULL) return ap_proxyerror(r, HTTP_INTERNAL_SERVER_ERROR, err);+#ifdef EAPI+ peer = ap_psprintf(p, "%s:%u", desthost, destport); +#endif } @@ -276,14 +291,42 @@ f = ap_bcreate(p, B_RDWR | B_SOCKET); ap_bpushfd(f, sock, sock); +#ifdef EAPI+ {+ char *errmsg = NULL;+ ap_hook_use("ap::mod_proxy::http::handler::new_connection", + AP_HOOK_SIG4(ptr,ptr,ptr,ptr), + AP_HOOK_DECLINE(NULL),+ &errmsg, r, f, peer);+ if (errmsg != NULL)+ return ap_proxyerror(r, HTTP_BAD_GATEWAY, errmsg);+ }+#endif /* EAPI */+ ap_hard_timeout("proxy send", r); ap_bvputs(f, r->method, " ", proxyhost ? url : urlptr, " HTTP/1.1" CRLF, NULL);+#ifdef EAPI+ {+ int rc = DECLINED;+ ap_hook_use("ap::mod_proxy::http::handler::write_host_header", + AP_HOOK_SIG6(int,ptr,ptr,ptr,int,ptr), + AP_HOOK_DECLINE(DECLINED),+ &rc, r, f, desthost, destport, destportstr);+ if (rc == DECLINED) {+ if (destportstr != NULL && destport != DEFAULT_HTTP_PORT)+ ap_bvputs(f, "Host: ", desthost, ":", destportstr, CRLF, NULL);+ else+ ap_bvputs(f, "Host: ", desthost, CRLF, NULL);+ }+ }+#else /* EAPI */ /* Send Host: now, adding it to req_hdrs wouldn't be much better */ if (destportstr != NULL && destport != DEFAULT_HTTP_PORT) ap_bvputs(f, "Host: ", desthost, ":", destportstr, CRLF, NULL); else ap_bvputs(f, "Host: ", desthost, CRLF, NULL);+#endif /* EAPI */ if (conf->viaopt == via_block) { /* Block all outgoing Via: headers */+---------------------------------------------------------------------------| Add EAPI hooks in module structure for APXS generated samples.+---------------------------------------------------------------------------Index: src/support/apxs.pl--- src/support/apxs.pl 28 Jul 2006 13:55:24 -0000 1.1.1.15+++ src/support/apxs.pl 28 Jul 2006 13:56:29 -0000 1.15@@ -753,5 +753,11 @@ NULL, /* child_init */ NULL, /* child_exit */ NULL /* [#0] post read-request */+#ifdef EAPI+ ,NULL, /* EAPI: add_module */+ NULL, /* EAPI: remove_module */+ NULL, /* EAPI: rewrite_command */+ NULL /* EAPI: new_connection */+#endif }; +---------------------------------------------------------------------------| Add the EAPI functions, so the stuff can be built under AIX| and similar braindead platforms as DSO.+---------------------------------------------------------------------------Index: src/support/httpd.exp--- src/support/httpd.exp 11 May 2004 18:28:26 -0000 1.1.1.13+++ src/support/httpd.exp 11 May 2004 18:32:16 -0000 1.15@@ -431,3 +431,59 @@ XML_SetUnparsedEntityDeclHandler XML_SetUserData XML_UseParserAsHandlerArg+ap_add_config_define+ap_make_shared_sub_pool+ap_global_ctx+ap_ctx_new+ap_ctx_get+ap_ctx_set+ap_hook_init+ap_hook_kill+ap_hook_configure+ap_hook_register_I+ap_hook_unregister_I+ap_hook_status+ap_hook_use+ap_hook_call+ap_mm_useable+ap_MM_create+ap_MM_permission+ap_MM_destroy+ap_MM_lock+ap_MM_unlock+ap_MM_malloc+ap_MM_realloc+ap_MM_free+ap_MM_calloc+ap_MM_strdup+ap_MM_sizeof+ap_MM_maxsize+ap_MM_available+ap_MM_error+ap_mm_create+ap_mm_permission+ap_mm_destroy+ap_mm_lock+ap_mm_unlock+ap_mm_malloc+ap_mm_realloc+ap_mm_free+ap_mm_calloc+ap_mm_strdup+ap_mm_sizeof+ap_mm_maxsize+ap_mm_available+ap_mm_error+ap_mm_display_info+ap_mm_core_create+ap_mm_core_permission+ap_mm_core_delete+ap_mm_core_size+ap_mm_core_lock+ap_mm_core_unlock+ap_mm_core_maxsegsize+ap_mm_core_align2page+ap_mm_core_align2word+ap_mm_lib_error_set+ap_mm_lib_error_get+ap_mm_lib_version+---------------------------------------------------------------------------| Add the EAPI functions, so the stuff can be built under| Windows 95 and similar braindead platforms as DDL.+---------------------------------------------------------------------------Index: src/ApacheCore.def--- src/ApacheCore.def 11 May 2004 18:28:08 -0000 1.1.1.11+++ src/ApacheCore.def 11 May 2004 18:32:15 -0000 1.15@@ -448,3 +448,67 @@ ap_get_chunk_size @440 ap_escape_logitem @441 ap_auth_nonce @442+ + ; EAPI extended symbols+ ; note; no ID's, so these all bind by name rather than ordinal since + ; their ordinals would change with symbol changes in the distribution+ ap_add_config_define+ ap_global_ctx DATA+ ap_ctx_new+ ap_ctx_get+ ap_ctx_overlay+ ap_ctx_set+ ap_hook_init+ ap_hook_kill+ ap_hook_configure+ ap_hook_register_I+ ap_hook_unregister_I+ ap_hook_status+ ap_hook_use+ ap_hook_call+ ap_set_callback_and_alarm+ ap_acquire_pool+ ap_make_shared_sub_pool+ ap_release_pool+ ap_mm_useable+ ap_MM_create+ ap_MM_permission+ ap_MM_destroy+ ap_MM_lock+ ap_MM_unlock+ ap_MM_malloc+ ap_MM_realloc+ ap_MM_free+ ap_MM_calloc+ ap_MM_strdup+ ap_MM_sizeof+ ap_MM_maxsize+ ap_MM_available+ ap_MM_error+ ap_mm_create+ ap_mm_permission+ ap_mm_destroy+ ap_mm_lock+ ap_mm_unlock+ ap_mm_malloc+ ap_mm_realloc+ ap_mm_free+ ap_mm_calloc+ ap_mm_strdup+ ap_mm_sizeof+ ap_mm_maxsize+ ap_mm_available+ ap_mm_error+ ap_mm_display_info+ ap_mm_core_create+ ap_mm_core_permission+ ap_mm_core_delete+ ap_mm_core_size+ ap_mm_core_lock+ ap_mm_core_unlock+ ap_mm_core_align2page+ ap_mm_core_align2word+ ap_mm_lib_error_set+ ap_mm_lib_error_get+ ap_mm_lib_version+
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -