Skip to content

Commit 80638d7

Browse files
leevfacebook-github-bot
authored andcommitted
Take the last value for a fastcgi param if multiple values are provided
Summary: If a fastcgi param was provided multiple times in the one request, the first value would be used. This will now take the last one, which is what PHP does. Closes #2924 Reviewed By: @ptarjan Differential Revision: D1381723 Pulled By: @JoelMarcey
1 parent 71a7e47 commit 80638d7

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

hphp/runtime/server/fastcgi/fastcgi-transport.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -366,7 +366,10 @@ void FastCGITransport::onHeader(std::unique_ptr<folly::IOBuf> key_chain,
366366
cursor = Cursor(value_chain.get());
367367
std::string value = cursor.readFixedString(
368368
value_chain->computeChainDataLength());
369-
m_requestHeaders.emplace(key, value);
369+
auto it = m_requestHeaders.emplace(key, value);
370+
if (!it.second) {
371+
it.first->second = value;
372+
}
370373
}
371374

372375
static const std::string

0 commit comments

Comments
 (0)