* Returns headers for a response. * * @param {http.IncomingMessage} req * @param {Object} headers - extra headers * @private
(req: IncomingMessage, headers: Record<string, string> = {})
| 381 | * @private |
| 382 | */ |
| 383 | private headers(req: IncomingMessage, headers: Record<string, string> = {}) { |
| 384 | // prevent XSS warnings on IE |
| 385 | // https://github.com/LearnBoost/socket.io/pull/1333 |
| 386 | const ua = req.headers["user-agent"]; |
| 387 | if (ua && (~ua.indexOf(";MSIE") || ~ua.indexOf("Trident/"))) { |
| 388 | headers["X-XSS-Protection"] = "0"; |
| 389 | } |
| 390 | |
| 391 | headers["cache-control"] = "no-store"; |
| 392 | |
| 393 | this.emit("headers", headers, req); |
| 394 | return headers; |
| 395 | } |
| 396 | } |