httpd-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jor...@apache.org
Subject svn commit: r947590 - /httpd/test/framework/trunk/c-modules/echo_post/mod_echo_post.c
Date Mon, 24 May 2010 10:29:39 GMT
Author: jorton
Date: Mon May 24 10:29:39 2010
New Revision: 947590

URL: http://svn.apache.org/viewvc?rev=947590&view=rev
Log:
- use ap_log_rerror rather than fprintf for debugging output
- output an error string if ap_get_client_block fails with 
  an error rather than EOF (e.g. due to a filter returning
  an error)

Modified:
    httpd/test/framework/trunk/c-modules/echo_post/mod_echo_post.c

Modified: httpd/test/framework/trunk/c-modules/echo_post/mod_echo_post.c
URL: http://svn.apache.org/viewvc/httpd/test/framework/trunk/c-modules/echo_post/mod_echo_post.c?rev=947590&r1=947589&r2=947590&view=diff
==============================================================================
--- httpd/test/framework/trunk/c-modules/echo_post/mod_echo_post.c (original)
+++ httpd/test/framework/trunk/c-modules/echo_post/mod_echo_post.c Mon May 24 10:29:39 2010
@@ -45,20 +45,27 @@ static int echo_post_handler(request_rec
         ap_rprintf(r, "%" APR_OFF_T_FMT ":", r->remaining);
     }
 
-    fprintf(stderr, "[mod_echo_post] going to echo %" APR_OFF_T_FMT " bytes\n",
-            r->remaining);
+    ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r,
+                  "[mod_echo_post] going to echo %" APR_OFF_T_FMT " bytes",
+                  r->remaining);
 
     while ((nrd = ap_get_client_block(r, buff, sizeof(buff))) > 0) {
-        fprintf(stderr,
-                "[mod_echo_post] read %ld bytes (wanted %" APR_SIZE_T_FMT 
-                ", remaining=%" APR_OFF_T_FMT ")\n",
-                nrd, sizeof(buff), r->remaining);
+        ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r,
+                      "[mod_echo_post] read %ld bytes (wanted %" APR_SIZE_T_FMT 
+                      ", remaining=%" APR_OFF_T_FMT ")",
+                      nrd, sizeof(buff), r->remaining);
         ap_rwrite(buff, nrd, r);
         total += nrd;
     }
 
-    fprintf(stderr,
-            "[mod_echo_post] done reading %ld bytes, %" APR_OFF_T_FMT " bytes remain\n",
+    if (nrd < 0) {
+        ap_rputs("!!!ERROR!!!", r);
+        ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r,
+                      "[mod_echo_post] ap_get_client_block got error");
+    }
+
+    ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r,
+            "[mod_echo_post] done reading %ld bytes, %" APR_OFF_T_FMT " bytes remain",
             total, r->remaining);
     
     return OK;



Mime
View raw message