dgaudet 98/04/19 13:10:49
Modified: htdocs/manual invoking.html new_features_1_3.html
htdocs/manual/vhosts index.html
src CHANGES
src/include http_conf_globals.h httpd.h
src/main http_core.c http_main.c http_vhost.c
src/support httpd.8
Log:
This should help folks trying to understand vhosts. It adds the command
line option -S which dumps a description of how apache parsed the vhost
directives. In particular it'd really help the folks who recently ran
into /etc/hosts mismatches with DNS.
Revision Changes Path
1.18 +4 -0 apache-1.3/htdocs/manual/invoking.html
Index: invoking.html
===================================================================
RCS file: /export/home/cvs/apache-1.3/htdocs/manual/invoking.html,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -r1.17 -r1.18
--- invoking.html 1998/02/05 20:04:10 1.17
+++ invoking.html 1998/04/19 20:10:41 1.18
@@ -59,6 +59,10 @@
<DT><CODE>-l</CODE>
<DD>Give a list of all modules compiled into the server.
+<DT><CODE>-S</CODE>
+<DD>Show the settings as parsed from the config file (currently only
+shows a breakdown of the vhost settings).
+
<DT><CODE>-?</CODE>
<DD>Print a list of the httpd options, and then exit.
</DL>
1.53 +7 -0 apache-1.3/htdocs/manual/new_features_1_3.html
Index: new_features_1_3.html
===================================================================
RCS file: /export/home/cvs/apache-1.3/htdocs/manual/new_features_1_3.html,v
retrieving revision 1.52
retrieving revision 1.53
diff -u -r1.52 -r1.53
--- new_features_1_3.html 1998/04/01 12:23:13 1.52
+++ new_features_1_3.html 1998/04/19 20:10:42 1.53
@@ -626,6 +626,13 @@
outside the Apache source tree. To achieve this APACI installs the Apache C
header files together with the <CODE>apxs</CODE> tool.
</LI>
+ <li><strong>-S command line option for debugging vhost setup</strong>
+ <br>
+ If Apache is invoked with the <code>-S</code> command line option it will
+ dump out information regarding how it parsed the <code>VirtualHost</code>
+ sections. This is useful for folks trying to debug their virtual host
+ configuration.
+ </li>
</UL>
<!--#include virtual="footer.html" -->
1.3 +6 -0 apache-1.3/htdocs/manual/vhosts/index.html
Index: index.html
===================================================================
RCS file: /export/home/cvs/apache-1.3/htdocs/manual/vhosts/index.html,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- index.html 1998/01/26 16:54:34 1.2
+++ index.html 1998/04/19 20:10:43 1.3
@@ -53,6 +53,12 @@
<LI><A HREF="../mod/core.html#serverpath">ServerPath</A>
</UL>
+<p>Folks trying to debug their virtual host configuration may find the
+Apache <code>-S</code> command line switch useful. It will dump out a
+description of how Apache parsed the configuration file. Careful
+examination of the IP addresses and server names may help uncover
+configuration mistakes.
+
<!--#include virtual="footer.html" -->
</BODY>
</HTML>
1.777 +5 -0 apache-1.3/src/CHANGES
Index: CHANGES
===================================================================
RCS file: /export/home/cvs/apache-1.3/src/CHANGES,v
retrieving revision 1.776
retrieving revision 1.777
diff -u -r1.776 -r1.777
--- CHANGES 1998/04/19 19:19:35 1.776
+++ CHANGES 1998/04/19 20:10:43 1.777
@@ -1,5 +1,10 @@
Changes with Apache 1.3b7
+ *) If you start apache with the -S command line option it will dump
+ out the parsed vhost settings. This is useful for folks trying
+ to figure out what is wrong with their vhost configuration.
+ (Other dumps may be added in the future.) [Dean Gaudet]
+
*) Add %pA, %pI, and %pp codes to ap_vformatter (and hence ap_bprintf,
ap_snprintf, and ap_psprintf). See include/ap.h for docs.
[Dean Gaudet]
1.28 +1 -0 apache-1.3/src/include/http_conf_globals.h
Index: http_conf_globals.h
===================================================================
RCS file: /export/home/cvs/apache-1.3/src/include/http_conf_globals.h,v
retrieving revision 1.27
retrieving revision 1.28
diff -u -r1.27 -r1.28
--- http_conf_globals.h 1998/04/11 12:00:19 1.27
+++ http_conf_globals.h 1998/04/19 20:10:44 1.28
@@ -80,6 +80,7 @@
extern int ap_daemons_limit;
extern MODULE_VAR_EXPORT int ap_suexec_enabled;
extern int ap_listenbacklog;
+extern int ap_dump_settings;
extern char *ap_pid_fname;
extern char *ap_scoreboard_fname;
1.206 +4 -0 apache-1.3/src/include/httpd.h
Index: httpd.h
===================================================================
RCS file: /export/home/cvs/apache-1.3/src/include/httpd.h,v
retrieving revision 1.205
retrieving revision 1.206
diff -u -r1.205 -r1.206
--- httpd.h 1998/04/16 00:19:39 1.205
+++ httpd.h 1998/04/19 20:10:45 1.206
@@ -753,6 +753,10 @@
server_rec *next;
+ /* description of where the definition came from */
+ const char *defn_name;
+ unsigned defn_line_number;
+
/* Full locations of server config info */
char *srm_confname;
1.186 +4 -1 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.185
retrieving revision 1.186
diff -u -r1.185 -r1.186
--- http_core.c 1998/04/18 21:37:58 1.185
+++ http_core.c 1998/04/19 20:10:46 1.186
@@ -1202,7 +1202,10 @@
s->next = main_server->next;
main_server->next = s;
-
+
+ s->defn_name = cmd->config_file->name;
+ s->defn_line_number = cmd->config_file->line_number;
+
old_end_token = cmd->end_token;
cmd->end_token = end_virtualhost_section;
cmd->server = s;
1.325 +14 -5 apache-1.3/src/main/http_main.c
Index: http_main.c
===================================================================
RCS file: /export/home/cvs/apache-1.3/src/main/http_main.c,v
retrieving revision 1.324
retrieving revision 1.325
diff -u -r1.324 -r1.325
--- http_main.c 1998/04/11 12:00:29 1.324
+++ http_main.c 1998/04/19 20:10:46 1.325
@@ -244,6 +244,7 @@
time_t ap_restart_time;
int ap_suexec_enabled = 0;
int ap_listenbacklog;
+int ap_dump_settings;
/*
* The max child slot ever assigned, preserved across restarts. Necessary
@@ -803,7 +804,7 @@
fprintf(stderr, "Usage: %s [-d directory] [-f file]\n", bin);
#endif
fprintf(stderr, " %s [-C \"directive\"] [-c \"directive\"]\n",
pad);
- fprintf(stderr, " %s [-v] [-V] [-h] [-l]\n", pad);
+ fprintf(stderr, " %s [-v] [-V] [-h] [-l] [-S]\n", pad);
fprintf(stderr, "Options:\n");
#ifdef SHARED_CORE
fprintf(stderr, " -L directory : specify an alternate location for
shared object files\n");
@@ -816,6 +817,7 @@
fprintf(stderr, " -V : show compile settings\n");
fprintf(stderr, " -h : list available configuration
directives\n");
fprintf(stderr, " -l : list compiled-in modules\n");
+ fprintf(stderr, " -S : show parsed settings (currently
only vhost settings)\n");
exit(1);
}
@@ -3968,11 +3970,12 @@
ap_setup_prelinked_modules();
+ while ((c = getopt(argc, argv,
+ "C:c:Xd:f:vVhlL:S"
#ifdef DEBUG_SIGSTOP
- while ((c = getopt(argc, argv, "C:c:Xd:f:vVhlL:Z:")) != -1) {
-#else
- while ((c = getopt(argc, argv, "C:c:Xd:f:vVhlL:")) != -1) {
+ "Z:"
#endif
+ )) != -1) {
char **new;
switch (c) {
case 'c':
@@ -4019,6 +4022,9 @@
*/
break;
#endif
+ case 'S':
+ ap_dump_settings = 1;
+ break;
case '?':
usage(argv[0]);
}
@@ -5065,7 +5071,7 @@
ap_setup_prelinked_modules();
- while ((c = getopt(argc, argv, "C:c:Xd:f:vVhlZ:ius")) != -1) {
+ while ((c = getopt(argc, argv, "C:c:Xd:f:vVhlZ:iusS")) != -1) {
char **new;
switch (c) {
case 'c':
@@ -5094,6 +5100,9 @@
break;
case 's':
run_as_service = 0;
+ break;
+ case 'S':
+ ap_dump_settings = 1;
break;
#endif /* WIN32 */
case 'd':
1.14 +60 -0 apache-1.3/src/main/http_vhost.c
Index: http_vhost.c
===================================================================
RCS file: /export/home/cvs/apache-1.3/src/main/http_vhost.c,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -r1.13 -r1.14
--- http_vhost.c 1998/04/11 12:00:31 1.13
+++ http_vhost.c 1998/04/19 20:10:47 1.14
@@ -410,6 +410,63 @@
}
+static void dump_vhost_config(FILE *f)
+{
+ int i;
+ ipaddr_chain *ic;
+ name_chain *nc;
+ char buf[MAX_STRING_LEN];
+
+ fprintf(f, "VirtualHost configuration:\n");
+ for (i = 0; i < IPHASH_TABLE_SIZE; ++i) {
+ for (ic = iphash_table[i]; ic; ic = ic->next) {
+ if (ic->sar->host_port == 0) {
+ ap_snprintf(buf, sizeof(buf), "%pA:*", &ic->sar->host_addr);
+ }
+ else {
+ ap_snprintf(buf, sizeof(buf), "%pA:%u", &ic->sar->host_addr,
+ ic->sar->host_port);
+ }
+ if (ic->names == NULL) {
+ fprintf(f, "%-22s %s (%s:%u)\n", buf,
+ ic->server->server_hostname, ic->server->defn_name,
+ ic->server->defn_line_number);
+ continue;
+ }
+ fprintf(f, "%-22s is a NameVirtualHost\n"
+ "%22s default server %s (%s:%u)\n",
+ buf, "", ic->server->server_hostname,
+ ic->server->defn_name, ic->server->defn_line_number);
+ for (nc = ic->names; nc; nc = nc->next) {
+ if (nc->sar->host_port) {
+ fprintf(f, "%22s port %u ", "", nc->sar->host_port);
+ }
+ else {
+ fprintf(f, "%22s port * ", "");
+ }
+ fprintf(f, "namevhost %s (%s:%u)\n",
+ nc->server->server_hostname,
+ nc->server->defn_name,
+ nc->server->defn_line_number);
+ }
+ }
+ }
+ if (default_list) {
+ fprintf(f, "_default_ servers:\n");
+ for (ic = default_list; ic; ic = ic->next) {
+ if (ic->sar->host_port == 0) {
+ fprintf(f, "port * ");
+ }
+ else {
+ fprintf(f, "port %u ", ic->sar->host_port);
+ }
+ fprintf(f, "server %s (%s:%u)\n",
+ ic->server->server_hostname, ic->server->defn_name,
+ ic->server->defn_line_number);
+ }
+ }
+}
+
/* compile the tables and such we need to do the run-time vhost lookups */
void ap_fini_vhost_config(pool *p, server_rec *main_s)
{
@@ -590,6 +647,9 @@
#ifdef IPHASH_STATISTICS
dump_iphash_statistics(main_s);
#endif
+ if (ap_dump_settings) {
+ dump_vhost_config(stderr);
+ }
}
1.8 +6 -0 apache-1.3/src/support/httpd.8
Index: httpd.8
===================================================================
RCS file: /export/home/cvs/apache-1.3/src/support/httpd.8,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- httpd.8 1998/04/10 10:34:36 1.7
+++ httpd.8 1998/04/19 20:10:48 1.8
@@ -85,6 +85,9 @@
.B \-V
]
[
+.B \-S
+]
+[
.B \-?
]
@@ -141,6 +144,9 @@
.TP
.B \-l
Output a list of modules compiled into the server.
+.B \-S
+Show the settings as parsed from the config file (currently only shows the
+virtualhost settings).
.TP
.B \-X
Run in single-process mode, for internal debugging purposes only; the daemon