aboutsummaryrefslogtreecommitdiff
path: root/src/bun.js/webcore (follow)
AgeCommit message (Collapse)AuthorFilesLines
2023-04-25Log HTTP requests and responses by default when log level is debug or verboseGravatar Jarred Sumner 1-2/+4
2023-04-21`Bun.build()` partial implementationGravatar Jarred Sumner 1-0/+8
2023-04-19Fix broken autocompleteGravatar Jarred Sumner 6-65/+65
2023-04-14Upgrade Zig (#2656)Gravatar Jarred Sumner 1-3/+5
* 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-09Remove usages of `void{}` in favor of `{}`Gravatar Jarred Sumner 2-12/+12
See https://github.com/ziglang/zig/issues/15213
2023-04-07feat(tls.Server) basic support (cert, key, rejectUnauthorized, requestCert, ↵Gravatar Ciro Spaciari 1-2/+56
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-06Add last modify field "mtime" for FileBlob (#1431) (#2491)Gravatar Zhongwei Yao 2-33/+89
* Add lastModified field for FileBlob (#1431) lastModified value is epoch timestamp in millisecond unit. * update according to review comment.
2023-04-05fix(fetch.proxy) fix proxy authentication (#2554)Gravatar Ciro Spaciari 1-2/+2
* fix proxy authentication * add auth tests * remove unused
2023-03-22A couple bug fixes (#2458)Gravatar Dylan Conway 1-17/+7
* fix valid status code range * update path * highwatermark option * throw DOMException * remove extra transpiler output * more transpiler tests * comment * get index not quickly * replace with `getDirectIndex` * update abort test * throw out of range status code * promisify test fix * move stdio test instance files * working crypto tests * allow duplicate set-cookie headers * different formatting * revert, fix will be in different pr * it is called * use min buffer size * fix url tests * null origin for other protocols * remove overload * add very large file test * await * coerce to int64 * 64 * no cast * add todo blob url tests * use `tryConvertToInt52`
2023-03-19remove unnecessary check (#2432)Gravatar Ciro Spaciari 1-3/+0
2023-03-19add some extra abort checks into streams (#2430)Gravatar Ciro Spaciari 1-3/+9
* add some checks to avoid UAF * avoid multiple calls to finalize if endFromJS is called more than once * fix no-op comment * mark as requested_end on abort * remove requested_end from abort
2023-03-19Several bug fixes (#2427)Gravatar Jarred Sumner 3-81/+253
* Fix test * Fix segfault when unexpected type is passed in `expect().toThrow` * Fix issues with request constructor * Don't bother cloning headers when its empty * woops * more tests * fix incorrect test * Make the fetch error messages better * Update response.zig * Fix test that failed on macOS * Fix test * Remove extra hash table lookups * Support running dummy registry directly cc @alexlamsl * Update test * Update test * fixup * Workaround crash in test runner * Fixup test * Fixup test * Update os.test.js --------- Co-authored-by: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com>
2023-03-18[fetch] Make the default body value `null` when unspecifiedGravatar Jarred Sumner 2-8/+12
This is better aligned with the fetch spec
2023-03-18Fix several bugs (#2418)Gravatar Dylan Conway 2-4/+24
* utf16 codepoint with replacement character * Fix test failure with `TextEncoder("ascii')` * Add missing type * Fix Response.prototype.bodyUsed and Request.prototype.bodyUsed * Fix bug with scrypt error not clearing * Update server.zig * oopsie
2023-03-17Fix various fetch/response/request tests (#2416)Gravatar Dylan Conway 5-76/+77
* fix most fetch tests, skip a few * fastGet, toValueGC, and invalid init * bigint unreachable, range error, log process as process * remove extra fetch_headers * remove js_type parameter, check isObject() * throw invalid mime type error, use enum literal * switch back to promise rejection * RangeError pascal case
2023-03-14Implement `toMatchSnapshot()` (#2294)Gravatar Dylan Conway 4-8/+8
* buggy snapshot * error output for failed snapshot * missing first * hints * open dir once, better cleanup * update flag * truncate on update * object and class snapshot formatting * array formatting * no function name, single item is empty array * string objects, maps, sets, promise * avoid using invalid memory * handle number objects * handle extending `Number` * boolean objects * snapshot tests and test updates * snapshot format for buffers * safer snapshot parsing * property matchers setup * strings and tests * generate classes with empty prototype * optional `propertyMatchers` parameter * new test folder structure * strings.eqlLong * globalObject.throwPretty() and expect.any tests * add updateSnapshot flag to help * move snapshot format out of `printErrorlikeObject` * empty object snapshot format * separate typed array, remove trailing comma * use `isCell`, object trailing commas * handle unicode * todo for primitive constructors * switch to `JSC.Node.Syscall.open` and `JSC.Maybe` * use js parser for snapshot files * deinit ast, log parse error * copy/paste most of `exports.ZigConsoleClient` * remove snapshot option * remove ordered properties option * remove snapshot format option from `exports.zig` * remove extra newlines * change mode * update test runner output * escape backticks faster * `bunx jest` in temp dir * remove buffered writer * add `toMatchSnapshot` to types * cleanup, switch to `pread` * cli `--update` flag * `--update-snapshots` * remove string object format
2023-03-08More spec compliant `Blob.prototype.type` (#2340)Gravatar Jarred Sumner 2-46/+110
* Make `Blob.prototype. type` more spec compliant * Add a few more checks for isNumber() * Fix `make headers` * Safer JSValue.isString() * More tests for blob.slice * Make `Blob.prototype.type` more spec compliant * Add isASCII check * Fix types * Fix failing type test * Update blob.zig * Update blob.zig * Fix .eql check on empty values --------- Co-authored-by: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com>
2023-03-07improve `Buffer` compatibility with Node.js (#2341)Gravatar Alex Lam S.L 4-545/+57
* improve `Buffer` compatibility with Node.js * use `memmove()` allow `encoding` to be `undefined`
2023-03-05fix missing `Blob` error messages on Linux (#2315)Gravatar Alex Lam S.L 1-5/+5
2023-03-02put AbortSignal in WebCore namespace (#2267)Gravatar Ciro Spaciari 2-8/+8
2023-03-02only free sink after promises solves (#2268)Gravatar Ciro Spaciari 1-1/+1
2023-03-01fix bun server segfault with abortsignal (#2261)Gravatar Ciro Spaciari 1-1/+1
* removed redundant tests, fixed server segfault * fix onRejectStream, safer unassign signal * fix abort Bun.serve signal.addEventListener on async * move ctx.signal null check up * keep original behavior of streams onAborted
2023-03-01fix deinit behavior when connection is aborted using ResponseStream and ↵Gravatar Ciro Spaciari 1-1/+1
abort event behavior (#2252) * fix deinit behavior when connection is aborted using ResponseStream * fix abort handling on stream, and get better tests * avoid segfault by trying to deinit 2x when aborted * make tests more reliable * more reliable onResolveStream after aborted * add test case for not firing the abort signal
2023-03-01fix Bun.file.arrayBuffer() segmentation fault on empty file #2248 (#2249)Gravatar Ciro Spaciari 1-7/+15
* fix Bun.file.arrayBuffer() segmentation fault on empty file #2248 * cleanner this.iotask check
2023-02-28Make response.body `null` only when user explicitly passes null/undefinedGravatar Jarred Sumner 3-2/+16
2023-02-28Add explicit Null tag to BodyGravatar Jarred Sumner 1-11/+11
This reverts commit e538bb31ad7a2c4b4ce2b1f7d6b18a3140939950.
2023-02-27fix(fetch.signal) capture socket and shutdown on abort signal (#2143)Gravatar Ciro Spaciari 1-18/+13
* 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-24formattingGravatar Dylan Conway 1-4/+1
2023-02-24fix(body) Make Request/Reponse empty body to be null (#2156)Gravatar Ciro Spaciari 1-2/+10
* make empty nullable * revert mistake change
2023-02-24prefer `bun.copy()` over `std.mem.copy()` (#2152)Gravatar Alex Lam S.L 1-22/+10
2023-02-23Upgrade Zig (#2151)Gravatar Dylan Conway 7-26/+46
* 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 2-54/+108
2023-02-22Fix missing ref() in lazily created signalGravatar Jarred Sumner 1-12/+11
2023-02-22feat(Request.signal) Initial support for signal in Request + fetch and ↵Gravatar Ciro Spaciari 3-1/+51
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-17Fix #1602 (#2066)Gravatar Justin Whear 3-22/+27
* initial test case * fix segfault from JSObjectMakeDeferredPromise * pass exceptions through from FetchHeader.createFromJS * not resolved, but getting close * implement review suggestions * fix exception check, tests * Change how header filtering is accomplished Previously the FetchHeaders implementation relied on converting names and values to IDLByteString to catch non-ASCII data, though not always reliably. This resulted in message-less TypeErrors when headers contained invalid characters. This commit shifts everything to IDLDOMString for the conversion and relies on the actual error checking in FetchHeaders.canWriteHeader, resulting in nicer error messages. To ensure that all headers are written as ASCII/UTF8 rather than UTF16, the copyTo bindings function checks the encoding and converts if necessary. * wrapping up FetchHeader fixes * since utf8 allocates only do so when needed * Update src/bun.js/bindings/bindings.cpp Co-authored-by: Jarred Sumner <jarred@jarredsumner.com> * WebCore__FetchHeaders__has should return on exception path * strip out log calls from test --------- Co-authored-by: Jarred Sumner <jarred@jarredsumner.com>
2023-02-15feat(fetch) AbortSignal (#2019)Gravatar Ciro Spaciari 1-3/+42
* 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
2023-02-14Reject with error when invalid fetch() body (#2047)Gravatar Eric Zhang 1-11/+18
* Reject with error when invalid fetch() body Resolves #2014 * Make sure the test actually throws an exception * Update fetch error paths to return TypeErrors
2023-02-13Add pretty printer for FormDataGravatar Jarred Sumner 1-0/+1
2023-02-13Fixes https://github.com/oven-sh/bun/issues/1456Gravatar Jarred Sumner 4-0/+67
2023-02-13Implement `FormData` (#2051)Gravatar Jarred Sumner 5-32/+360
* Backport std::forward change * Implement `FormData` * Fix io_darwin headers issue * Implement `Blob` support in FormData * Add test for file upload * Fix bug with Blob not reading Content-Type * Finish implementing FormData * Add FormData to types --------- Co-authored-by: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com>
2023-02-09[streams] fix byte accounting (#2029)Gravatar Alex Lam S.L 1-30/+26
fixes #1939
2023-02-06Mark some things as not configurableGravatar Jarred Sumner 2-0/+4
2023-02-05speed it up a little moreGravatar Jarred Sumner 1-46/+26
2023-02-05Faster Buffer.toString("ascii")Gravatar Jarred Sumner 1-8/+35
2023-02-03anotherGravatar Dylan Conway 1-1/+1
2023-02-03integers overflowingGravatar Dylan Conway 1-1/+1
2023-02-01fix text encoding for utf8 (#1967)Gravatar Dylan Conway 1-2/+12
* use character * replacement character * also test encoding decoded points * increase length by 1
2023-01-30remove log that appears in productionGravatar Jarred Sumner 1-5/+1
2023-01-30fix utf16le fill and utf8 partial write of utf16 (#1943)Gravatar Ciro Spaciari 1-17/+29
2023-01-29[buffer] More passing Node.js testsGravatar Jarred Sumner 1-4/+5