(header, removeContent, unknownOrigin, stripHeaders, stripHeadersOnCrossOrigin)
| 176 | |
| 177 | // https://tools.ietf.org/html/rfc7231#section-6.4.4 |
| 178 | function shouldRemoveHeader (header, removeContent, unknownOrigin, stripHeaders, stripHeadersOnCrossOrigin) { |
| 179 | const name = util.headerNameToString(header) |
| 180 | if (name === 'host') { |
| 181 | return true |
| 182 | } |
| 183 | if (stripHeaders?.has(name) || (unknownOrigin && stripHeadersOnCrossOrigin?.has(name))) { |
| 184 | return true |
| 185 | } |
| 186 | if (removeContent && name.startsWith('content-')) { |
| 187 | return true |
| 188 | } |
| 189 | if (unknownOrigin) { |
| 190 | return name === 'authorization' || name === 'cookie' || name === 'proxy-authorization' |
| 191 | } |
| 192 | return false |
| 193 | } |
| 194 | |
| 195 | // https://tools.ietf.org/html/rfc7231#section-6.4 |
| 196 | function normalizeStripHeaders (headers, optionName) { |
no test coverage detected