jingxiaolu e5ee0a0ce1 docker: define a dummy hostname to use for local connections
For local communications (npipe://, unix://), the hostname is not used,
but we need valid and meaningful hostname.

The current code used the client's `addr` as hostname in some cases, which
could contain the path for the unix-socket (`/var/run/docker.sock`), which
gets rejected by go1.20.6 and go1.19.11 because of a security fix for
[CVE-2023-29406 ][1], which was implemented in  https://go.dev/issue/60374.

Prior versions go Go would clean the host header, and strip slashes in the
process, but go1.20.6 and go1.19.11 no longer do, and reject the host
header.

This patch introduces a `DummyHost` const, and uses this dummy host for
cases where we don't need an actual hostname.

Signed-off-by: jingxiaolu <lujingxiao@huawei.com>
(cherry picked from commit eedae47681500c0f38752cd3c0bf3d08d7b3c7fc)
2023-08-03 16:16:02 +08:00
2019-09-30 10:37:25 -04:00
Description
No description provided
15 MiB
Languages
Shell 100%