mirror of https://github.com/containers/podman.git
Merge pull request #21979 from chilikk/fix-exec-headers
fix invalid HTTP header values when hijacking a connection
This commit is contained in:
commit
f5abca415d
|
@ -217,7 +217,7 @@ func writeHijackHeader(r *http.Request, conn io.Writer, tty bool) {
|
|||
// Upgraded
|
||||
fmt.Fprintf(conn,
|
||||
"HTTP/1.1 101 UPGRADED\r\nContent-Type: %s\r\nConnection: Upgrade\r\nUpgrade: %s\r\n\r\n",
|
||||
proto, header)
|
||||
header, proto)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -45,6 +45,11 @@ t POST "/v4.7.0/libpod/containers/foo/attach?logs=true&stream=false" 200
|
|||
response_headers=$(cat "$WORKDIR/curl.headers.out")
|
||||
like "$response_headers" ".*Content-Type: application/vnd\.docker\.multiplexed-stream.*" "vnd.docker.multiplexed-stream libpod v4.7.0"
|
||||
|
||||
t POST "containers/foo/attach?logs=true&stream=false" 101
|
||||
response_headers=$(cat "$WORKDIR/curl.headers.out")
|
||||
like "$response_headers" ".*Content-Type: application/vnd\.docker\.raw-stream.*" "hijacked connection header: Content-type: application/vnd.docker.raw-stream"
|
||||
like "$response_headers" ".*Upgrade: tcp.*" "hijacked connection header: Upgrade: tcp"
|
||||
|
||||
t POST "containers/foo/kill" 204
|
||||
|
||||
podman run --replace --name=foo -v /tmp:/tmp $IMAGE true
|
||||
|
|
|
@ -322,6 +322,10 @@ function t() {
|
|||
|
||||
local expected_code=$1; shift
|
||||
|
||||
if [[ "$expected_code" == "101" ]]; then
|
||||
curl_args+=("-H" "Connection: upgrade" "-H" "Upgrade: tcp")
|
||||
fi
|
||||
|
||||
# Log every action we do
|
||||
echo "-------------------------------------------------------------" >>$LOG
|
||||
echo "\$ $testname" >>$LOG
|
||||
|
|
Loading…
Reference in New Issue