From: Wilfried Göesgens Date: Mon, 17 Aug 2009 20:37:12 +0000 (+0000) Subject: * if we decide whether we need to read another chunk, take into account if the buffer... X-Git-Tag: v7.86~925 X-Git-Url: https://code.citadel.org/?p=citadel.git;a=commitdiff_plain;h=cb699cff8d16425856a782bfc45bbd38fd19a628 * if we decide whether we need to read another chunk, take into account if the buffer wasn't empty on start. --- diff --git a/webcit/tcp_sockets.c b/webcit/tcp_sockets.c index 23fd9cf37..45c07ee79 100644 --- a/webcit/tcp_sockets.c +++ b/webcit/tcp_sockets.c @@ -523,6 +523,9 @@ int client_read_to(ParsedHttpHdrs *Hdr, StrBuf *Target, int bytes, int timeout) #ifdef HAVE_OPENSSL if (is_https) { long bufremain; + long baselen; + + baselen = StrLength(Target); if (Hdr->Pos == NULL) Hdr->Pos = ChrPtr(Hdr->ReadBuf); @@ -535,7 +538,7 @@ int client_read_to(ParsedHttpHdrs *Hdr, StrBuf *Target, int bytes, int timeout) if (bytes > bufremain) { - while ((StrLength(Hdr->ReadBuf) + StrLength(Target) < bytes) && + while ((StrLength(Hdr->ReadBuf) + StrLength(Target) < bytes + baselen) && (retval >= 0)) retval = client_read_sslbuffer(Hdr->ReadBuf, timeout); if (retval >= 0) {