projects
/
citadel.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
cf07924
)
StrBufChunkSipLine(): compact buffer if we have a remaining snippet at the end of...
author
Wilfried Goesgens
<dothebart@citadel.org>
Wed, 31 Aug 2011 08:01:45 +0000
(08:01 +0000)
committer
Wilfried Goesgens
<dothebart@citadel.org>
Wed, 31 Aug 2011 08:01:45 +0000
(08:01 +0000)
libcitadel/lib/stringbuf.c
patch
|
blob
|
history
diff --git
a/libcitadel/lib/stringbuf.c
b/libcitadel/lib/stringbuf.c
index 2ee3a2534aca8384985482867e7a739918612ab9..044cecf0a65037c3f7d2fb9784c8c41913b4ef2e 100644
(file)
--- a/
libcitadel/lib/stringbuf.c
+++ b/
libcitadel/lib/stringbuf.c
@@
-3705,7
+3705,18
@@
eReadState StrBufChunkSipLine(StrBuf *LineBuf, IOBuffer *FB)
optr --;
if ((*(ptr - 1) != '\r') && (*(ptr - 1) != '\n')) {
LineBuf->BufUsed = optr - LineBuf->buf;
optr --;
if ((*(ptr - 1) != '\r') && (*(ptr - 1) != '\n')) {
LineBuf->BufUsed = optr - LineBuf->buf;
- *optr = '\0';
+ *optr = '\0';
+ if ((FB->ReadWritePointer != NULL) &&
+ (FB->ReadWritePointer != FB->Buf->buf))
+ {
+ /* Ok, the client application read all the data
+ it was interested in so far. Since there is more to read,
+ we now shrink the buffer, and move the rest over.
+ */
+ StrBufCutLeft(FB->Buf,
+ FB->ReadWritePointer - FB->Buf->buf);
+ FB->ReadWritePointer = NULL;
+ }
return eMustReadMore;
}
}
return eMustReadMore;
}
}