Commit Graph

22 Commits

Author SHA1 Message Date
Nicolas De Loof af5d83a641
Make it explicit raw|multiplexed stream implementation being used
fix #35761

Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
2022-05-12 11:36:31 +02:00
Sebastiaan van Stijn 5f47cef514
fix nolint comments for SA1019: filters.ToParamWithVersion is deprecated
The old nolint comment didn't seem to work anymore;

```
client/container_list.go:39:22: SA1019: filters.ToParamWithVersion is deprecated: do not use in any new code; use ToJSON instead  (staticcheck)
client/events.go:94:22:         SA1019: filters.ToParamWithVersion is deprecated: do not use in any new code; use ToJSON instead  (staticcheck)
client/image_list.go:28:22:     SA1019: filters.ToParamWithVersion is deprecated: do not use in any new code; use ToJSON instead  (staticcheck)
```

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2019-10-18 00:45:33 +02:00
Sebastiaan van Stijn dabc7cdb56
client: use constants for http methods
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2019-10-13 17:30:21 +02:00
Sebastiaan van Stijn fd65fed81b
client/hijack: suppress SA1019: httputil.ErrPersistEOF is deprecated (staticcheck)
Keeping this code for now to allow connecting to old daemons, but we might
want to remove this at some point

```
client/hijack.go:90:12: SA1019: httputil.ErrPersistEOF is deprecated: No longer used.  (staticcheck)
```

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2019-09-18 12:57:54 +02:00
Sebastiaan van Stijn b26aa97914
Add client.WithAPIVersionNegotiation() option
WithAPIVersionNegotiation enables automatic API version negotiation for the client.

With this option enabled, the client automatically negotiates the API version
to use when making requests. API version negotiation is performed on the first
request; subsequent requests will not re-negotiate.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2019-04-10 19:23:47 +02:00
Tibor Vass e8382ece65 api: add undocumented /grpc endpoint to talk to GRPC services
Signed-off-by: Tibor Vass <tibor@docker.com>
2019-04-02 19:57:59 +00:00
Akihiro Suda edac92409a client: add WithDialContext() and client.Dialer()
WithDialContext() allows specifying custom dialer for hijacking and supposed to
replace WithDialer().
WithDialer() is also updated to use WithDialContext().

client.Dialer() returns the dialer configured with WithDialContext().

Signed-off-by: Akihiro Suda <suda.akihiro@lab.ntt.co.jp>
2018-07-28 23:35:47 +09:00
Brian Goff 2ac277a56f
Use stdlib TLS dialer
Since go1.8, the stdlib TLS net.Conn implementation implements the
`CloseWrite()` interface.

Signed-off-by: Brian Goff <cpuguy83@gmail.com>
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2018-06-08 14:24:30 -07:00
Kir Kolyshkin 7d62e40f7e Switch from x/net/context -> context
Since Go 1.7, context is a standard package. Since Go 1.9, everything
that is provided by "x/net/context" is a couple of type aliases to
types in "context".

Many vendored packages still use x/net/context, so vendor entry remains
for now.

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2018-04-23 13:52:44 -07:00
Tonis Tiigi f094a05e26 client: fix hijackedconn reading from buffer
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2018-03-21 15:29:44 -07:00
Jim Minter 37983921c9 Ensure a hijacked connection implements CloseWrite whenever its underlying
connection does.  If this isn't done, then a container listening on stdin won't
receive an EOF when the client closes the stream at their end.

Signed-off-by: Jim Minter <jminter@redhat.com>
2018-03-14 09:07:55 -06:00
Daniel Nephin 4f0d95fa6e Add canonical import comment
Signed-off-by: Daniel Nephin <dnephin@docker.com>
2018-02-05 16:51:57 -05:00
Daniel Nephin f7f101d57e Add gosimple linter
Update gometalinter

Signed-off-by: Daniel Nephin <dnephin@docker.com>
2017-09-12 12:09:59 -04:00
Daniel Nephin 6916c215b0 Move tlsconfig to client package.
Signed-off-by: Daniel Nephin <dnephin@docker.com>
2017-09-06 16:39:55 -04:00
Tibor Vass 7a53991bd6 Fix panic in hijack
Signed-off-by: Tibor Vass <tibor@docker.com>
2017-07-25 22:46:41 -07:00
Tonis Tiigi ec7b6238c3 Add long-running client session endpoint
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2017-06-22 11:22:41 -07:00
yangshukui 26231b29e7 Add a error check in postHijacked to avoid docker exec command blocking.
When user execute docker exec command, docker daemon maybe have err return because
of ExecExists check, and then the hijack stream will not be close, it can lead to
docker exec command block.

Signed-off-by: yangshukui <yangshukui@huawei.com>
2017-06-08 15:46:50 +08:00
Daniel Nephin d32ffb72b7 Refactor client/request
Signed-off-by: Daniel Nephin <dnephin@docker.com>
2016-10-31 17:36:49 -04:00
Stephen J Day dc9f5c2ca3
client: pedantic checking of tlsconfig
Under the convoluted code path for the transport configuration,
TLSConfig was being set even though the socket type is unix. This caused
other code detecting the TLSConfig to assume https, rather than using
the http scheme. This led to a situation where if `DOCKER_CERT_PATH` is
set, unix sockets start reverting to https. There is other odd behavior
from go-connections that is also reproduced here.

For the most part, we try to reproduce the side-effecting behavior from
go-connections to retain the current docker behavior. This whole mess
needs to ripped out and fixed, as this pile spaghetti is unnacceptable.

This code is way to convoluted for an http client. We'll need to fix
this but the Go API will break to do it.

Signed-off-by: Stephen J Day <stephen.day@docker.com>
2016-09-27 16:27:48 -07:00
Stephen J Day 9a072adff3
client: remove transport package
This package doesn't really seem to do anything of real interest.
Removing it and replacing with a few helper functions. Most of this was
maintaining a fork of ctxhttp to support a mock that was unnecessary.

We could probably do with a further refactor of the client interface.
There is a lot of confusion of between transport, http layer and
application layer that makes for some awkward code. This change
improves the situation to the point where no breaking changes are
introduced.

Signed-off-by: Stephen J Day <stephen.day@docker.com>
2016-09-19 11:19:55 -07:00
Stephen J Day 9d7be9df8f tlsconfig: move Clone into proper package
Signed-off-by: Stephen J Day <stephen.day@docker.com>
2016-09-09 12:05:17 -07:00
Michael Crosby 7c36a1af03 Move engine-api client package
This moves the engine-api client package to `/docker/docker/client`.

Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2016-09-07 11:05:58 -07:00