Fix NativeHTTPRequest.loadText

Followup to these two commits:
02617a854d
ad3a632927

In the second commit, the buildBuffer call in HTTPRequest was
found to conflict with the way local requests are made, with the
bytes being set directly. So buildBuffer was moved to NativeHTTPRequest
instead. Upon promise completion, now, the value of bytes should always
be correct, and buildBuffer need not be called.

But buildBuffer is called again in NativeHTTPRequest.loadText. For local
requests, this will lead to the same problem that the second commit
fixed (presumably), and for network requests, this leads to the nulled
out buffer being accessed a second time, resulting in a crash.

So since the received value of bytes is already correct and buildBuffer
is harmful, the buildBuffer call is removed from loadText.
Both local and network requests are happy now!
This commit is contained in:
Justin Espedal
2022-07-22 23:04:34 +09:00
parent 862fe55b1c
commit 3644549574

View File

@@ -349,7 +349,6 @@ class NativeHTTPRequest
future.onComplete(function(bytes)
{
bytes = buildBuffer();
if (bytes == null)
{
promise.complete(null);