In the method HttpResponse::setCookie, buffer was created with 'new' and freed with 'free()', instead of 'delete'.
The underlying _buffer was not freed, as it was calling StringBuffer::clear() which doesn't free the _buffer.
Added const to the queue method... I added it in one of the classes and when I compiled I got many warnings, as the other classes also wanted to be const.
For reading from the socket, instead of reading in a temporary buffer and then appending the data to the string buffer, the data is read directly in the string buffer (avoiding the memcpy()).
First I call reserve with the read buffer size.
I have added a function in string-buffer.{h,c} and StringBuffer.h for increasing the length of the string.
I have added a method in StringBuffer.h for returning the end of the string as a non-const pointer.
Once the read in the socket has succeeded, I increase the length of the string buffer (advance the _current pointer).