Skip to content

Commit

Permalink
address comment
Browse files Browse the repository at this point in the history
typos and fix spelling

Signed-off-by: Yuchen Dai <silentdai@gmail.com>
  • Loading branch information
lambdai committed Sep 17, 2019
1 parent c659a4d commit 922214d
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ struct HttpInspectorStats {
};

enum class ParseState {
// Parse result is out. It could be tls or not.
// Parse result is out. It could be http family or empty.
Done,
// Parser expects more data.
Continue,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -454,22 +454,25 @@ TEST_F(HttpInspectorTest, MultipleReadsHttp1BadProtocol) {

init();

const absl::string_view data = "GET /index HTT\r";
const std::string valid_header = "GET /index HTTP/1.1\r";
// offset: 0 10
const std::string truncate_header = valid_header.substr(0, 14).append("\r");

{
InSequence s;

EXPECT_CALL(os_sys_calls_, recv(42, _, _, MSG_PEEK)).WillOnce(InvokeWithoutArgs([]() {
return Api::SysCallSizeResult{ssize_t(-1), EAGAIN};
}));

for (size_t i = 1; i <= data.length(); i++) {
for (size_t i = 1; i <= truncate_header.length(); i++) {
EXPECT_CALL(os_sys_calls_, recv(42, _, _, MSG_PEEK))
.WillOnce(
Invoke([&data, i](int, void* buffer, size_t length, int) -> Api::SysCallSizeResult {
ASSERT(length >= data.size());
memcpy(buffer, data.data(), data.size());
return Api::SysCallSizeResult{ssize_t(i), 0};
}));
.WillOnce(Invoke([&truncate_header, i](int, void* buffer, size_t length,
int) -> Api::SysCallSizeResult {
ASSERT(length >= truncate_header.size());
memcpy(buffer, truncate_header.data(), truncate_header.size());
return Api::SysCallSizeResult{ssize_t(i), 0};
}));
}
}

Expand Down

0 comments on commit 922214d

Please sign in to comment.