httpd-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From s.@apache.org
Subject svn commit: r963057 - /httpd/httpd/trunk/modules/http/http_filters.c
Date Sun, 11 Jul 2010 12:07:51 GMT
Author: sf
Date: Sun Jul 11 12:07:51 2010
New Revision: 963057

URL: http://svn.apache.org/viewvc?rev=963057&view=rev
Log:
Improve trace logging of sent response:
- log response status
- log Date and Server headers

Modified:
    httpd/httpd/trunk/modules/http/http_filters.c

Modified: httpd/httpd/trunk/modules/http/http_filters.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/http/http_filters.c?rev=963057&r1=963056&r2=963057&view=diff
==============================================================================
--- httpd/httpd/trunk/modules/http/http_filters.c (original)
+++ httpd/httpd/trunk/modules/http/http_filters.c Sun Jul 11 12:07:51 2010
@@ -805,8 +805,6 @@ static apr_status_t send_all_header_fiel
     } while (t_elt < t_end);
 
     if (APLOGrtrace4(r)) {
-        ap_log_rerror(APLOG_MARK, APLOG_TRACE4, 0, r,
-                      "Headers sent to client:");
         t_elt = (const apr_table_entry_t *)(elts->elts);
         do {
             ap_log_rerror(APLOG_MARK, APLOG_TRACE4, 0, r, "  %s: %s",
@@ -899,7 +897,8 @@ static void basic_http_header(request_re
                               const char *protocol)
 {
     char *date;
-    const char *server;
+    const char *proxy_date = NULL;
+    const char *server = NULL;
     const char *us = ap_get_server_banner();
     header_struct h;
     struct iovec vec[4];
@@ -939,8 +938,6 @@ static void basic_http_header(request_re
      * generate a new server header / date header
      */
     if (r->proxyreq != PROXYREQ_NONE) {
-        const char *proxy_date;
-
         proxy_date = apr_table_get(r->headers_out, "Date");
         if (!proxy_date) {
             /*
@@ -950,30 +947,42 @@ static void basic_http_header(request_re
              */
             date = apr_palloc(r->pool, APR_RFC822_DATE_LEN);
             ap_recent_rfc822_date(date, r->request_time);
-            proxy_date = date;
         }
-        form_header_field(&h, "Date", proxy_date);
         server = apr_table_get(r->headers_out, "Server");
-        if (server) {
-            form_header_field(&h, "Server", server);
-        } else {
-            if (*us) {
-                form_header_field(&h, "Server", ap_get_server_banner());
-            }
-        }
     }
     else {
         date = apr_palloc(r->pool, APR_RFC822_DATE_LEN);
         ap_recent_rfc822_date(date, r->request_time);
-        form_header_field(&h, "Date", date);
-        if (*us) {
-            form_header_field(&h, "Server", ap_get_server_banner());
-        }
     }
 
+    form_header_field(&h, "Date", proxy_date ? proxy_date : date );
+
+    if (!server && *us)
+        server = us;
+    if (server)
+        form_header_field(&h, "Server", server);
+
+    if (APLOGrtrace3(r)) {
+        ap_log_rerror(APLOG_MARK, APLOG_TRACE3, 0, r,
+                      "Response sent with status %d%s",
+		      r->status,
+		      APLOGrtrace4(r) ? ", headers:" : "");
+
+        /*
+         * Date and Server are less interesting, use TRACE5 for them while
+         * using TRACE4 for the other headers.
+         */
+        ap_log_rerror(APLOG_MARK, APLOG_TRACE5, 0, r, "  %s: %s", "Date",
+                      proxy_date ? proxy_date : date );
+        if (server)
+            ap_log_rerror(APLOG_MARK, APLOG_TRACE5, 0, r, "  %s: %s", "Server",
+                          server);
+    }
+
+
     /* unset so we don't send them again */
     apr_table_unset(r->headers_out, "Date");        /* Avoid bogosity */
-    if (*us) {
+    if (server) {
         apr_table_unset(r->headers_out, "Server");
     }
 }



Mime
View raw message