From 18316d7852132ed3a27b646fb3494d1a33ff77f7 Mon Sep 17 00:00:00 2001 From: Alex Hultman Date: Fri, 28 Sep 2018 14:24:00 +0200 Subject: [PATCH] Fix AsyncSocket buffering mistake --- src/AsyncSocket.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/AsyncSocket.h b/src/AsyncSocket.h index 07f4ebf..8b4db93 100644 --- a/src/AsyncSocket.h +++ b/src/AsyncSocket.h @@ -139,11 +139,11 @@ protected: /* Fall back to worst possible case (should be very rare for HTTP) */ /* At least we can reserve room for next chunk if we know it up front */ if (nextLength) { - asyncSocketData->buffer.reserve(asyncSocketData->buffer.length() + length + nextLength); + asyncSocketData->buffer.reserve(asyncSocketData->buffer.length() + length - written + nextLength); } /* Buffer this chunk */ - asyncSocketData->buffer.append(src, length); + asyncSocketData->buffer.append(src + written, length - written); } }