Log HTTP responses if option -d is given twice
authorAdam Dickmeiss <adam@indexdata.dk>
Mon, 9 Jan 2012 12:15:28 +0000 (13:15 +0100)
committerAdam Dickmeiss <adam@indexdata.dk>
Mon, 9 Jan 2012 12:15:28 +0000 (13:15 +0100)
src/http.c
src/pazpar2.c

index 456d69b..daefeb8 100644 (file)
@@ -70,6 +70,7 @@ typedef int socklen_t;
 #include "ppmutex.h"
 #include "session.h"
 #include "http.h"
+#include "parameters.h"
 
 #define MAX_HTTP_HEADER 4096
 
@@ -649,6 +650,12 @@ static struct http_buf *http_serialize_response(struct http_channel *c,
     if (r->payload)
         wrbuf_puts(c->wrbuf, r->payload);
 
+    if (global_parameters.dump_records > 1)
+    {
+        FILE *lf = yaz_log_file();
+        yaz_log(YLOG_LOG, "Response:");
+        fwrite(wrbuf_buf(c->wrbuf), 1, wrbuf_len(c->wrbuf), lf);
+    }
     return http_buf_bywrbuf(c->http_server, c->wrbuf);
 }
 
index cb0d162..f4bec6c 100644 (file)
@@ -123,7 +123,7 @@ static int sc_main(
        switch (ret)
         {
         case 'd':
-            global_parameters.dump_records = 1;
+            global_parameters.dump_records++;
             break;
         case 'D':
             daemon = 1;