From e5b1d3f83c0c2dcc7f8aaa1bbdd1bb5942e85081 Mon Sep 17 00:00:00 2001 From: Alex Hultman Date: Fri, 21 Apr 2023 19:20:44 +0200 Subject: [PATCH] Fix another HTTP async cork bug --- src/HttpResponse.h | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/HttpResponse.h b/src/HttpResponse.h index 5955f6d..af8b4fc 100644 --- a/src/HttpResponse.h +++ b/src/HttpResponse.h @@ -502,6 +502,13 @@ public: * from here downwards. The corking is done with corkUnchecked() in upgrade. It steals cork. */ auto *newCorkedSocket = Super::corkedSocket(); + /* If nobody is corked, it means most probably that large amounts of data has + * been written and the cork buffer has already been sent off and uncorked. + * We are done here, if that is the case. */ + if (!newCorkedSocket) { + return this; + } + /* Timeout on uncork failure, since most writes will succeed while corked */ auto [written, failed] = static_cast(newCorkedSocket)->uncork();