From d391d478f359e4792f6afc75d5732c1404fd9f28 Mon Sep 17 00:00:00 2001 From: Adam Dickmeiss Date: Mon, 9 Jan 2012 13:15:28 +0100 Subject: [PATCH] Log HTTP responses if option -d is given twice --- src/http.c | 7 +++++++ src/pazpar2.c | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/src/http.c b/src/http.c index 456d69b..daefeb8 100644 --- a/src/http.c +++ b/src/http.c @@ -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); } diff --git a/src/pazpar2.c b/src/pazpar2.c index cb0d162..f4bec6c 100644 --- a/src/pazpar2.c +++ b/src/pazpar2.c @@ -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; -- 1.7.10.4