View | Details | Raw Unified | Return to bug 56395
Collapse All | Expand All

(-)include/http_core.h (+5 lines)
Lines 692-697 Link Here
692
#define AP_HTTP_EXPECT_STRICT_ENABLE   1
692
#define AP_HTTP_EXPECT_STRICT_ENABLE   1
693
#define AP_HTTP_EXPECT_STRICT_DISABLE  2
693
#define AP_HTTP_EXPECT_STRICT_DISABLE  2
694
    int http_expect_strict;
694
    int http_expect_strict;
695
696
#define AP_EXPORT_SERVER_ADDR_UNSET    0
697
#define AP_EXPORT_SERVER_ADDR_ENABLE   1
698
#define AP_EXPORT_SERVER_ADDR_DISABLE  2
699
    int export_server_addr;
695
} core_server_config;
700
} core_server_config;
696
701
697
/* for AddOutputFiltersByType in core.c */
702
/* for AddOutputFiltersByType in core.c */
(-)server/core.c (+18 lines)
Lines 525-530 Link Here
525
    if (virt->http_expect_strict != AP_HTTP_EXPECT_STRICT_UNSET)
525
    if (virt->http_expect_strict != AP_HTTP_EXPECT_STRICT_UNSET)
526
        conf->http_expect_strict = virt->http_expect_strict;
526
        conf->http_expect_strict = virt->http_expect_strict;
527
527
528
    if (virt->export_server_addr != AP_EXPORT_SERVER_ADDR_UNSET)
529
        conf->export_server_addr = virt->export_server_addr;
530
528
    /* no action for virt->accf_map, not allowed per-vhost */
531
    /* no action for virt->accf_map, not allowed per-vhost */
529
532
530
    if (virt->protocol)
533
    if (virt->protocol)
Lines 3806-3811 Link Here
3806
    return NULL;
3809
    return NULL;
3807
}
3810
}
3808
3811
3812
static const char *set_export_server_addr(cmd_parms *cmd, void *dummy, int arg)
3813
{
3814
    core_server_config *conf =
3815
        ap_get_core_module_config(cmd->server->module_config);
3816
3817
    if (arg) {
3818
        conf->export_server_addr = AP_EXPORT_SERVER_ADDR_ENABLE;
3819
    } else {
3820
        conf->export_server_addr = AP_EXPORT_SERVER_ADDR_DISABLE;
3821
    }
3822
    return NULL;
3823
}
3824
3809
static apr_hash_t *errorlog_hash;
3825
static apr_hash_t *errorlog_hash;
3810
3826
3811
static int log_constant_item(const ap_errorlog_info *info, const char *arg,
3827
static int log_constant_item(const ap_errorlog_info *info, const char *arg,
Lines 4367-4372 Link Here
4367
  "whether to permit Content-Length of 0 responses to HEAD requests"),
4383
  "whether to permit Content-Length of 0 responses to HEAD requests"),
4368
AP_INIT_FLAG("HttpExpectStrict", set_expect_strict, NULL, OR_OPTIONS,
4384
AP_INIT_FLAG("HttpExpectStrict", set_expect_strict, NULL, OR_OPTIONS,
4369
  "whether to return a 417 if a client doesn't send 100-Continue"),
4385
  "whether to return a 417 if a client doesn't send 100-Continue"),
4386
AP_INIT_FLAG("ExportServerAddr", set_export_server_addr, NULL, RSRC_CONF,
4387
  "whether to export the SERVER_ADDR environment variable"),
4370
{ NULL }
4388
{ NULL }
4371
};
4389
};
4372
4390
(-)server/util_script.c (-1 / +4 lines)
Lines 140-145 Link Here
140
    apr_table_t *e;
140
    apr_table_t *e;
141
    server_rec *s = r->server;
141
    server_rec *s = r->server;
142
    conn_rec *c = r->connection;
142
    conn_rec *c = r->connection;
143
    core_server_config *conf = ap_get_core_module_config(s->module_config);
143
    const char *env_temp;
144
    const char *env_temp;
144
    const apr_array_header_t *hdrs_arr = apr_table_elts(r->headers_in);
145
    const apr_array_header_t *hdrs_arr = apr_table_elts(r->headers_in);
145
    const apr_table_entry_t *hdrs = (const apr_table_entry_t *) hdrs_arr->elts;
146
    const apr_table_entry_t *hdrs = (const apr_table_entry_t *) hdrs_arr->elts;
Lines 232-238 Link Here
232
    apr_table_addn(e, "SERVER_SOFTWARE", ap_get_server_banner());
233
    apr_table_addn(e, "SERVER_SOFTWARE", ap_get_server_banner());
233
    apr_table_addn(e, "SERVER_NAME",
234
    apr_table_addn(e, "SERVER_NAME",
234
                   ap_escape_html(r->pool, ap_get_server_name_for_url(r)));
235
                   ap_escape_html(r->pool, ap_get_server_name_for_url(r)));
235
    apr_table_addn(e, "SERVER_ADDR", r->connection->local_ip);  /* Apache */
236
    if (conf->export_server_addr != AP_EXPORT_SERVER_ADDR_DISABLE) {
237
        apr_table_addn(e, "SERVER_ADDR", r->connection->local_ip);  /* Apache */
238
    }
236
    apr_table_addn(e, "SERVER_PORT",
239
    apr_table_addn(e, "SERVER_PORT",
237
                  apr_psprintf(r->pool, "%u", ap_get_server_port(r)));
240
                  apr_psprintf(r->pool, "%u", ap_get_server_port(r)));
238
    add_unless_null(e, "REMOTE_HOST",
241
    add_unless_null(e, "REMOTE_HOST",

Return to bug 56395