[fetch] Fix sporadic data corruption bug in HTTP client and add fast path

- This removes memory pooling from the HTTP client which sometimes caused invalid memory to be written to the response body.
- This adds a fast path for small HTTP/HTTPS responses that makes it a single memory allocation for the response body, instead of copying & allocating a temporary buffer

cc @Electroid
This commit is contained in:
Jarred Sumner
2022-11-19 22:34:57 -08:00
parent e024116b77
commit b230e7a73a
6 changed files with 167 additions and 133 deletions

View File

@@ -436,10 +436,10 @@ pub const VirtualMachine = struct {
modules: ModuleLoader.AsyncModule.Queue = .{},
aggressive_garbage_collection: GCLevel = GCLevel.none,
pub const GCLevel = enum {
none,
mild,
aggressive,
pub const GCLevel = enum(u3) {
none = 0,
mild = 1,
aggressive = 2,
};
pub threadlocal var is_main_thread_vm: bool = false;