mirror of
https://github.com/denoland/deno.git
synced 2024-12-22 15:24:46 -05:00
refactor(ext/fetch): const for max header cache size (#19496)
This commit is contained in:
parent
0c50c39c35
commit
43d5644048
1 changed files with 2 additions and 1 deletions
|
@ -105,6 +105,7 @@ function checkForInvalidValueChars(value) {
|
|||
}
|
||||
|
||||
const HEADER_NAME_CACHE = new SafeMap();
|
||||
const HEADER_NAME_CACHE_SIZE_BOUNDARY = 4096;
|
||||
function checkHeaderNameForHttpTokenCodePoint(name) {
|
||||
if (MapPrototypeHas(HEADER_NAME_CACHE, name)) {
|
||||
return MapPrototypeGet(HEADER_NAME_CACHE, name);
|
||||
|
@ -112,7 +113,7 @@ function checkHeaderNameForHttpTokenCodePoint(name) {
|
|||
|
||||
const valid = RegExpPrototypeExec(HTTP_TOKEN_CODE_POINT_RE, name) !== null;
|
||||
|
||||
if (HEADER_NAME_CACHE.size > 4096) {
|
||||
if (HEADER_NAME_CACHE.size > HEADER_NAME_CACHE_SIZE_BOUNDARY) {
|
||||
MapPrototypeClear(HEADER_NAME_CACHE);
|
||||
}
|
||||
MapPrototypeSet(HEADER_NAME_CACHE, name, valid);
|
||||
|
|
Loading…
Reference in a new issue