X-Git-Url: http://git.indexdata.com/?p=yaz-moved-to-github.git;a=blobdiff_plain;f=src%2Fhttp.c;fp=src%2Fhttp.c;h=96445ed99828bffafc619ec544b8d4af6ad2119e;hp=642c3ada69ca69187269b920a142146611028785;hb=e5c4e6d4c245ae26a73953cbc5261929f55c103f;hpb=6ee0d7c0404834a0a59547c3bd7e2686f838ce37 diff --git a/src/http.c b/src/http.c index 642c3ad..96445ed 100644 --- a/src/http.c +++ b/src/http.c @@ -547,23 +547,24 @@ int yaz_decode_http_request(ODR o, Z_HTTP_Request **hr_p) static void dump_http_package(ODR o, const char *buf, size_t len) { - int i; + int i, limit = 8192; for (i = 0; ; i++) { if (i == len) { + o->op->stream_write(o, o->op->print, ODR_VISIBLESTRING, buf, i); odr_printf(o, "%.*s\n", i, buf); break; } - else if (i > 8192) + else if (i >= limit) { - odr_printf(o, "%.*s\n", i, buf); - odr_printf(o, "(truncated\n", (long) len); + o->op->stream_write(o, o->op->print, ODR_VISIBLESTRING, buf, i); + odr_printf(o, "(truncated from %ld to %d\n", (long) len, i); break; } else if (buf[i] == 0) { - odr_printf(o, "%.*s\n", i, buf); + o->op->stream_write(o, o->op->print, ODR_VISIBLESTRING, buf, i); odr_printf(o, "(binary data)\n", (long) len); break; }