Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions docs/root/intro/version_history.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ Version history
* fault: removed integer percentage support.
* stream: renamed the `RequestInfo` namespace to `StreamInfo` to better match
its behaviour within TCP and HTTP implementations.
* http: no longer adding whitespace when appending X-Forwarded-For headers. **Warning**: this is not

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you alpha order? I think you need to merge master anyway to pick up CI fixes.

compatible with 1.7.0 builds prior to `9d3a4eb4ac44be9f0651fcc7f87ad98c538b01ee <https://github.com/envoyproxy/envoy/pull/3610>`_.
See `#3611 <https://github.com/envoyproxy/envoy/issues/3611>`_ for details.

1.8.0 (Oct 4, 2018)
===================
Expand Down
7 changes: 1 addition & 6 deletions source/common/http/utility.cc
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,9 @@ void Utility::appendXff(HeaderMap& headers, const Network::Address::Instance& re
return;
}

// TODO(alyssawilk) move over to the append utility.
HeaderString& header = headers.insertForwardedFor().value();
if (!header.empty()) {
header.append(", ", 2);
}

const std::string& address_as_string = remote_address.ip()->addressAsString();
header.append(address_as_string.c_str(), address_as_string.size());
HeaderMapImpl::appendToHeader(header, address_as_string.c_str());
}

void Utility::appendVia(HeaderMap& headers, const std::string& via) {
Expand Down
2 changes: 1 addition & 1 deletion test/common/http/conn_manager_utility_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -530,7 +530,7 @@ TEST_F(ConnectionManagerUtilityTest, AppendInternalAddressXffNotInternalRequest)

EXPECT_EQ((MutateRequestRet{"10.0.0.1:0", false}),
callMutateRequestHeaders(headers, Protocol::Http2));
EXPECT_EQ("10.0.0.2, 10.0.0.1", headers.get_("x-forwarded-for"));
EXPECT_EQ("10.0.0.2,10.0.0.1", headers.get_("x-forwarded-for"));
}

// A request that is from an internal address and uses remote address should be an internal request.
Expand Down
2 changes: 1 addition & 1 deletion test/common/http/utility_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ TEST(HttpUtility, appendXff) {
TestHeaderMapImpl headers{{"x-forwarded-for", "10.0.0.1"}};
Network::Address::Ipv4Instance address("127.0.0.1");
Utility::appendXff(headers, address);
EXPECT_EQ("10.0.0.1, 127.0.0.1", headers.get_("x-forwarded-for"));
EXPECT_EQ("10.0.0.1,127.0.0.1", headers.get_("x-forwarded-for"));
}

{
Expand Down