(header, removeContent, unknownOrigin, stripHeaders, stripHeadersOnCrossOrigin)
| 159 | |
| 160 | // https://tools.ietf.org/html/rfc7231#section-6.4.4 |
| 161 | function shouldRemoveHeader (header, removeContent, unknownOrigin, stripHeaders, stripHeadersOnCrossOrigin) { |
| 162 | const name = util.headerNameToString(header) |
| 163 | if (name === 'host') { |
| 164 | return true |
| 165 | } |
| 166 | if (stripHeaders?.has(name) || (unknownOrigin && stripHeadersOnCrossOrigin?.has(name))) { |
| 167 | return true |
| 168 | } |
| 169 | if (removeContent && name.startsWith('content-')) { |
| 170 | return true |
| 171 | } |
| 172 | if (unknownOrigin) { |
| 173 | return name === 'authorization' || name === 'cookie' || name === 'proxy-authorization' |
| 174 | } |
| 175 | return false |
| 176 | } |
| 177 | |
| 178 | // https://tools.ietf.org/html/rfc7231#section-6.4 |
| 179 | function normalizeStripHeaders (headers, optionName) { |
no test coverage detected