-
Notifications
You must be signed in to change notification settings - Fork 652
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
workaround ab (ApacheBench) in keep-alive mode (#260)
Motivation: `ab -k` behaves weirdly: it'll send an HTTP/1.0 request with keep-alive set but stops doing anything at all if the server doesn't also set Connection: keep-alive which our example HTTP1Server didn't do. Modifications: In the HTTP1Server example if we receive an HTTP/1.0 request with Connection: keep-alive, we'll now set keep-alive too. Result: ab -k doesn't get stuck anymore.
- Loading branch information
1 parent
b6681c0
commit d94ab56
Showing
3 changed files
with
59 additions
and
11 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
24 changes: 24 additions & 0 deletions
24
IntegrationTests/tests_01_http/test_22_http_1.0_keep_alive.sh
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 |
---|---|---|
@@ -0,0 +1,24 @@ | ||
#!/bin/bash | ||
##===----------------------------------------------------------------------===## | ||
## | ||
## This source file is part of the SwiftNIO open source project | ||
## | ||
## Copyright (c) 2017-2018 Apple Inc. and the SwiftNIO project authors | ||
## Licensed under Apache License v2.0 | ||
## | ||
## See LICENSE.txt for license information | ||
## See CONTRIBUTORS.txt for the list of SwiftNIO project authors | ||
## | ||
## SPDX-License-Identifier: Apache-2.0 | ||
## | ||
##===----------------------------------------------------------------------===## | ||
|
||
source defines.sh | ||
|
||
token=$(create_token) | ||
start_server "$token" | ||
do_curl "$token" -H 'connection: keep-alive' -v --http1.0 \ | ||
"http://foobar.com/dynamic/info" > "$tmp/out_actual" 2>&1 | ||
grep -qi '< Connection: keep-alive' "$tmp/out_actual" | ||
grep -qi '< HTTP/1.0 200 OK' "$tmp/out_actual" | ||
stop_server "$token" |
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