Skip to content
Myr

perf: skip parsing of entire "X-Forwarded-Proto" header

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by Douglas Christopher Wilson · committed by Douglas Christopher Wilson · parent b7817ab · Browse files · 2 files+7 added−2 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

2 files+7 added−2 removed

  • other:+7 added−2 removed

2 files+7 added−2 removed

modified:lib/request.js+6 added-2 removed
313 unmodified lines
314 }315316 // Note: X-Forwarded-Proto is normally only ever a317 // single value, but this is to be safe.318 proto = this.get('X-Forwarded-Proto') || proto;319 return proto.split(/\s*,\s*/)[0];318 var header = this.get('X-Forwarded-Proto') || proto319 var index = header.indexOf(',')320321 return index !== -1322 ? header.substring(0, index).trim()323 : header.trim()324});325326/**327 * Short-hand for:
194 unmodified lines
modified:History.md+1 added
1unreleased2==========34 * Fix `TypeError` in `res.send` when given `Buffer` and `ETag` header set5 * perf: skip parsing of entire `X-Forwarded-Proto` header674.16.1 / 2017-09-298===================9
3365 unmodified lines