httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Marc Slemko <ma...@znep.com>
Subject patch for extra server error info to client
Date Sun, 24 Aug 1997 07:43:29 GMT
Still a work in progress.  Anyone like or dislike this feature?

Yes, it does need to be setup to be configurable, probably with a default
of disabled.  This seems to me like it would be a good Options setting,
but we are out of bits there.  It could be made a global config option, or
it could be a per-directory option.  The effort needed to make it
per-directory seems silly though; not that it isn't worth doing, but just
that it takes so much.

I have just done one example so far to demonstrate it.



Index: http_protocol.c
===================================================================
RCS file: /export/home/cvs/apachen/src/main/http_protocol.c,v
retrieving revision 1.155
diff -u -r1.155 http_protocol.c
--- http_protocol.c	1997/08/18 07:19:36	1.155
+++ http_protocol.c	1997/08/24 07:37:29
@@ -827,6 +827,8 @@
     
     r->status = HTTP_REQUEST_TIME_OUT;	/* Until we get a request */
 
+    r->server_error = NULL;
+
     /* Get the request... */
     
     keepalive_timeout("read request line", r);
@@ -2143,6 +2145,7 @@
 	    bputs(" and inform them of the time the error occurred,\n", fd);
 	    bputs("and anything you might have done that may have\n", fd);
 	    bputs("caused the error.<P>\n", fd);
+	    if (r->server_error) bputs(r->server_error, fd);
 	    break;
 	}
 
Index: httpd.h
===================================================================
RCS file: /export/home/cvs/apachen/src/main/httpd.h,v
retrieving revision 1.143
diff -u -r1.143 httpd.h
--- httpd.h	1997/08/23 16:17:13	1.143
+++ httpd.h	1997/08/24 07:37:36
@@ -624,13 +624,15 @@
   void *per_dir_config;		/* Options set in config files, etc. */
   void *request_config;		/* Notes on *this* request */
 
-/*
- * a linked list of the configuration directives in the .htaccess files
- * accessed by this request.
- * N.B. always add to the head of the list, _never_ to the end.
- * that way, a sub request's list can (temporarily) point to a parent's list
- */
+  /*
+   * a linked list of the configuration directives in the .htaccess files
+   * accessed by this request.
+   * N.B. always add to the head of the list, _never_ to the end.
+   * that way, a sub request's list can (temporarily) point to a parent's list
+   */
   const struct htaccess_result *htaccess;
+
+  const char *server_error;
 };
 
 
@@ -875,6 +877,8 @@
 #define AP_SLACK_LOW	1
 #define AP_SLACK_HIGH	2
 #endif
+
+API_EXPORT(void) set_server_error (request_rec *r, const char *s);
 
 /*
  * Redefine assert() to something more useful for an Apache...
Index: util.c
===================================================================
RCS file: /export/home/cvs/apachen/src/main/util.c,v
retrieving revision 1.67
diff -u -r1.67 util.c
--- util.c	1997/07/27 03:13:31	1.67
+++ util.c	1997/08/24 07:37:40
@@ -1425,6 +1425,10 @@
 }
 #endif /* NO_SLACK */
 
+void set_server_error (request_rec *r, const char *s) {
+    r->server_error = pstrcat(r->pool, pstrdup(r->pool, "The reason for this error
is: "), s, NULL) ;
+}
+
 #if defined(NEED_DIFFTIME)
 double difftime(time_t time1, time_t time0)
 {
Index: util_script.c
===================================================================
RCS file: /export/home/cvs/apachen/src/main/util_script.c,v
retrieving revision 1.69
diff -u -r1.69 util_script.c
--- util_script.c	1997/08/05 06:33:26	1.69
+++ util_script.c	1997/08/24 07:37:42
@@ -213,6 +213,7 @@
     if (r->prev) {
         if (r->prev->args) table_set(e,"REDIRECT_QUERY_STRING", r->prev->args);
 	if (r->prev->uri) table_set (e, "REDIRECT_URL", r->prev->uri);
+	if (r->prev->server_error) table_set (e, "REDIRECT_SERVER_ERROR", r->prev->server_error);
     }
 }
 
@@ -339,7 +340,11 @@
 
 	if ((*getsfunc)(w, MAX_STRING_LEN-1, getsfunc_data) == 0) {
 	    kill_timeout (r);
-	    log_reason ("Premature end of script headers", r->filename, r);
+	    log_reason ("Premature end of script headers.", r->filename, r);
+	    set_server_error(r, "<P><QUOTE>Premature end of script headers.  The "
+    	    	"script did not output the correct headers.  This may "
+		"be due to a bug in the script or a failure to execute "
+		"it.");
 	    return SERVER_ERROR;
         }
 


Mime
View raw message