aboutsummaryrefslogtreecommitdiff
path: root/src/bun.js/bindings/headers.h
diff options
context:
space:
mode:
authorGravatar Justin Whear <justin.whear@gmail.com> 2023-02-17 15:54:05 -0800
committerGravatar GitHub <noreply@github.com> 2023-02-17 15:54:05 -0800
commitfb313f210a51387fd77e0ddf4172ee3b52d0bdc9 (patch)
tree3cd3c3f53ea5be5e36f70ec77a1db75b3d171065 /src/bun.js/bindings/headers.h
parentc60d7db178b66a70adadb85a5054d524169397f1 (diff)
downloadbun-fb313f210a51387fd77e0ddf4172ee3b52d0bdc9.tar.gz
bun-fb313f210a51387fd77e0ddf4172ee3b52d0bdc9.tar.zst
bun-fb313f210a51387fd77e0ddf4172ee3b52d0bdc9.zip
Fix #1602 (#2066)
* 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>
Diffstat (limited to 'src/bun.js/bindings/headers.h')
-rw-r--r--src/bun.js/bindings/headers.h14
1 files changed, 7 insertions, 7 deletions
diff --git a/src/bun.js/bindings/headers.h b/src/bun.js/bindings/headers.h
index 59450ecf1..a81695ac1 100644
--- a/src/bun.js/bindings/headers.h
+++ b/src/bun.js/bindings/headers.h
@@ -1,5 +1,5 @@
// clang-format off
-//-- AUTOGENERATED FILE -- 1676470760
+//-- AUTOGENERATED FILE -- 1676656020
#pragma once
#include <stddef.h>
@@ -163,10 +163,10 @@ CPP_DECL WebCore__DOMFormData* WebCore__DOMFormData__fromJS(JSC__JSValue JSValue
#pragma mark - WebCore::FetchHeaders
-CPP_DECL void WebCore__FetchHeaders__append(WebCore__FetchHeaders* arg0, const ZigString* arg1, const ZigString* arg2);
+CPP_DECL void WebCore__FetchHeaders__append(WebCore__FetchHeaders* arg0, const ZigString* arg1, const ZigString* arg2, JSC__JSGlobalObject* arg3);
CPP_DECL WebCore__FetchHeaders* WebCore__FetchHeaders__cast_(JSC__JSValue JSValue0, JSC__VM* arg1);
CPP_DECL JSC__JSValue WebCore__FetchHeaders__clone(WebCore__FetchHeaders* arg0, JSC__JSGlobalObject* arg1);
-CPP_DECL WebCore__FetchHeaders* WebCore__FetchHeaders__cloneThis(WebCore__FetchHeaders* arg0);
+CPP_DECL WebCore__FetchHeaders* WebCore__FetchHeaders__cloneThis(WebCore__FetchHeaders* arg0, JSC__JSGlobalObject* arg1);
CPP_DECL void WebCore__FetchHeaders__copyTo(WebCore__FetchHeaders* arg0, StringPointer* arg1, StringPointer* arg2, unsigned char* arg3);
CPP_DECL void WebCore__FetchHeaders__count(WebCore__FetchHeaders* arg0, uint32_t* arg1, uint32_t* arg2);
CPP_DECL WebCore__FetchHeaders* WebCore__FetchHeaders__createEmpty();
@@ -178,10 +178,10 @@ CPP_DECL void WebCore__FetchHeaders__deref(WebCore__FetchHeaders* arg0);
CPP_DECL void WebCore__FetchHeaders__fastGet_(WebCore__FetchHeaders* arg0, unsigned char arg1, ZigString* arg2);
CPP_DECL bool WebCore__FetchHeaders__fastHas_(WebCore__FetchHeaders* arg0, unsigned char arg1);
CPP_DECL void WebCore__FetchHeaders__fastRemove_(WebCore__FetchHeaders* arg0, unsigned char arg1);
-CPP_DECL void WebCore__FetchHeaders__get_(WebCore__FetchHeaders* arg0, const ZigString* arg1, ZigString* arg2);
-CPP_DECL bool WebCore__FetchHeaders__has(WebCore__FetchHeaders* arg0, const ZigString* arg1);
-CPP_DECL void WebCore__FetchHeaders__put_(WebCore__FetchHeaders* arg0, const ZigString* arg1, const ZigString* arg2);
-CPP_DECL void WebCore__FetchHeaders__remove(WebCore__FetchHeaders* arg0, const ZigString* arg1);
+CPP_DECL void WebCore__FetchHeaders__get_(WebCore__FetchHeaders* arg0, const ZigString* arg1, ZigString* arg2, JSC__JSGlobalObject* arg3);
+CPP_DECL bool WebCore__FetchHeaders__has(WebCore__FetchHeaders* arg0, const ZigString* arg1, JSC__JSGlobalObject* arg2);
+CPP_DECL void WebCore__FetchHeaders__put_(WebCore__FetchHeaders* arg0, const ZigString* arg1, const ZigString* arg2, JSC__JSGlobalObject* arg3);
+CPP_DECL void WebCore__FetchHeaders__remove(WebCore__FetchHeaders* arg0, const ZigString* arg1, JSC__JSGlobalObject* arg2);
CPP_DECL JSC__JSValue WebCore__FetchHeaders__toJS(WebCore__FetchHeaders* arg0, JSC__JSGlobalObject* arg1);
CPP_DECL void WebCore__FetchHeaders__toUWSResponse(WebCore__FetchHeaders* arg0, bool arg1, void* arg2);
CPP_DECL JSC__JSValue SystemError__toErrorInstance(const SystemError* arg0, JSC__JSGlobalObject* arg1);