- Hdr->Pos = NULL;
- FlushStrBuf(Hdr->ReadBuf);
-
- while ((StrLength(Hdr->ReadBuf) + StrLength(Target) < bytes) &&
- (retval >= 0))
- retval = client_read_sslbuffer(Hdr->ReadBuf, timeout);
- if (retval >= 0) {
- StrBufAppendBuf(Target, Hdr->ReadBuf, 0); /* todo: Buf > bytes? */
+ StrBufCutLeft(Hdr->ReadBuf, bufremain);
+
+ if (bytes > bufremain)
+ {
+ while ((StrLength(Hdr->ReadBuf) + StrLength(Target) < bytes) &&
+ (retval >= 0))
+ retval = client_read_sslbuffer(Hdr->ReadBuf, timeout);
+ if (retval >= 0) {
+ StrBufAppendBuf(Target, Hdr->ReadBuf, 0); /* todo: Buf > bytes? */