PATCHES ACCEPTED TO BACKPORT FROM TRUNK:
[ start all new proposals below, under PATCHES PROPOSED. ]
- *) Easy patches - synch with trunk
- - mod_rewrite: Initialize args to not print garbage mem during a RewriteCond parse error
- - mod_rewrite: Initialize args to not print garbage mem during a RewriteRule parse error
- - examples/mod_*: Improve style in examples.
- - proxy_util: Improve error message
- - mod_proxy_wstunnel: Concat string at compile time in orser to save a few cycles.
- trunk patch:
- http://svn.apache.org/r1681795
- http://svn.apache.org/r1682988
- http://svn.apache.org/r1682979
- http://svn.apache.org/r1682819
- http://svn.apache.org/r1682816
- 2.4.x patch: trunk patchs work
- +1: jailletc36, ylavic, jim
-
PATCHES PROPOSED TO BACKPORT FROM TRUNK:
#include <ctype.h>
-static const char s_szCaseFilterName[]="CaseFilter";
+static const char s_szCaseFilterName[] = "CaseFilter";
module AP_MODULE_DECLARE_DATA case_filter_module;
typedef struct
- {
+{
int bEnabled;
- } CaseFilterConfig;
+} CaseFilterConfig;
-static void *CaseFilterCreateServerConfig(apr_pool_t *p,server_rec *s)
- {
- CaseFilterConfig *pConfig=apr_pcalloc(p,sizeof *pConfig);
+static void *CaseFilterCreateServerConfig(apr_pool_t *p, server_rec *s)
+{
+ CaseFilterConfig *pConfig = apr_pcalloc(p,sizeof *pConfig);
- pConfig->bEnabled=0;
+ pConfig->bEnabled = 0;
return pConfig;
- }
+}
static void CaseFilterInsertFilter(request_rec *r)
- {
- CaseFilterConfig *pConfig=ap_get_module_config(r->server->module_config,
- &case_filter_module);
+{
+ CaseFilterConfig *pConfig = ap_get_module_config(r->server->module_config,
+ &case_filter_module);
- if(!pConfig->bEnabled)
+ if (!pConfig->bEnabled)
return;
- ap_add_output_filter(s_szCaseFilterName,NULL,r,r->connection);
- }
+ ap_add_output_filter(s_szCaseFilterName, NULL, r, r->connection);
+}
static apr_status_t CaseFilterOutFilter(ap_filter_t *f,
apr_bucket_brigade *pbbIn)
- {
+{
request_rec *r = f->r;
conn_rec *c = r->connection;
apr_bucket *pbktIn;
apr_bucket_brigade *pbbOut;
- pbbOut=apr_brigade_create(r->pool, c->bucket_alloc);
+ pbbOut = apr_brigade_create(r->pool, c->bucket_alloc);
for (pbktIn = APR_BRIGADE_FIRST(pbbIn);
pbktIn != APR_BRIGADE_SENTINEL(pbbIn);
pbktIn = APR_BUCKET_NEXT(pbktIn))
apr_size_t n;
apr_bucket *pbktOut;
- if(APR_BUCKET_IS_EOS(pbktIn))
- {
- apr_bucket *pbktEOS=apr_bucket_eos_create(c->bucket_alloc);
- APR_BRIGADE_INSERT_TAIL(pbbOut,pbktEOS);
+ if (APR_BUCKET_IS_EOS(pbktIn)) {
+ apr_bucket *pbktEOS = apr_bucket_eos_create(c->bucket_alloc);
+ APR_BRIGADE_INSERT_TAIL(pbbOut, pbktEOS);
continue;
- }
+ }
/* read */
- apr_bucket_read(pbktIn,&data,&len,APR_BLOCK_READ);
+ apr_bucket_read(pbktIn, &data, &len, APR_BLOCK_READ);
/* write */
buf = apr_bucket_alloc(len, c->bucket_alloc);
- for(n=0 ; n < len ; ++n)
+ for (n=0 ; n < len ; ++n) {
buf[n] = apr_toupper(data[n]);
+ }
pbktOut = apr_bucket_heap_create(buf, len, apr_bucket_free,
c->bucket_alloc);
- APR_BRIGADE_INSERT_TAIL(pbbOut,pbktOut);
- }
+ APR_BRIGADE_INSERT_TAIL(pbbOut, pbktOut);
+ }
/* Q: is there any advantage to passing a brigade for each bucket?
* A: obviously, it can cut down server resource consumption, if this
* don't let our caller pass the same buckets to us, twice;
*/
apr_brigade_cleanup(pbbIn);
- return ap_pass_brigade(f->next,pbbOut);
- }
+ return ap_pass_brigade(f->next, pbbOut);
+}
static const char *CaseFilterEnable(cmd_parms *cmd, void *dummy, int arg)
- {
- CaseFilterConfig *pConfig=ap_get_module_config(cmd->server->module_config,
- &case_filter_module);
- pConfig->bEnabled=arg;
+{
+ CaseFilterConfig *pConfig = ap_get_module_config(cmd->server->module_config,
+ &case_filter_module);
+ pConfig->bEnabled = arg;
return NULL;
- }
+}
static const command_rec CaseFilterCmds[] =
- {
+{
AP_INIT_FLAG("CaseFilter", CaseFilterEnable, NULL, RSRC_CONF,
"Run a case filter on this host"),
{ NULL }
- };
+};
static void CaseFilterRegisterHooks(apr_pool_t *p)
- {
- ap_hook_insert_filter(CaseFilterInsertFilter,NULL,NULL,APR_HOOK_MIDDLE);
- ap_register_output_filter(s_szCaseFilterName,CaseFilterOutFilter,NULL,
+{
+ ap_hook_insert_filter(CaseFilterInsertFilter, NULL, NULL, APR_HOOK_MIDDLE);
+ ap_register_output_filter(s_szCaseFilterName, CaseFilterOutFilter, NULL,
AP_FTYPE_RESOURCE);
- }
+}
AP_DECLARE_MODULE(case_filter) =
{
static void CaseFilterInInsertFilter(request_rec *r)
{
- CaseFilterInConfig *pConfig=ap_get_module_config(r->server->module_config,
- &case_filter_in_module);
- if(!pConfig->bEnabled)
+ CaseFilterInConfig *pConfig = ap_get_module_config(r->server->module_config,
+ &case_filter_in_module);
+ if (!pConfig->bEnabled)
return;
- ap_add_input_filter(s_szCaseFilterName,NULL,r,r->connection);
+ ap_add_input_filter(s_szCaseFilterName, NULL, r, r->connection);
}
static apr_status_t CaseFilterInFilter(ap_filter_t *f,
return ret;
}
- while(!APR_BRIGADE_EMPTY(pCtx->pbbTmp)) {
+ while (!APR_BRIGADE_EMPTY(pCtx->pbbTmp)) {
apr_bucket *pbktIn = APR_BRIGADE_FIRST(pCtx->pbbTmp);
apr_bucket *pbktOut;
const char *data;
}
ret=apr_bucket_read(pbktIn, &data, &len, eBlock);
- if(ret != APR_SUCCESS)
+ if (ret != APR_SUCCESS)
return ret;
buf = ap_malloc(len);
- for(n=0 ; n < len ; ++n)
+ for (n=0 ; n < len ; ++n) {
buf[n] = apr_toupper(data[n]);
+ }
pbktOut = apr_bucket_heap_create(buf, len, 0, c->bucket_alloc);
APR_BRIGADE_INSERT_TAIL(pbbOut, pbktOut);
return APR_SUCCESS;
}
-
static const char *CaseFilterInEnable(cmd_parms *cmd, void *dummy, int arg)
{
CaseFilterInConfig *pConfig
{
if (s != NULL) {
ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, s, "mod_example_hooks: %s", note);
- } else {
+ }
+ else {
apr_file_t *out = NULL;
apr_file_open_stderr(&out, p);
apr_file_printf(out, "mod_example_hooks traced in non-loggable "
* Log the call and exit.
*/
trace_startup(ptemp, NULL, NULL, "x_pre_config()");
-
return OK;
}
r->connection->pool);
if ((status == APR_SUCCESS) && conn_data) {
ap_rprintf(r, " <OL>\n%s </OL>\n", (char *) conn_data);
- } else {
+ }
+ else {
ap_rputs(" <P>No connection-specific callback information was "
"retrieved.</P>\n", r);
}
static int x_process_connection(conn_rec *c)
{
trace_connection(c, "x_process_connection()");
-
return DECLINED;
}
*/
static int x_translate_name(request_rec *r)
{
-
/*
* We don't actually *do* anything here, except note the fact that we were
* called.
* on restarts. It assures that the new children will not talk to a stale
* shared memory segment.
*/
-static apr_status_t shm_cleanup_wrapper(void *unused) {
+static apr_status_t shm_cleanup_wrapper(void *unused)
+{
if (exipc_shm)
return apr_shm_destroy(exipc_shm);
return OK;
rs = apr_global_mutex_trylock(exipc_mutex);
if (APR_STATUS_IS_EBUSY(rs)) {
apr_sleep(CAMPOUT);
- } else if (APR_SUCCESS == rs) {
+ }
+ else if (APR_SUCCESS == rs) {
gotlock = 1;
break; /* Get out of the loop */
- } else if (APR_STATUS_IS_ENOTIMPL(rs)) {
+ }
+ else if (APR_STATUS_IS_ENOTIMPL(rs)) {
/* If it's not implemented, just hang in the mutex. */
startcamp = apr_time_now();
rs = apr_global_mutex_lock(exipc_mutex);
if (APR_SUCCESS == rs) {
gotlock = 1;
break; /* Out of the loop */
- } else {
+ }
+ else {
/* Some error, log and bail */
ap_log_error(APLOG_MARK, APLOG_ERR, rs, r->server,
"Child %ld failed to acquire lock",
(long int)getpid());
break; /* Out of the loop without having the lock */
}
- } else {
+ }
+ else {
/* Some other error, log and bail */
ap_log_error(APLOG_MARK, APLOG_ERR, rs, r->server,
"Child %ld failed to try and acquire lock",
(long int)getpid());
break; /* Out of the loop without having the lock */
-
}
+
/*
* The only way to get to this point is if the trylock worked
* and returned BUSY. So, bump the time and try again
ap_rprintf(r, "<tr><td>Counter:</td><td>%u</td></tr>\n",
(unsigned int)base->counter);
ap_rputs("</table>\n", r);
- } else {
+ }
+ else {
/*
* Send a page saying that we couldn't get the lock. Don't say
* what the counter is, because without the lock the value could
NULL, /* table of config file commands */
exipc_register_hooks /* register hooks */
};
-
rewrite_server_conf *sconf;
rewritecond_entry *newcond;
ap_regex_t *regexp;
- char *a1;
- char *a2;
- char *a3;
+ char *a1 = NULL, *a2 = NULL, *a3 = NULL;
const char *err;
sconf = ap_get_module_config(cmd->server->module_config, &rewrite_module);
rewrite_server_conf *sconf;
rewriterule_entry *newrule;
ap_regex_t *regexp;
- char *a1;
- char *a2;
- char *a3;
+ char *a1 = NULL, *a2 = NULL, *a3 = NULL;
const char *err;
sconf = ap_get_module_config(cmd->server->module_config, &rewrite_module);
return rv;
}
- buf = apr_pstrcat(p, "Upgrade: WebSocket", CRLF, "Connection: Upgrade", CRLF, CRLF, NULL);
+ buf = apr_pstrdup(p, "Upgrade: WebSocket" CRLF "Connection: Upgrade" CRLF CRLF);
ap_xlate_proto_to_ascii(buf, strlen(buf));
e = apr_bucket_pool_create(buf, strlen(buf), p, c->bucket_alloc);
APR_BRIGADE_INSERT_TAIL(header_brigade, e);
c = strchr(uri, ':');
if (c == NULL || c[1] != '/' || c[2] != '/' || c[3] == '\0')
- return "Bad syntax for a balancer name";
+ return apr_psprintf(p, "Bad syntax for a balancer name (%s)", uri);
/* remove path from uri */
if ((q = strchr(c + 3, '/')))
*q = '\0';