From: William A. Rowe Jr Date: Sun, 2 Jan 2005 05:33:44 +0000 (+0000) Subject: FINALLY Correct ap_http_method()! It is NOT a method, it's a SCHEME! X-Git-Tag: 2.1.3~209 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=d962fcfc8b3946aa999f0e231170837f4922ccb5;p=thirdparty%2Fapache%2Fhttpd.git FINALLY Correct ap_http_method()! It is NOT a method, it's a SCHEME! Bumped mmn, and ap module cookie, for this function rename. It's not a deprecation, as ap_http_method would be a lovely function name sometime in the future: to determine what the function name implies. git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@123882 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/CHANGES b/CHANGES index d6f79175e6f..cfc1bfccfdf 100644 --- a/CHANGES +++ b/CHANGES @@ -2,6 +2,10 @@ Changes with Apache 2.1.3 [Remove entries to the current 2.0 section below, when backported] + *) ap_http_scheme() replaced with ap_http_method() - this function + returns the scheme (http v.s. https). + [William Rowe] + *) mod_proxy: Fix a request corruption problem and a buffering problem which sometimes prevented proxy-sendchunks from working. [Jeff Trawick] diff --git a/include/ap_mmn.h b/include/ap_mmn.h index d724fe7ef6f..b9488d9d6d3 100644 --- a/include/ap_mmn.h +++ b/include/ap_mmn.h @@ -84,14 +84,15 @@ * changed ap_add_module, ap_add_loaded_module, * ap_setup_prelinked_modules, ap_process_resource_config * 20040425.1 (2.1.0-dev) Added ap_module_symbol_t and ap_prelinked_module_symbols + * 20050101.0 (2.1.2-dev) Axed mixnamed http_method for http_scheme (which it was!) */ #define MODULE_MAGIC_COOKIE 0x41503230UL /* "AP20" */ #ifndef MODULE_MAGIC_NUMBER_MAJOR -#define MODULE_MAGIC_NUMBER_MAJOR 20040425 +#define MODULE_MAGIC_NUMBER_MAJOR 20050101 #endif -#define MODULE_MAGIC_NUMBER_MINOR 1 /* 0...n */ +#define MODULE_MAGIC_NUMBER_MINOR 0 /* 0...n */ /** * Determine if the server's current MODULE_MAGIC_NUMBER is at least a diff --git a/include/http_protocol.h b/include/http_protocol.h index cb2d23886dc..434f1821717 100644 --- a/include/http_protocol.h +++ b/include/http_protocol.h @@ -608,13 +608,13 @@ AP_DECLARE_HOOK(int,post_read_request,(request_rec *r)) AP_DECLARE_HOOK(int,log_transaction,(request_rec *r)) /** - * This hook allows modules to retrieve the http method from a request. This - * allows Apache modules to easily extend the methods that Apache understands + * This hook allows modules to retrieve the http scheme for a request. This + * allows Apache modules to easily extend the schemes that Apache understands * @param r The current request - * @return The http method from the request - * @deffunc const char *ap_run_http_method(const request_rec *r) + * @return The http scheme from the request + * @deffunc const char *ap_run_http_scheme(const request_rec *r) */ -AP_DECLARE_HOOK(const char *,http_method,(const request_rec *r)) +AP_DECLARE_HOOK(const char *,http_scheme,(const request_rec *r)) /** * Return the default port from the current request diff --git a/include/httpd.h b/include/httpd.h index 47e40c92549..ff38d076be6 100644 --- a/include/httpd.h +++ b/include/httpd.h @@ -278,9 +278,8 @@ extern "C" { /** * Get the scheme for a request. * @param r The request - * @bug This should be called ap_http_scheme! */ -#define ap_http_method(r) ap_run_http_method(r) +#define ap_http_scheme(r) ap_run_http_scheme(r) /** The default string lengths */ #define MAX_STRING_LEN HUGE_STRING_LEN diff --git a/modules/arch/netware/mod_nw_ssl.c b/modules/arch/netware/mod_nw_ssl.c index 3d890ade427..108deb8a5b9 100644 --- a/modules/arch/netware/mod_nw_ssl.c +++ b/modules/arch/netware/mod_nw_ssl.c @@ -759,7 +759,7 @@ static int nwssl_hook_Fixup(request_rec *r) return DECLINED; } -static const char *nwssl_hook_http_method (const request_rec *r) +static const char *nwssl_hook_http_scheme(const request_rec *r) { if (isSecure(r) && !isSecureUpgraded(r)) return "https"; @@ -854,7 +854,7 @@ char *ssl_var_lookup(apr_pool_t *p, server_rec *s, conn_rec *c, request_rec *r, if (strcEQ(var, "REQUEST_METHOD")) result = r->method; else if (strcEQ(var, "REQUEST_SCHEME")) - result = ap_http_method(r); + result = ap_http_scheme(r); else if (strcEQ(var, "REQUEST_URI")) result = r->uri; else if (strcEQ(var, "REQUEST_FILENAME")) @@ -1105,9 +1105,9 @@ static void register_hooks(apr_pool_t *p) ap_hook_pre_connection(nwssl_pre_connection, NULL, NULL, APR_HOOK_MIDDLE); ap_hook_post_config(nwssl_post_config, NULL, NULL, APR_HOOK_MIDDLE); ap_hook_fixups(nwssl_hook_Fixup, NULL, NULL, APR_HOOK_MIDDLE); - ap_hook_http_method(nwssl_hook_http_method, NULL,NULL, APR_HOOK_MIDDLE); - ap_hook_default_port (nwssl_hook_default_port, NULL,NULL, APR_HOOK_MIDDLE); - ap_hook_insert_filter (ssl_hook_Insert_Filter, NULL,NULL, APR_HOOK_MIDDLE); + ap_hook_http_scheme(nwssl_hook_http_scheme, NULL, NULL, APR_HOOK_MIDDLE); + ap_hook_default_port(nwssl_hook_default_port, NULL, NULL, APR_HOOK_MIDDLE); + ap_hook_insert_filter(ssl_hook_Insert_Filter, NULL, NULL, APR_HOOK_MIDDLE); APR_REGISTER_OPTIONAL_FN(ssl_is_https); APR_REGISTER_OPTIONAL_FN(ssl_var_lookup); diff --git a/modules/dav/main/util.c b/modules/dav/main/util.c index 7919d62abfb..c1bc5f92b1c 100644 --- a/modules/dav/main/util.c +++ b/modules/dav/main/util.c @@ -204,7 +204,7 @@ dav_lookup_result dav_lookup_uri(const char *uri, request_rec * r, /* ### not sure this works if the current request came in via https: */ scheme = r->parsed_uri.scheme; if (scheme == NULL) - scheme = ap_http_method(r); + scheme = ap_http_scheme(r); /* insert a port if the URI did not contain one */ if (comp.port == 0) diff --git a/modules/experimental/mod_example.c b/modules/experimental/mod_example.c index 7c7006bce2c..62946fd516a 100644 --- a/modules/experimental/mod_example.c +++ b/modules/experimental/mod_example.c @@ -913,7 +913,7 @@ static void x_child_init(apr_pool_t *p, server_rec *s) * phase. */ #if 0 -static const char *x_http_method(const request_rec *r) +static const char *x_http_scheme(const request_rec *r) { x_cfg *cfg; @@ -921,8 +921,8 @@ static const char *x_http_method(const request_rec *r) /* * Log the call and exit. */ - trace_add(r->server, NULL, cfg, "x_http_method()"); - return "foo"; + trace_add(r->server, NULL, cfg, "x_http_scheme()"); + return "example"; } /* @@ -1285,7 +1285,7 @@ static void x_register_hooks(apr_pool_t *p) APR_HOOK_MIDDLE); ap_hook_log_transaction(x_logger, NULL, NULL, APR_HOOK_MIDDLE); #if 0 - ap_hook_http_method(x_http_method, NULL, NULL, APR_HOOK_MIDDLE); + ap_hook_http_scheme(x_http_scheme, NULL, NULL, APR_HOOK_MIDDLE); ap_hook_default_port(x_default_port, NULL, NULL, APR_HOOK_MIDDLE); #endif ap_hook_translate_name(x_translate_handler, NULL, NULL, APR_HOOK_MIDDLE); diff --git a/modules/generators/mod_info.c b/modules/generators/mod_info.c index 35fffc86325..aa8b454e007 100644 --- a/modules/generators/mod_info.c +++ b/modules/generators/mod_info.c @@ -249,7 +249,7 @@ static hook_lookup_t request_hooks[] = { {"Create Request", ap_hook_get_create_request}, {"Post-Read Request", ap_hook_get_post_read_request}, {"Header Parse", ap_hook_get_header_parser}, - {"HTTP Method", ap_hook_get_http_method}, + {"HTTP Scheme", ap_hook_get_http_scheme}, {"Default Port", ap_hook_get_default_port}, {"Translate Path", ap_hook_get_translate_name}, {"Map to Storage", ap_hook_get_map_to_storage}, diff --git a/modules/http/http_core.c b/modules/http/http_core.c index fabb82ed3e4..773f68fa0d7 100644 --- a/modules/http/http_core.c +++ b/modules/http/http_core.c @@ -95,7 +95,7 @@ static const command_rec http_cmds[] = { { NULL } }; -static const char *http_method(const request_rec *r) +static const char *http_scheme(const request_rec *r) { return "http"; } @@ -224,7 +224,7 @@ static void register_hooks(apr_pool_t *p) } ap_hook_map_to_storage(ap_send_http_trace,NULL,NULL,APR_HOOK_MIDDLE); - ap_hook_http_method(http_method,NULL,NULL,APR_HOOK_REALLY_LAST); + ap_hook_http_scheme(http_scheme,NULL,NULL,APR_HOOK_REALLY_LAST); ap_hook_default_port(http_port,NULL,NULL,APR_HOOK_REALLY_LAST); ap_hook_create_request(http_create_request, NULL, NULL, APR_HOOK_REALLY_LAST); ap_http_input_filter_handle = diff --git a/modules/mappers/mod_rewrite.c b/modules/mappers/mod_rewrite.c index 65dc3280d90..2ef086dcfca 100644 --- a/modules/mappers/mod_rewrite.c +++ b/modules/mappers/mod_rewrite.c @@ -735,7 +735,7 @@ static void reduce_uri(request_rec *r) char *cp; apr_size_t l; - cp = (char *)ap_http_method(r); + cp = (char *)ap_http_scheme(r); l = strlen(cp); if ( strlen(r->filename) > l+3 && strncasecmp(r->filename, cp, l) == 0 @@ -807,7 +807,7 @@ static void fully_qualify_uri(request_rec *r) : apr_psprintf(r->pool, ":%u", port); r->filename = apr_psprintf(r->pool, "%s://%s%s%s%s", - ap_http_method(r), thisserver, thisport, + ap_http_scheme(r), thisserver, thisport, (*r->filename == '/') ? "" : "/", r->filename); } @@ -4184,7 +4184,7 @@ static int hook_uri2file(request_rec *r) thisurl = apr_table_get(r->subprocess_env, ENVVAR_SCRIPT_URL); /* set the variable */ - var = apr_pstrcat(r->pool, ap_http_method(r), "://", thisserver, thisport, + var = apr_pstrcat(r->pool, ap_http_scheme(r), "://", thisserver, thisport, thisurl, NULL); apr_table_setn(r->subprocess_env, ENVVAR_SCRIPT_URI, var); diff --git a/modules/proxy/mod_proxy.c b/modules/proxy/mod_proxy.c index 84633cc7157..83e87b98803 100644 --- a/modules/proxy/mod_proxy.c +++ b/modules/proxy/mod_proxy.c @@ -358,7 +358,7 @@ static int proxy_detect(request_rec *r) if (conf->req && r->parsed_uri.scheme) { /* but it might be something vhosted */ if (!(r->parsed_uri.hostname - && !strcasecmp(r->parsed_uri.scheme, ap_http_method(r)) + && !strcasecmp(r->parsed_uri.scheme, ap_http_scheme(r)) && ap_matches_request_vhost(r, r->parsed_uri.hostname, (apr_port_t)(r->parsed_uri.port_str ? r->parsed_uri.port : ap_default_port(r))))) { diff --git a/modules/ssl/mod_ssl.c b/modules/ssl/mod_ssl.c index f676f06e40e..fb9e75bd68c 100644 --- a/modules/ssl/mod_ssl.c +++ b/modules/ssl/mod_ssl.c @@ -396,7 +396,7 @@ int ssl_init_ssl_connection(conn_rec *c) return APR_SUCCESS; } -static const char *ssl_hook_http_method(const request_rec *r) +static const char *ssl_hook_http_scheme(const request_rec *r) { SSLSrvConfigRec *sc = mySrvConfig(r->server); @@ -476,7 +476,7 @@ static void ssl_register_hooks(apr_pool_t *p) ap_hook_pre_connection(ssl_hook_pre_connection,NULL,NULL, APR_HOOK_MIDDLE); ap_hook_test_config (ssl_hook_ConfigTest, NULL,NULL, APR_HOOK_MIDDLE); ap_hook_post_config (ssl_init_Module, NULL,NULL, APR_HOOK_MIDDLE); - ap_hook_http_method (ssl_hook_http_method, NULL,NULL, APR_HOOK_MIDDLE); + ap_hook_http_scheme (ssl_hook_http_scheme, NULL,NULL, APR_HOOK_MIDDLE); ap_hook_default_port (ssl_hook_default_port, NULL,NULL, APR_HOOK_MIDDLE); ap_hook_pre_config (ssl_hook_pre_config, NULL,NULL, APR_HOOK_MIDDLE); ap_hook_child_init (ssl_init_Child, NULL,NULL, APR_HOOK_MIDDLE); diff --git a/modules/ssl/ssl_engine_vars.c b/modules/ssl/ssl_engine_vars.c index 98677df5b63..a4f17220631 100644 --- a/modules/ssl/ssl_engine_vars.c +++ b/modules/ssl/ssl_engine_vars.c @@ -117,7 +117,7 @@ char *ssl_var_lookup(apr_pool_t *p, server_rec *s, conn_rec *c, request_rec *r, if (strcEQ(var, "REQUEST_METHOD")) result = r->method; else if (strcEQ(var, "REQUEST_SCHEME")) - result = ap_http_method(r); + result = ap_http_scheme(r); else if (strcEQ(var, "REQUEST_URI")) result = r->uri; else if (strcEQ(var, "REQUEST_FILENAME")) diff --git a/server/core.c b/server/core.c index 23f47a80864..15083f9ff5e 100644 --- a/server/core.c +++ b/server/core.c @@ -958,10 +958,10 @@ AP_DECLARE(char *) ap_construct_url(apr_pool_t *p, const char *uri, const char *host = get_server_name_for_url(r); if (ap_is_default_port(port, r)) { - return apr_pstrcat(p, ap_http_method(r), "://", host, uri, NULL); + return apr_pstrcat(p, ap_http_scheme(r), "://", host, uri, NULL); } - return apr_psprintf(p, "%s://%s:%u%s", ap_http_method(r), host, port, uri); + return apr_psprintf(p, "%s://%s:%u%s", ap_http_scheme(r), host, port, uri); } AP_DECLARE(apr_off_t) ap_get_limit_req_body(const request_rec *r) diff --git a/server/protocol.c b/server/protocol.c index 152f496aec6..49fef829bdc 100644 --- a/server/protocol.c +++ b/server/protocol.c @@ -60,7 +60,7 @@ APR_HOOK_STRUCT( APR_HOOK_LINK(post_read_request) APR_HOOK_LINK(log_transaction) - APR_HOOK_LINK(http_method) + APR_HOOK_LINK(http_scheme) APR_HOOK_LINK(default_port) ) @@ -503,7 +503,7 @@ AP_CORE_DECLARE(void) ap_parse_uri(request_rec *r, const char *uri) if (status == APR_SUCCESS) { /* if it has a scheme we may need to do absoluteURI vhost stuff */ if (r->parsed_uri.scheme - && !strcasecmp(r->parsed_uri.scheme, ap_http_method(r))) { + && !strcasecmp(r->parsed_uri.scheme, ap_http_scheme(r))) { r->hostname = r->parsed_uri.hostname; } else if (r->method_number == M_CONNECT) { @@ -1540,7 +1540,7 @@ AP_IMPLEMENT_HOOK_RUN_ALL(int,post_read_request, (request_rec *r), (r), OK, DECLINED) AP_IMPLEMENT_HOOK_RUN_ALL(int,log_transaction, (request_rec *r), (r), OK, DECLINED) -AP_IMPLEMENT_HOOK_RUN_FIRST(const char *,http_method, +AP_IMPLEMENT_HOOK_RUN_FIRST(const char *,http_scheme, (const request_rec *r), (r), NULL) AP_IMPLEMENT_HOOK_RUN_FIRST(unsigned short,default_port, (const request_rec *r), (r), 0)