Mailing List Archive

cvs commit: apache-1.3/src/main http_core.c
brian 98/05/04 21:48:06

Modified: src/modules/standard mod_log_config.c mod_rewrite.c
mod_status.c
src/main http_core.c
Log:
Hi,

the patch makes mod_rewrite, mod_log_config, mod_status and
the ServerSignature feature compatible with 'UseCanonicalName off'
by changing r->server->server_hostname to ap_get_server_name().

And I changed some functions which use r->server->port to
use ap_get_server_port() instead, because if there's no Port directive
in the config r->server->port is 0.

ciao...
--
Lars Eilebrecht - Reality has always been to small
sfx@unix-ag.org - for human imagination.
http://www.home.unix-ag.org/sfx/

Revision Changes Path
1.56 +2 -2 apache-1.3/src/modules/standard/mod_log_config.c

Index: mod_log_config.c
===================================================================
RCS file: /export/home/cvs/apache-1.3/src/modules/standard/mod_log_config.c,v
retrieving revision 1.55
retrieving revision 1.56
diff -u -r1.55 -r1.56
--- mod_log_config.c 1998/04/29 23:46:03 1.55
+++ mod_log_config.c 1998/05/05 04:47:58 1.56
@@ -404,12 +404,12 @@
*/
static char *log_virtual_host(request_rec *r, char *a)
{
- return ap_pstrdup(r->pool, r->server->server_hostname);
+ return ap_pstrdup(r->pool, ap_get_server_name(r));
}

static char *log_server_port(request_rec *r, char *a)
{
- return ap_psprintf(r->pool, "%u", r->server->port);
+ return ap_psprintf(r->pool, "%u", ap_get_server_port(r));
}

static char *log_child_pid(request_rec *r, char *a)



1.102 +12 -9 apache-1.3/src/modules/standard/mod_rewrite.c

Index: mod_rewrite.c
===================================================================
RCS file: /export/home/cvs/apache-1.3/src/modules/standard/mod_rewrite.c,v
retrieving revision 1.101
retrieving revision 1.102
diff -u -r1.101 -r1.102
--- mod_rewrite.c 1998/04/11 12:00:50 1.101
+++ mod_rewrite.c 1998/05/05 04:47:59 1.102
@@ -998,11 +998,12 @@
*/

/* add the canonical URI of this URL */
- thisserver = r->server->server_hostname;
- if (is_default_port(r->server->port, r))
+ thisserver = (char *) ap_get_server_name(r);
+ thisport = (char *) ap_get_server_port(r);
+ if (is_default_port((int) thisport, r))
thisport = "";
else {
- ap_snprintf(buf, sizeof(buf), ":%u", r->server->port);
+ ap_snprintf(buf, sizeof(buf), ":%u", thisport);
thisport = buf;
}
thisurl = ap_table_get(r->subprocess_env, ENVVAR_SCRIPT_URL);
@@ -2249,25 +2250,27 @@
{
int i;
char port[32];
+ char *thisport;

i = strlen(r->filename);
if (!( (i > 7 && strncasecmp(r->filename, "http://", 7) == 0)
|| (i > 8 && strncasecmp(r->filename, "https://", 8) == 0)
|| (i > 9 && strncasecmp(r->filename, "gopher://", 9) == 0)
|| (i > 6 && strncasecmp(r->filename, "ftp://", 6) == 0))) {
-
- if (is_default_port(r->server->port,r))
+
+ thisport = (char *) ap_get_server_port(r);
+ if (is_default_port((int) thisport,r))
port[0] = '\0';
else
- ap_snprintf(port, sizeof(port), ":%u", r->server->port);
+ ap_snprintf(port, sizeof(port), ":%u", thisport);

if (r->filename[0] == '/')
r->filename = ap_psprintf(r->pool, "%s://%s%s%s",
- http_method(r), r->server->server_hostname,
+ http_method(r), ap_get_server_name(r),
port, r->filename);
else
r->filename = ap_psprintf(r->pool, "%s://%s%s/%s",
- http_method(r), r->server->server_hostname,
+ http_method(r), ap_get_server_name(r),
port, r->filename);
}
return;
@@ -2960,7 +2963,7 @@

ap_snprintf(str3, sizeof(str3),
"%s %s [%s/sid#%lx][rid#%lx/%s%s] (%d) %s\n", str1,
- current_logtime(r), r->server->server_hostname,
+ current_logtime(r), ap_get_server_name(r),
(unsigned long)(r->server), (unsigned long)r,
type, redir, level, str2);




1.86 +1 -2 apache-1.3/src/modules/standard/mod_status.c

Index: mod_status.c
===================================================================
RCS file: /export/home/cvs/apache-1.3/src/modules/standard/mod_status.c,v
retrieving revision 1.85
retrieving revision 1.86
diff -u -r1.85 -r1.86
--- mod_status.c 1998/04/11 12:00:51 1.85
+++ mod_status.c 1998/05/05 04:47:59 1.86
@@ -234,7 +234,6 @@
#endif /* STATUS */
int short_report = 0;
int no_table_report = 0;
- server_rec *server = r->server;
short_score score_record;
parent_score ps_record;
char stat_buffer[HARD_SERVER_LIMIT];
@@ -324,7 +323,7 @@
if (!short_report) {
ap_rputs("<HTML><HEAD>\n<TITLE>Apache Status</TITLE>\n</HEAD><BODY>\n", r);
ap_rputs("<H1>Apache Server Status for ", r);
- ap_rvputs(r, server->server_hostname, "</H1>\n\n", NULL);
+ ap_rvputs(r, ap_get_server_name(r), "</H1>\n\n", NULL);
ap_rvputs(r, "Server Version: ", ap_get_server_version(), "<br>\n",
NULL);
ap_rvputs(r, "Server Built: ", ap_get_server_built(), "<br>\n<hr>\n",



1.192 +3 -3 apache-1.3/src/main/http_core.c

Index: http_core.c
===================================================================
RCS file: /export/home/cvs/apache-1.3/src/main/http_core.c,v
retrieving revision 1.191
retrieving revision 1.192
diff -u -r1.191 -r1.192
--- http_core.c 1998/05/04 16:46:41 1.191
+++ http_core.c 1998/05/05 04:48:05 1.192
@@ -1836,16 +1836,16 @@
if (conf->server_signature == srv_sig_off)
return "";

- ap_snprintf(sport, sizeof sport, "%u", (unsigned) r->server->port);
+ ap_snprintf(sport, sizeof sport, "%u", (unsigned) ap_get_server_port(r));

if (conf->server_signature == srv_sig_withmail) {
return ap_pstrcat(r->pool, prefix, "<ADDRESS>" SERVER_BASEVERSION
" Server at <A HREF=\"mailto:", r->server->server_admin, "\">",
- r->server->server_hostname, "</A> Port ", sport,
+ ap_get_server_name(r), "</A> Port ", sport,
"</ADDRESS>\n", NULL);
}
return ap_pstrcat(r->pool, prefix, "<ADDRESS>" SERVER_BASEVERSION
- " Server at ", r->server->server_hostname, " Port ", sport,
+ " Server at ", ap_get_server_name(r), " Port ", sport,
"</ADDRESS>\n", NULL);
}