From d84e4c3cd444d04aee7beeadb5bb0ae061ee24c9 Mon Sep 17 00:00:00 2001 From: Adam Dickmeiss Date: Tue, 12 May 2015 15:26:27 +0200 Subject: [PATCH] ZOOM C: deal with excess bytes HTTPS case YAZ-833 --- src/zoom-c.c | 32 ++++++++++++++++++-------------- 1 file changed, 18 insertions(+), 14 deletions(-) diff --git a/src/zoom-c.c b/src/zoom-c.c index baf66f0..53cbb10 100644 --- a/src/zoom-c.c +++ b/src/zoom-c.c @@ -1679,22 +1679,26 @@ static int do_read(ZOOM_connection c) if (!z_GDU(c->odr_in, &gdu, 0, 0)) { - int x; - int err = odr_geterrorx(c->odr_in, &x); - char msg[100]; - const char *element = odr_getelement(c->odr_in); - yaz_snprintf(msg, sizeof(msg), - "ODR code %d:%d element=%s offset=%d", - err, x, element ? element : "", - odr_offset(c->odr_in)); - ZOOM_set_error(c, ZOOM_ERROR_DECODE, msg); - if (c->log_api) + /* even on failures we try to re-connect (HTTP) */ + if (!ZOOM_test_reconnect(c)) { - FILE *ber_file = yaz_log_file(); - if (ber_file) - odr_dumpBER(ber_file, c->buf_in, r); + int x; + int err = odr_geterrorx(c->odr_in, &x); + char msg[100]; + const char *element = odr_getelement(c->odr_in); + yaz_snprintf(msg, sizeof(msg), + "ODR code %d:%d element=%s offset=%d", + err, x, element ? element : "", + odr_offset(c->odr_in)); + ZOOM_set_error(c, ZOOM_ERROR_DECODE, msg); + if (c->log_api) + { + FILE *ber_file = yaz_log_file(); + if (ber_file) + odr_dumpBER(ber_file, c->buf_in, r); + } + ZOOM_connection_close(c); } - ZOOM_connection_close(c); } else { -- 1.7.10.4