/* This file is part of Pazpar2.
- Copyright (C) 2006-2011 Index Data
+ Copyright (C) 2006-2012 Index Data
Pazpar2 is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free
#include "ppmutex.h"
#include "session.h"
#include "http.h"
+#include "parameters.h"
#define MAX_HTTP_HEADER 4096
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);
}
{
struct timeval tv;
gettimeofday(&tv, 0);
- fprintf(hc->http_server->record_file, "%lld %lld %lld 0\n",
+ fprintf(hc->http_server->record_file, "r %lld %lld %lld 0\n",
(long long) tv.tv_sec, (long long) tv.tv_usec,
(long long) iochan_getfd(i));
}
for (hb = hc->iqueue; hb; hb = hb->next)
sz += hb->len;
gettimeofday(&tv, 0);
- fprintf(hc->http_server->record_file, "%lld %lld %lld %d\n",
+ fprintf(hc->http_server->record_file, "r %lld %lld %lld %d\n",
(long long) tv.tv_sec, (long long) tv.tv_usec,
(long long) iochan_getfd(i), sz);
for (hb = hc->iqueue; hb; hb = hb->next)
fwrite(hb->buf, 1, hb->len, hc->http_server->record_file);
+ fflush(hc->http_server->record_file);
}
#endif
if (!(hc->request = http_parse_request(hc, &hc->iqueue, reqlen)))
}
if (res == wb->len)
{
+#if HAVE_SYS_TIME_H
+ if (hc->http_server->record_file)
+ {
+ struct timeval tv;
+ int sz = wb->offset + wb->len;
+ gettimeofday(&tv, 0);
+ fprintf(hc->http_server->record_file, "w %lld %lld %lld %d\n",
+ (long long) tv.tv_sec, (long long) tv.tv_usec,
+ (long long) iochan_getfd(i), sz);
+ fwrite(wb->buf, 1, wb->offset + wb->len,
+ hc->http_server->record_file);
+ fputc('\n', hc->http_server->record_file);
+ fflush(hc->http_server->record_file);
+ }
+ #endif
hc->oqueue = hc->oqueue->next;
http_buf_destroy(hc->http_server, wb);
}
default:
yaz_log(YLOG_WARN, "Unexpected event on connection");
http_channel_destroy(hc->iochan);
+ break;
}
}