[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]
* 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
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
/**
* 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
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";
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"))
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);
/* ### 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)
* 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;
/*
* 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";
}
/*
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);
{"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},
{ NULL }
};
-static const char *http_method(const request_rec *r)
+static const char *http_scheme(const request_rec *r)
{
return "http";
}
}
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 =
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
: 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);
}
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);
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))))) {
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);
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);
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"))
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)
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)
)
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) {
(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)