aboutsummaryrefslogtreecommitdiff
path: root/src/http_client_async.zig (follow)
AgeCommit message (Collapse)AuthorFilesLines
2023-10-09fix(AbortSignal/fetch) fix AbortSignal.timeout, fetch lock behavior and ↵Gravatar Ciro Spaciari 1-11/+8
fetch errors (#6390) * fix abort signal and fetch error * fix fetch error and lock behavior
2023-10-02Set `fetch` timeout to 5 minutes (#6217)Gravatar Jarred Sumner 1-17/+18
* Increase timeouts * Update uws.zig --------- Co-authored-by: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com>
2023-09-30Fix bug causing "Connection Refused" errors (#6206)Gravatar Jarred Sumner 1-10/+4
* Loop through the return values of getaddrinfo * Remove incorrect assertion * Remove extra check * Remove extra check * Update bsd.c * More consistent --------- Co-authored-by: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com>
2023-09-30Fix regressionGravatar Jarred Sumner 1-1/+1
2023-09-29Fix hang in `bun install` (#6192)Gravatar Jarred Sumner 1-15/+36
Co-authored-by: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com>
2023-09-29Fixes #6053 (#6162)Gravatar Jarred Sumner 1-3/+45
Fixes #6053 Co-authored-by: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com>
2023-09-26fix server end of stream, fix fetch not streaming without content-length or ↵Gravatar Ciro Spaciari 1-28/+63
chunked encoding, fix case when stream do not return a promise on pull (#6086)
2023-09-20In http client, use .toOwnedSlice() instead of potentially re-using the ↵Gravatar Jarred Sumner 1-4/+7
WTFString here
2023-09-20fix(fetch): fix redirect in relative path location. (#5781)Gravatar Ai Hoshino 1-14/+12
* fix(fetch): fix redirect in relative path location. * fix utf-8 encoding * use server.reload * check buf size * add RedirectURLTooLong test
2023-09-20Fix RedirectURLTooLong errors (#5786)Gravatar ggobbe 1-1/+1
The URL to download the manifest for Artifact Registry in Google is larger than 4092 bytes. cf. issue #4748
2023-09-19Align fetch() redirect behavior with spec (#5729)Gravatar Jarred Sumner 1-20/+41
Co-authored-by: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com>
2023-09-19Make bun install --verbose more verbose (#5726)Gravatar Jarred Sumner 1-4/+4
Co-authored-by: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com>
2023-09-16fix(fetch) handle 100 continue (#5496)Gravatar Ciro Spaciari 1-1/+9
* handle 100 continue * move comment * cleanup * fmt
2023-09-13avoid inserting extraneous"accept-encoding" header (#5057)Gravatar iidebyo 1-1/+1
* add no extraneous accept-encoding header test * ensure fetch honors no decompress opt * fix format on test/js/node/http/node-http.test.ts
2023-09-07fix(fetch) closeAndFail instead of close (#4537)Gravatar Ciro Spaciari 1-2/+2
* closeAndFail instead of close * use constant * add some protection * dont deinit --------- Co-authored-by: Dylan Conway <dylan.conway567@gmail.com> Co-authored-by: Jarred Sumner <jarred@jarredsumner.com>
2023-09-06feat(fetch) rejectUnauthorized and checkServerIdentity (#4514)Gravatar Ciro Spaciari 1-15/+285
* enable root certs on fetch * rebase * fix lookup * some fixes and improvements * fmt * more fixes * more fixes * check detached onHandshake * fix promise case * fix cert non-Native * add fetch tls tests * more one test
2023-09-05fix SSL proxy tunneling on fetch (#4510)Gravatar Ciro Spaciari 1-15/+40
2023-09-04fix zlib deflate on fetch (#4483)Gravatar Ciro Spaciari 1-2/+2
* fix zlib deflate on fetch * mention issue on test * more tests * oops
2023-09-04fix(HTMLRewriter) buffer response before transform (#4418)Gravatar Ciro Spaciari 1-1/+4
* html rewriter response buffering * pipe the data when marked as used * fix empty response * add some fetch tests * deinit parent stream * fix decompression * keep byte_reader alive * update builds * remove nonsense * was not nonsense after all * protect tmp ret value from GC, fix readable strong ref deinit/init * fmt * if we detach the stream we cannot update the fetch stream * detach checking source * more tests, progress with javascript and Direct sink * drop support for pure readable stream for now * more fixes --------- Co-authored-by: Jarred Sumner <jarred@jarredsumner.com>
2023-08-30fix(http/https) disable decompress on http/https client (#4399)Gravatar Ciro Spaciari 1-9/+15
* disable decompress on http/https module * make js again
2023-08-28make pending_response and metdata life cycle more clear and make fetch more ↵Gravatar Ciro Spaciari 1-88/+106
reliable (#4331) * make pending_response and metdata life cycle more clear * typo * WIP: memory investigation * check zlib and fix zlib * use state allocator for metadata * remove postBodyProcess * undo some test things * fix race condition * fix removing compressed header * some extra checks * remove arenas on zlib and comment repoter.assert because of toOwnedSliceZ --------- Co-authored-by: Jarred Sumner <jarred@jarredsumner.com>
2023-08-28just kernel32 things (#4354)Gravatar Jarred Sumner 1-1/+1
* just kernel32 things * more * Update linux_c.zig * Update windows_c.zig * Add workaround Workaround https://github.com/ziglang/zig/issues/16980 * Rename http.zig to bun_dev_http_server.zig * Rename usages * more * more * more * thanks tigerbeetle * Rename `JSC.Node.Syscall` -> `bun.sys` * more * woops * more! * hmm * it says there are only 37 errors, but that's not true * populate argv * it says 32 errors! * 24 errors * fix regular build * 12 left! * Still 12 left! * more * 2 errors left... * 1 more error * Add link to Tigerbeetle * Fix the remainign error * Fix test timeout * Update syscall.zig --------- Co-authored-by: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com>
2023-08-24Report extra memory more (#4289)Gravatar Jarred Sumner 1-5/+5
* Report memory allocated in fetch * Memory size reporting to `Headers` * Fixup memory reporting allocator * Make these tests do more * cleanup some of this --------- Co-authored-by: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com>
2023-08-23Bunch of streams fixes (#4251)Gravatar Jarred Sumner 1-91/+138
* Update WebKit * Don't do async hooks things when async hooks are not enabled * Smarter scheduling of event loop tasks with the http server * less exciting approach * Bump WebKit * Another approach * Fix body-stream tests * Fixes #1886 * Fix UAF in fetch body streaming * Missing from commit * Fix leak * Fix the other leak * Fix test * Fix crash * missing duperef * Make this code clearer * Ignore empty chunks * Fixes #3969 * Delete flaky test * Update bun-linux-build.yml * Fix memory issue * fix result body, and .done status before the last callback, dont touch headers after sent once * refactor HTTPClientResult * less flasky corrupted test * oops * fix mutex invalid state * fix onProgressUpdate deinit/unlock * fix onProgressUpdate deinit/unlock * oops * remove verbose * fix posible null use * avoid http null * metadata can still be used onReject after toResponse * dont leak task.http * fix flask tests * less flask close tests --------- Co-authored-by: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com> Co-authored-by: cirospaciari <ciro.spaciari@gmail.com>
2023-08-21fetch(stream) add stream support for compressed and uncompressed data (#4127)Gravatar Ciro Spaciari 1-97/+276
* streams non compressed data in 64kb chunks (at least) * fmt * wip remove pause * fix default streaming and buffering * fix atomic lags * fix size * make chunked encoding work again (WIP streaming chunked) * WIP: chunked encoding streaming * fix end of streamings * working streaming + compression * add fixes + tests * fmt + fix proxy * fix oopsies * codegen after merge * fmt + fixes * more fixes * more fixes and logs * avoid double free * check empty before pop * check empty on pop * fix copy to real when complete * remove unnecessary logs * better has_schedule_callback swap, body locked size helper, remove isEmpty from unbounded_queue pop * fix response ref, fix body_size * add deflate support, fix error throw, add more tests * codegen after merge * remove logs, add connection close test * fix macOS build * fix redirect error option * make body_size more clear * support new Reponse(response) * toString DOMWrapper objects properly instead of supporting response in Response constructor * ignore headers with no name, add more tests * oops * handle transform with fetch * add gz image stream test * remove duplicate test * fix missing chunk on macOS under pressure * oops include all OS * some fixes * compare buffers instead of sizes * refactor err.err and protect it
2023-08-02clean declare structs (#3929)Gravatar Ciro Spaciari 1-3/+1
2023-07-26[fetch] Ignore invalid Content-Encoding header (#3834)Gravatar Jarred Sumner 1-2/+0
Fixes #3802 Co-authored-by: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com>
2023-07-18zig upgrade (#3667)Gravatar Dylan Conway 1-32/+32
* upgrade * more fixes * Bump Zig --------- Co-authored-by: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com>
2023-07-02set content-length 0 in some cases (#3503)Gravatar dave caruso 1-2/+1
2023-06-21upgrade zig to `v0.11.0-dev.3737+9eb008717` (#3374)Gravatar Dylan Conway 1-20/+21
* progress * finish `@memset/@memcpy` update * Update build.zig * change `@enumToInt` to `@intFromEnum` and friends * update zig versions * it was 1 * add link to issue * add `compileError` reminder * fix merge * format * upgrade to llvm 16 * Revert "upgrade to llvm 16" This reverts commit cc930ceb1c5b4db9614a7638596948f704544ab8. --------- Co-authored-by: Jarred Sumner <jarred@jarredsumner.com> Co-authored-by: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com>
2023-05-31Make uploading files with `fetch()`fast (#3125)Gravatar Jarred Sumner 1-22/+152
* Make file uploads fast * Add benchmark * Update README.md * defaults * print * prettier * smaller * fix(path) fix parse behavior (#3134) * Add macro docs (#3139) * Add macro doc * Updates * Tweaks * Update doc * Update macro serialization doc * Update macro doc * `--no-macros` flag, disable macros in node_modules * invert base/filename internally (#3141) * always false * Fix broken test * Add a test sendfile() test with large file --------- Co-authored-by: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com> Co-authored-by: Ciro Spaciari <ciro.spaciari@gmail.com> Co-authored-by: Colin McDonnell <colinmcd94@gmail.com>
2023-05-21[internal] Add more debug logs for uwsGravatar Jarred Sumner 1-2/+2
2023-05-21[internal] Make AbortSIgnal usage slightly saferGravatar Jarred Sumner 1-1/+1
2023-05-12fix proxy status return (#2860)Gravatar Ciro Spaciari 1-5/+5
2023-05-11fix redirect: \'manual\' and setTimeout on node:http request (#2848)Gravatar Ciro Spaciari 1-4/+3
2023-05-10feat(fetch) add redirect: 'error' support (#2845)Gravatar Ciro Spaciari 1-97/+114
* add redirect: 'error' support * fix typo * fix typo * refactor FetchRedirect enum * fix FetchRedirect * updated
2023-04-19Fix broken autocompleteGravatar Jarred Sumner 1-1/+1
2023-04-14Upgrade Zig (#2656)Gravatar Jarred Sumner 1-1/+2
* Upgrade Zig * Don't add `d` files in github actions * Revert "Don't add `d` files in github actions" This reverts commit 446e2dd6743da08ec4136233fdc9179dbbf58fca. --------- Co-authored-by: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com>
2023-04-07feat(tls.Server) basic support (cert, key, rejectUnauthorized, requestCert, ↵Gravatar Ciro Spaciari 1-7/+9
ca) #2412 (#2552) * cherry picked * add StringOrBuffer parameter * Format and adds types * update uws * fix tests * more types * fix typing * add timeouts, clean some stuff * move tests to describe * fixes SSL hostname when Host is provided * cleanup on tests * change 127.0.0.1 to 0.0.0.0 * try another listening parameter * test timings and update uws * remove unnecessary comment * move listening event around * always await Bun.connect * do not fail if the tests already passed when using Bun.connect * regenerate classes * undo generated classes * generate classes * fix merge --------- Co-authored-by: cirospaciari <cirospaciari@MiWiFi-RA82-srv.cirospaciari>
2023-04-05fix(fetch.proxy) fix proxy authentication (#2554)Gravatar Ciro Spaciari 1-12/+100
* fix proxy authentication * add auth tests * remove unused
2023-04-02[install] reduce parallel HTTP requests under heavy load (#2536)Gravatar Alex Lam S.L 1-13/+41
* [install] reduce parallel HTTP requests under heavy load * make `max_simultaneous_requests` atomic
2023-03-05[install] fix connection error detection (#2307)Gravatar Alex Lam S.L 1-1/+2
2023-03-02Add a zig fmt action (#2277)Gravatar Jarred Sumner 1-7/+7
* Add a zig fmt action * add failing file * Setup prettier better * Update prettier-fmt.yml * Fail on error * Update prettier-fmt.yml * boop * boop2 * tar.gz * Update zig-fmt.yml * Update zig-fmt.yml * Update zig-fmt.yml * Update zig-fmt.yml * Update zig-fmt.yml * boop * Update prettier-fmt.yml * tag * newlines * multiline * fixup * Update zig-fmt.yml * update it * fixup * both * w * Update prettier-fmt.yml * prettier all the things * Update package.json * zig fmt * ❌ ✅ * bump * . * quotes * fix prettier ignore * once more * Update prettier-fmt.yml * Update fallback.ts * consistentcy --------- Co-authored-by: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com>
2023-02-27fix(fetch.signal) capture socket and shutdown on abort signal (#2143)Gravatar Ciro Spaciari 1-40/+67
* capture socket and shutdown on abort signal * queue shutdown tasks * little cleanup * change shutdown strategy * use fetchSwapRemove on fetch shutdown * use fetchSwapRemove on fetch shutdown * fix formatting, remove unused property
2023-02-24fix `compiler_rt` linking failure on `x86_64` (#2163)Gravatar Alex Lam S.L 1-1/+1
- minor code tweaks
2023-02-24prefer `bun.copy()` over `std.mem.copy()` (#2152)Gravatar Alex Lam S.L 1-39/+43
2023-02-23Upgrade Zig (#2151)Gravatar Dylan Conway 1-9/+9
* fixup * Upgrade Zig * Remove bad assertion * strings * bump * mode -> optimize * optimize * Linux build * Update bindgen.zig
2023-02-22Fix flaky request.signal implementationGravatar Jarred Sumner 1-125/+73
2023-02-22feat(Request.signal) Initial support for signal in Request + fetch and ↵Gravatar Ciro Spaciari 1-51/+89
Request + Bun.serve (#2097) * add fetch abort signal * get aborted (still segfaults) * bidings.zig u0 error * still GC/memory error * fix start crash * fix AbortSignal fromJS * change fromJS to obj.as * addAbortSignalEventListenner * handle abort types, and add tests * fix tests * add custom reason test * merge 2 substring methods, use MAKE_STATIC_STRING_IMPL * fix create AbortError and TimeoutError, move globalThis and exception creation to main thread * fix tests and rebuild headers * no need to check with substring reason is already an exception * no need to check with substring reason is already an exception * fix dumb error inverting conditions for check reason * fix custom reason behavior * Request signal * remove package-lock.json * Remove JSC.Strong from Request signal * fix globals for fetch abort signal * more tests, clone signal crashs * fix AbortSignal.toJS * fix toJS bidings for AbortSignal * add streaming tests * fix abortion before connecting * fix tests and segfault * add fetch testing abort after finish * fix signal handler cleanup * support signal event Bun.serve * pull tests (failing) * remove unsupported test * formating * fix server Request.signal, fix cleanNativeBindings * add direct tests * more pull tests * fix stream tests * fix fetch, pending onAborted fix in HTTPServerWritable --------- Co-authored-by: Jarred Sumner <jarred@jarredsumner.com>
2023-02-15feat(fetch) AbortSignal (#2019)Gravatar Ciro Spaciari 1-40/+116
* add fetch abort signal * get aborted (still segfaults) * bidings.zig u0 error * still GC/memory error * fix start crash * fix AbortSignal fromJS * change fromJS to obj.as * addAbortSignalEventListenner * handle abort types, and add tests * fix tests * add custom reason test * merge 2 substring methods, use MAKE_STATIC_STRING_IMPL * fix create AbortError and TimeoutError, move globalThis and exception creation to main thread * fix tests and rebuild headers * no need to check with substring reason is already an exception * no need to check with substring reason is already an exception * fix dumb error inverting conditions for check reason * fix custom reason behavior