projects
/
citadel.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
3599604
)
* fix some rare oom situation.
author
Wilfried Goesgens
<dothebart@citadel.org>
Fri, 22 Apr 2011 22:50:09 +0000
(22:50 +0000)
committer
Wilfried Goesgens
<dothebart@citadel.org>
Sun, 4 Sep 2011 20:13:13 +0000
(20:13 +0000)
webcit/tcp_sockets.c
patch
|
blob
|
history
diff --git
a/webcit/tcp_sockets.c
b/webcit/tcp_sockets.c
index 27fc0a92adb3b861d90f90503013b968e260285d..1adcafc32dcbc1319d5e13e2c072abb962158417 100644
(file)
--- a/
webcit/tcp_sockets.c
+++ b/
webcit/tcp_sockets.c
@@
-651,19
+651,23
@@
int client_read_to(ParsedHttpHdrs *Hdr, StrBuf *Target, int bytes, int timeout)
#ifdef HAVE_OPENSSL
if (is_https) {
#ifdef HAVE_OPENSSL
if (is_https) {
- long bufremain;
+ long bufremain
= 0
;
long baselen;
baselen = StrLength(Target);
if (Hdr->Pos == NULL)
Hdr->Pos = ChrPtr(Hdr->ReadBuf);
long baselen;
baselen = StrLength(Target);
if (Hdr->Pos == NULL)
Hdr->Pos = ChrPtr(Hdr->ReadBuf);
- bufremain = StrLength(Hdr->ReadBuf) - (Hdr->Pos - ChrPtr(Hdr->ReadBuf));
- if (bytes < bufremain)
- bufremain = bytes;
- StrBufAppendBufPlain(Target, Hdr->Pos, bufremain, 0);
- StrBufCutLeft(Hdr->ReadBuf, bufremain);
+ if (StrLength(Hdr->ReadBuf) > 0)
+ {
+ bufremain = StrLength(Hdr->ReadBuf) - (Hdr->Pos - ChrPtr(Hdr->ReadBuf));
+
+ if (bytes < bufremain)
+ bufremain = bytes;
+ StrBufAppendBufPlain(Target, Hdr->Pos, bufremain, 0);
+ StrBufCutLeft(Hdr->ReadBuf, bufremain);
+ }
if (bytes > bufremain)
{
if (bytes > bufremain)
{