Before adoption: this commit came in with the history the project adopted, so no landing records it.
Diff stats
3 files+55 added−0 removed
tests:+50 added−0 removed
other:+5 added−0 removed
Provenance
Commit
b93ffd4
Tree
4eb049a
Author
Horatiu Eugen Vlad <horatiu@vlad.eu>
Committer
Douglas Christopher Wilson <doug@somethingdoug.com>
Parent
8da5110
3 files changed+55 added−0 removed
modified:lib/request.js+4 added
428 unmodified lines
429 var host = this.get('X-Forwarded-Host');430431 if (!host || !trust(this.connection.remoteAddress, 0)) {432 host = this.get('Host');433+ } else if (host.indexOf(',') !== -1) {434+ // Note: X-Forwarded-Host is normally only ever a435+ // single value, but this is to be safe.436+ host = host.substring(0, host.indexOf(',')).trimRight()437 }438439 if (!host) return;440
85 unmodified lines
modified:test/req.hostname.js+50 added
114 unmodified lines
Expand all
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
15 unmodified lines
114 unmodified lines
Expand all
.get('/')
.set('Host', 'example.com')
.expect('example.com', done);
})
describe('when multiple X-Forwarded-Host', function () {
it('should use the first value', function (done) {
2==========34 * Improve error message for non-strings to `res.sendFile`5 * Improve error message for `null`/`undefined` to `res.status`6+ * Support multiple hosts in `X-Forwarded-Host`784.16.4 / 2018-10-109===================10