39 lines
1.3 KiB
Plaintext
39 lines
1.3 KiB
Plaintext
$OpenBSD: patch-apache1_mod_scgi_c,v 1.1 2008/05/09 08:26:53 mbalmer Exp $
|
|
--- apache1/mod_scgi.c.orig Wed Dec 5 12:19:31 2007
|
|
+++ apache1/mod_scgi.c Wed Dec 5 12:23:12 2007
|
|
@@ -266,13 +266,23 @@ static int send_headers(request_rec *r, BUFF *f)
|
|
table *t;
|
|
array_header *hdrs_arr, *env_arr;
|
|
table_entry *hdrs, *env;
|
|
- int i;
|
|
+ char sbuf[NI_MAXSERV];
|
|
+ u_int16_t port;
|
|
+ int error, i;
|
|
unsigned long n;
|
|
|
|
log_debug(r, "sending headers");
|
|
t = ap_make_table(r->pool, 40); /* headers to send */
|
|
if (!t)
|
|
return 0;
|
|
+
|
|
+ error = getnameinfo((struct sockaddr *)&r->connection->remote_addr,
|
|
+ r->connection->remote_addr.ss_len, NULL, 0, sbuf, sizeof(sbuf),
|
|
+ NI_NUMERICSERV);
|
|
+ if (!error)
|
|
+ port = atol(sbuf);
|
|
+ else
|
|
+ port = 0;
|
|
/* CONTENT_LENGTH must come first and always be present */
|
|
add_header(t, "CONTENT_LENGTH",
|
|
ap_psprintf(r->pool, "%ld", r->remaining));
|
|
@@ -286,8 +296,7 @@ static int send_headers(request_rec *r, BUFF *f)
|
|
ap_psprintf(r->pool, "%u", ap_get_server_port(r)));
|
|
add_header(t, "REMOTE_ADDR", r->connection->remote_ip);
|
|
add_header(t, "REMOTE_PORT",
|
|
- ap_psprintf(r->pool, "%d",
|
|
- ntohs(r->connection->remote_addr.sin_port)));
|
|
+ ap_psprintf(r->pool, "%d", port));
|
|
add_header(t, "REMOTE_USER", r->connection->user);
|
|
add_header(t, "REQUEST_METHOD", r->method);
|
|
add_header(t, "REQUEST_URI", original_uri(r));
|