(self, state, key, value, validate, lenient)
| 565 | } |
| 566 | |
| 567 | function processHeader(self, state, key, value, validate, lenient) { |
| 568 | if (validate) |
| 569 | validateHeaderName(key); |
| 570 | |
| 571 | // If key is content-disposition and there is content-length |
| 572 | // encode the value in latin1 |
| 573 | // https://www.rfc-editor.org/rfc/rfc6266#section-4.3 |
| 574 | // Refs: https://github.com/nodejs/node/pull/46528 |
| 575 | if (isContentDispositionField(key) && self._contentLength) { |
| 576 | // The value could be an array here |
| 577 | if (ArrayIsArray(value)) { |
| 578 | for (let i = 0; i < value.length; i++) { |
| 579 | value[i] = Buffer.from(value[i], 'latin1'); |
| 580 | } |
| 581 | } else { |
| 582 | value = Buffer.from(value, 'latin1'); |
| 583 | } |
| 584 | } |
| 585 | |
| 586 | if (ArrayIsArray(value)) { |
| 587 | if ( |
| 588 | (value.length < 2 || !isCookieField(key)) && |
| 589 | (!self[kUniqueHeaders] || !self[kUniqueHeaders].has(key.toLowerCase())) |
| 590 | ) { |
| 591 | // Retain for(;;) loop for performance reasons |
| 592 | // Refs: https://github.com/nodejs/node/pull/30958 |
| 593 | for (let i = 0; i < value.length; i++) |
| 594 | storeHeader(self, state, key, value[i], validate, lenient); |
| 595 | return; |
| 596 | } |
| 597 | value = value.join('; '); |
| 598 | } |
| 599 | storeHeader(self, state, key, value, validate, lenient); |
| 600 | } |
| 601 | |
| 602 | function storeHeader(self, state, key, value, validate, lenient) { |
| 603 | if (validate) |
no test coverage detected
searching dependent graphs…