/_ping handler: return OSType http header

The docker client expects to read the OSType header from the `/_ping` response in order to determine the OS type of the server, for example, when running `docker run --device=/dev/fuse ...`

https://github.com/moby/moby/blob/master/client/ping.go#L57

Signed-off-by: chnrxn <cohawk@yahoo.com>
This commit is contained in:
chnrxn
2023-08-28 14:18:32 +08:00
committed by Kokhong Cheng
parent 44986f5b10
commit 1b45fd7239
2 changed files with 3 additions and 0 deletions

View File

@@ -3,6 +3,7 @@ package compat
import (
"fmt"
"net/http"
"runtime"
"github.com/containers/buildah"
)
@@ -18,6 +19,7 @@ func Ping(w http.ResponseWriter, r *http.Request) {
w.Header().Set("Builder-Version", "")
w.Header().Set("Docker-Experimental", "true")
w.Header().Set("Cache-Control", "no-cache")
w.Header().Set("OSType", runtime.GOOS)
w.Header().Set("Pragma", "no-cache")
w.Header().Set("Libpod-Buildah-Version", buildah.Version)

View File

@@ -11,6 +11,7 @@ t GET /libpod/_ping 200 OK
t HEAD /libpod/_ping 200
t GET _ping 200 OK
like "$(<$WORKDIR/curl.headers.out)" $'.*\nOstype: ' "#19767 - undocumented part of docker API"
t HEAD _ping 200
t GET libpod/_ping 200 OK
t HEAD libpod/_ping 200