moby/cmd/dockerd/daemon_windows.go
Sebastiaan van Stijn f6b1f01de3
Remove hack MalformedHostHeaderOverride
This hack was added to fix a compatibility with clients
that were built using Go 1.5 and older (added in 3d6f5984f5)

This hack causes some problems with current clients; with Go 1.5 and older
no longer being supported for some time, and being several years old, it
should now be ok to remove this hack altogether.

People using tools that are built with those versions of Go wouldn't have
updated those for years, and are probably out of date anyway; that's not
something we can continue taking into account.

This will affect docker clients (the docker cli) for docker 1.12 and older.
Those versions have reached EOL a long time ago (and have known unpatched
vulnerabilities), so should no longer be used anyway, but We should add
a nebtuib in the release notes, just in case someone, somewhere, still
has such old tools.

For those affected, using a more recent client (and if needed, setting
the DOCKER_API_VERSION environment variable to the needed API version)
should provide a way out.

This reverts the changes originally made in; #22000 and #22888,
which were to address #20865.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2019-07-18 21:25:04 +02:00

95 lines
2.3 KiB
Go

package main
import (
"context"
"fmt"
"os"
"path/filepath"
"time"
"github.com/docker/docker/daemon/config"
"github.com/docker/docker/libcontainerd/supervisor"
"github.com/docker/docker/pkg/system"
"github.com/sirupsen/logrus"
"golang.org/x/sys/windows"
)
func getDefaultDaemonConfigFile() (string, error) {
return "", nil
}
// setDefaultUmask doesn't do anything on windows
func setDefaultUmask() error {
return nil
}
func getDaemonConfDir(root string) (string, error) {
return filepath.Join(root, `\config`), nil
}
// preNotifySystem sends a message to the host when the API is active, but before the daemon is
func preNotifySystem() {
// start the service now to prevent timeouts waiting for daemon to start
// but still (eventually) complete all requests that are sent after this
if service != nil {
err := service.started()
if err != nil {
logrus.Fatal(err)
}
}
}
// notifySystem sends a message to the host when the server is ready to be used
func notifySystem() {
}
// notifyShutdown is called after the daemon shuts down but before the process exits.
func notifyShutdown(err error) {
if service != nil {
if err != nil {
logrus.Fatal(err)
}
service.stopped(err)
}
}
func (cli *DaemonCli) getPlatformContainerdDaemonOpts() ([]supervisor.DaemonOpt, error) {
return nil, nil
}
// setupConfigReloadTrap configures a Win32 event to reload the configuration.
func (cli *DaemonCli) setupConfigReloadTrap() {
go func() {
sa := windows.SecurityAttributes{
Length: 0,
}
event := "Global\\docker-daemon-config-" + fmt.Sprint(os.Getpid())
ev, _ := windows.UTF16PtrFromString(event)
if h, _ := windows.CreateEvent(&sa, 0, 0, ev); h != 0 {
logrus.Debugf("Config reload - waiting signal at %s", event)
for {
windows.WaitForSingleObject(h, windows.INFINITE)
cli.reloadConfig()
}
}
}()
}
// getSwarmRunRoot gets the root directory for swarm to store runtime state
// For example, the control socket
func (cli *DaemonCli) getSwarmRunRoot() string {
return ""
}
func allocateDaemonPort(addr string) error {
return nil
}
func newCgroupParent(config *config.Config) string {
return ""
}
func (cli *DaemonCli) initContainerD(_ context.Context) (func(time.Duration) error, error) {
system.InitContainerdRuntime(cli.Config.Experimental, cli.Config.ContainerdAddr)
return nil, nil
}