diff --git a/libpod/util.go b/libpod/util.go index 4c5c2db39a..4bd4dd62c3 100644 --- a/libpod/util.go +++ b/libpod/util.go @@ -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) } } diff --git a/test/apiv2/20-containers.at b/test/apiv2/20-containers.at index f39283a481..3d1f0896bd 100644 --- a/test/apiv2/20-containers.at +++ b/test/apiv2/20-containers.at @@ -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 diff --git a/test/apiv2/test-apiv2 b/test/apiv2/test-apiv2 index 08377c6f5e..55490975b9 100755 --- a/test/apiv2/test-apiv2 +++ b/test/apiv2/test-apiv2 @@ -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