Skip to content

Commit

Permalink
Address PR comments
Browse files Browse the repository at this point in the history
Signed-off-by: Sotiris Nanopoulos <sonanopo@microsoft.com>
  • Loading branch information
Sotiris Nanopoulos committed Aug 14, 2020
1 parent 212418a commit d540ffd
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
5 changes: 3 additions & 2 deletions test/extensions/filters/listener/http_inspector/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,9 @@ envoy_extension_cc_test(
srcs = ["http_inspector_test.cc"],
extension_name = "envoy.filters.listener.http_inspector",
#TODO(davinci26): The test passes on Windows *but* http inspector
# relies on Event::FileTriggerType::Edge and we get away with it
# because we mock the dispather.
# *used* to rely on Event::FileTriggerType::Edge and we got away with it
# because we mock the dispatcher. Need to verify that the scenario is
# actually working.
tags = ["fails_on_windows"],
deps = [
"//source/common/common:hex_lib",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -567,6 +567,9 @@ TEST_F(HttpInspectorTest, MultipleReadsHttp1BadProtocol) {
}

TEST_F(HttpInspectorTest, Http1WithLargeRequestLine) {
// Verify that the http inspector can detect http requests
// with large request line even when they are splitted over
// multiple recv calls.
init();
absl::string_view method = "GET", http = "/index HTTP/1.0\r";
std::string spaces(Config::MAX_INSPECT_SIZE - method.size() - http.size(), ' ');
Expand All @@ -591,11 +594,12 @@ TEST_F(HttpInspectorTest, Http1WithLargeRequestLine) {
int) -> Api::SysCallSizeResult {
size_t len = (*ctr);
if (num_loops == 2) {
ASSERT(*ctx != 3)
len = size_t(Config::MAX_INSPECT_SIZE / (3 - (*ctr)));
}
ASSERT(length >= len);
memcpy(buffer, data.data(), len);
(*ctr) += 1;
*ctr += 1;
return Api::SysCallSizeResult{ssize_t(len), 0};
}));
}
Expand Down

0 comments on commit d540ffd

Please sign in to comment.