Set HTTP upgrade headers when hijacking connection

Signed-off-by: Jean-Tiare Le Bigot <jt@yadutaf.fr>
This commit is contained in:
Jean-Tiare Le Bigot 2014-12-13 13:00:59 +01:00 коммит произвёл Jean-Tiare Le Bigot
Родитель 8ca28a35c7
Коммит 9256578f62
2 изменённых файлов: 4 добавлений и 2 удалений

Просмотреть файл

@ -135,6 +135,8 @@ func (cli *DockerCli) hijack(method, path string, setRawTerminal bool, in io.Rea
} }
req.Header.Set("User-Agent", "Docker-Client/"+dockerversion.VERSION) req.Header.Set("User-Agent", "Docker-Client/"+dockerversion.VERSION)
req.Header.Set("Content-Type", "plain/text") req.Header.Set("Content-Type", "plain/text")
req.Header.Set("Connection", "Upgrade")
req.Header.Set("Upgrade", "tcp")
req.Host = cli.addr req.Host = cli.addr
dial, err := cli.dial() dial, err := cli.dial()

Просмотреть файл

@ -887,7 +887,7 @@ func postContainersAttach(eng *engine.Engine, version version.Version, w http.Re
var errStream io.Writer var errStream io.Writer
fmt.Fprintf(outStream, "HTTP/1.1 200 OK\r\nContent-Type: application/vnd.docker.raw-stream\r\n\r\n") fmt.Fprintf(outStream, "HTTP/1.1 101 UPGRADED\r\nContent-Type: application/vnd.docker.raw-stream\r\nConnection: Upgrade\r\nUpgrade: tcp\r\n\r\n")
if c.GetSubEnv("Config") != nil && !c.GetSubEnv("Config").GetBool("Tty") && version.GreaterThanOrEqualTo("1.6") { if c.GetSubEnv("Config") != nil && !c.GetSubEnv("Config").GetBool("Tty") && version.GreaterThanOrEqualTo("1.6") {
errStream = stdcopy.NewStdWriter(outStream, stdcopy.Stderr) errStream = stdcopy.NewStdWriter(outStream, stdcopy.Stderr)
@ -1137,7 +1137,7 @@ func postContainerExecStart(eng *engine.Engine, version version.Version, w http.
var errStream io.Writer var errStream io.Writer
fmt.Fprintf(outStream, "HTTP/1.1 200 OK\r\nContent-Type: application/vnd.docker.raw-stream\r\n\r\n") fmt.Fprintf(outStream, "HTTP/1.1 101 UPGRADED\r\nContent-Type: application/vnd.docker.raw-stream\r\nConnection: Upgrade\r\nUpgrade: tcp\r\n\r\n")
if !job.GetenvBool("Tty") && version.GreaterThanOrEqualTo("1.6") { if !job.GetenvBool("Tty") && version.GreaterThanOrEqualTo("1.6") {
errStream = stdcopy.NewStdWriter(outStream, stdcopy.Stderr) errStream = stdcopy.NewStdWriter(outStream, stdcopy.Stderr)
outStream = stdcopy.NewStdWriter(outStream, stdcopy.Stdout) outStream = stdcopy.NewStdWriter(outStream, stdcopy.Stdout)