-
Notifications
You must be signed in to change notification settings - Fork 4.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
http: cleaning up redispatch logic (#9208)
Signed-off-by: Alyssa Wilk <alyssar@chromium.org>
- Loading branch information
1 parent
8534ac8
commit 281243e
Showing
3 changed files
with
63 additions
and
43 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -490,6 +490,35 @@ TEST_P(IntegrationTest, Pipeline) { | |
connection.close(); | ||
} | ||
|
||
// Add a pipeline test where complete request headers in the first request merit | ||
// an inline sendLocalReply to make sure the "kick" works under the call stack | ||
// of dispatch as well as when a response is proxied from upstream. | ||
TEST_P(IntegrationTest, PipelineInline) { | ||
autonomous_upstream_ = true; | ||
initialize(); | ||
std::string response; | ||
|
||
Buffer::OwnedImpl buffer("GET / HTTP/1.1\r\n\r\nGET / HTTP/1.1\r\n\r\n"); | ||
RawConnectionDriver connection( | ||
lookupPort("http"), buffer, | ||
[&](Network::ClientConnection&, const Buffer::Instance& data) -> void { | ||
response.append(data.toString()); | ||
}, | ||
version_); | ||
// First is an error: no host. | ||
while (response.find("400") == std::string::npos) { | ||
connection.run(Event::Dispatcher::RunType::NonBlock); | ||
} | ||
EXPECT_THAT(response, HasSubstr("HTTP/1.1 400 Bad Request\r\n")); | ||
|
||
// Second response should be 400 (no host) | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
alyssawilk
Author
Contributor
|
||
while (response.find("400") == std::string::npos) { | ||
connection.run(Event::Dispatcher::RunType::NonBlock); | ||
} | ||
EXPECT_THAT(response, HasSubstr("HTTP/1.1 400 Bad Request\r\n")); | ||
connection.close(); | ||
} | ||
|
||
TEST_P(IntegrationTest, NoHost) { | ||
initialize(); | ||
codec_client_ = makeHttpConnection(lookupPort("http")); | ||
|
@alyssawilk I don't think you are actually checking the second response here. You have to search after the first 400.