apr_status_t rv;
char *ip = apr_pstrdup(cmd->temp_pool, arg);
char *s = ap_strchr(ip, '/');
- if (s)
+ if (s) {
*s++ = '\0';
+ }
- if (!config->proxymatch_ip)
+ if (!config->proxymatch_ip) {
config->proxymatch_ip = apr_array_make(cmd->pool, 1, sizeof(*match));
+ }
match = (remoteip_proxymatch_t *) apr_array_push(config->proxymatch_ip);
match->internal = cmd->info;
{
apr_sockaddr_ip_get(&ip, temp_sa);
rv = apr_ipsubnet_create(&match->ip, ip, NULL, cmd->pool);
- if (!(temp_sa = temp_sa->next))
+ if (!(temp_sa = temp_sa->next)) {
break;
+ }
match = (remoteip_proxymatch_t *)
apr_array_push(config->proxymatch_ip);
match->internal = cmd->info;
while (!(ap_cfg_getline(lbuf, MAX_STRING_LEN, cfp))) {
args = lbuf;
while (*(arg = ap_getword_conf(cmd->temp_pool, &args)) != '\0') {
- if (*arg == '#' || *arg == '\0')
+ if (*arg == '#' || *arg == '\0') {
break;
+ }
errmsg = proxies_set(cmd, cfg, arg);
if (errmsg) {
errmsg = apr_psprintf(cmd->pool, "%s at line %d of %s",
}
}
- if (!remote)
+ if (!remote) {
return OK;
+ }
remote = apr_pstrdup(r->pool, remote);
break;
}
}
- if (i && i >= config->proxymatch_ip->nelts)
+ if (i && i >= config->proxymatch_ip->nelts) {
break;
+ }
}
if ((parse_remote = strrchr(remote, ',')) == NULL) {
*(parse_remote++) = '\0';
}
- while (*parse_remote == ' ')
+ while (*parse_remote == ' ') {
++parse_remote;
+ }
eos = parse_remote + strlen(parse_remote) - 1;
- while (eos >= parse_remote && *eos == ' ')
+ while (eos >= parse_remote && *eos == ' ') {
*(eos--) = '\0';
+ }
if (eos < parse_remote) {
- if (remote)
+ if (remote) {
*(remote + strlen(remote)) = ',';
- else
+ }
+ else {
remote = parse_remote;
+ }
break;
}
"RemoteIP: Header %s value of %s cannot be parsed "
"as a client IP",
config->header_name, parse_remote);
- if (remote)
+ if (remote) {
*(remote + strlen(remote)) = ',';
- else
+ }
+ else {
remote = parse_remote;
+ }
break;
}
"RemoteIP: Header %s value of %s appears to be "
"a private IP or nonsensical. Ignored",
config->header_name, parse_remote);
- if (remote)
+ if (remote) {
*(remote + strlen(remote)) = ',';
- else
+ }
+ else {
remote = parse_remote;
+ }
break;
}
/* Set remote_ip string */
if (!internal) {
- if (proxy_ips)
+ if (proxy_ips) {
proxy_ips = apr_pstrcat(r->pool, proxy_ips, ", ",
c->remote_ip, NULL);
- else
+ }
+ else {
proxy_ips = c->remote_ip;
+ }
}
c->remote_addr = temp_sa;
}
/* Nothing happened? */
- if (!conn || (c->remote_addr == conn->orig_addr))
+ if (!conn || (c->remote_addr == conn->orig_addr)) {
return OK;
+ }
/* Fixups here, remote becomes the new Via header value, etc
* In the heavy operations above we used request scope, to limit
conn->proxied_addr.pool = c->pool;
c->remote_addr = &conn->proxied_addr;
- if (remote)
+ if (remote) {
remote = apr_pstrdup(c->pool, remote);
+ }
conn->proxied_remote = remote;
conn->prior_remote = apr_pstrdup(c->pool, apr_table_get(r->headers_in,
config->header_name));
- if (proxy_ips)
+ if (proxy_ips) {
proxy_ips = apr_pstrdup(c->pool, proxy_ips);
+ }
conn->proxy_ips = proxy_ips;
/* Unset remote_host string DNS lookups */
c->remote_logname = NULL;
ditto_request_rec:
- if (conn->proxied_remote)
+ if (conn->proxied_remote) {
apr_table_setn(r->headers_in, config->header_name,
conn->proxied_remote);
- else
+ }
+ else {
apr_table_unset(r->headers_in, config->header_name);
+ }
if (conn->proxy_ips) {
apr_table_setn(r->notes, "remoteip-proxy-ip-list", conn->proxy_ips);
- if (config->proxies_header_name)
+ if (config->proxies_header_name) {
apr_table_setn(r->headers_in, config->proxies_header_name,
conn->proxy_ips);
+ }
}
ap_log_rerror(APLOG_MARK, APLOG_INFO|APLOG_NOERRNO, 0, r,