mirror of
https://github.com/zebrajr/express.git
synced 2025-12-06 00:19:48 +01:00
perf: skip parsing of entire "X-Forwarded-Proto" header
This commit is contained in:
parent
b7817ab1b0
commit
b97faff6e2
|
|
@ -2,6 +2,7 @@ unreleased
|
|||
==========
|
||||
|
||||
* Fix `TypeError` in `res.send` when given `Buffer` and `ETag` header set
|
||||
* perf: skip parsing of entire `X-Forwarded-Proto` header
|
||||
|
||||
4.16.1 / 2017-09-29
|
||||
===================
|
||||
|
|
|
|||
|
|
@ -315,8 +315,12 @@ defineGetter(req, 'protocol', function protocol(){
|
|||
|
||||
// Note: X-Forwarded-Proto is normally only ever a
|
||||
// single value, but this is to be safe.
|
||||
proto = this.get('X-Forwarded-Proto') || proto;
|
||||
return proto.split(/\s*,\s*/)[0];
|
||||
var header = this.get('X-Forwarded-Proto') || proto
|
||||
var index = header.indexOf(',')
|
||||
|
||||
return index !== -1
|
||||
? header.substring(0, index).trim()
|
||||
: header.trim()
|
||||
});
|
||||
|
||||
/**
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user