diff options
author | Marcos Casagrande <marcoscvp90@gmail.com> | 2022-10-10 18:06:50 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-10-10 12:06:50 -0400 |
commit | 0cd05d737729b4cfab1d5e22077b3b9ad4ed5e30 (patch) | |
tree | 79f22976a04f73a528fc60705148108de92ef487 /ext/fetch/20_headers.js | |
parent | 70ad6717dfd1af57693e48e99a2f2e05f05c14eb (diff) |
fix(ext/fetch): fix illegal header regex (#16236)
This PR fixes invalid header parsing which is flaky because `g` flag is
being used in the regex, which keeps track of `lastIndex`
```javascript
try {
new Headers([["x", "\u0000x"]]); // error
} catch(e) {}
new Headers([["x", "\u0000x"]]); // no error
```
This issue affects `Response` & `Request` constructors as well
Diffstat (limited to 'ext/fetch/20_headers.js')
-rw-r--r-- | ext/fetch/20_headers.js | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/ext/fetch/20_headers.js b/ext/fetch/20_headers.js index 5243c5029..ae32aec11 100644 --- a/ext/fetch/20_headers.js +++ b/ext/fetch/20_headers.js @@ -88,7 +88,7 @@ // Regex matching illegal chars in a header value // deno-lint-ignore no-control-regex - const ILLEGAL_VALUE_CHARS = /[\x00\x0A\x0D]/g; + const ILLEGAL_VALUE_CHARS = /[\x00\x0A\x0D]/; /** * https://fetch.spec.whatwg.org/#concept-headers-append |