<feed xmlns='http://www.w3.org/2005/Atom'>
<title>delta/docker.git/api/server/router/plugin, branch master</title>
<subtitle>github.com: dotcloud/docker.git
</subtitle>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/docker.git/'/>
<entry>
<title>api: add registry.DecodeAuthConfig, registry.DecodeAuthConfigBody</title>
<updated>2022-07-29T21:11:13+00:00</updated>
<author>
<name>Sebastiaan van Stijn</name>
<email>github@gone.nl</email>
</author>
<published>2022-03-03T09:34:43+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/docker.git/commit/?id=7819811835cc1e65c31aae5b45e43a5d119631ac'/>
<id>7819811835cc1e65c31aae5b45e43a5d119631ac</id>
<content type='text'>
Signed-off-by: Sebastiaan van Stijn &lt;github@gone.nl&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Signed-off-by: Sebastiaan van Stijn &lt;github@gone.nl&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>plugin: use types/registry.AuthConfig</title>
<updated>2022-07-29T21:05:19+00:00</updated>
<author>
<name>Sebastiaan van Stijn</name>
<email>github@gone.nl</email>
</author>
<published>2022-03-03T09:31:58+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/docker.git/commit/?id=55d1a5682638eb0d28eb52409802a2572177794b'/>
<id>55d1a5682638eb0d28eb52409802a2572177794b</id>
<content type='text'>
Signed-off-by: Sebastiaan van Stijn &lt;github@gone.nl&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Signed-off-by: Sebastiaan van Stijn &lt;github@gone.nl&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>api/server/router: use types/registry.AuthConfig</title>
<updated>2022-07-29T21:05:14+00:00</updated>
<author>
<name>Sebastiaan van Stijn</name>
<email>github@gone.nl</email>
</author>
<published>2022-03-03T09:23:18+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/docker.git/commit/?id=d8a43399a80586c9b8105111d364637f314c6c02'/>
<id>d8a43399a80586c9b8105111d364637f314c6c02</id>
<content type='text'>
Signed-off-by: Sebastiaan van Stijn &lt;github@gone.nl&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Signed-off-by: Sebastiaan van Stijn &lt;github@gone.nl&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>api: add const for 'X-Registry-Auth'</title>
<updated>2022-07-29T21:04:34+00:00</updated>
<author>
<name>Sebastiaan van Stijn</name>
<email>github@gone.nl</email>
</author>
<published>2021-08-26T19:08:38+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/docker.git/commit/?id=857cb260c79a4c43fa0705ac4f117b85bcc9dfc5'/>
<id>857cb260c79a4c43fa0705ac4f117b85bcc9dfc5</id>
<content type='text'>
Signed-off-by: Sebastiaan van Stijn &lt;github@gone.nl&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Signed-off-by: Sebastiaan van Stijn &lt;github@gone.nl&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>api/server/httputils: add ReadJSON() utility</title>
<updated>2022-04-11T19:37:51+00:00</updated>
<author>
<name>Sebastiaan van Stijn</name>
<email>github@gone.nl</email>
</author>
<published>2022-04-05T09:43:06+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/docker.git/commit/?id=0c9ff0b45a70061d43655672b2e8227e1b51684f'/>
<id>0c9ff0b45a70061d43655672b2e8227e1b51684f</id>
<content type='text'>
Implement a ReadJSON() utility to help reduce some code-duplication,
and to make sure we handle JSON requests consistently (e.g. always
check for the content-type).

Differences compared to current handling:

- prevent possible panic if request.Body is nil ("should never happen")
- always require Content-Type to be "application/json"
- be stricter about additional content after JSON (previously ignored)
- but, allow the body to be empty (an empty body is not invalid);
  update TestContainerInvalidJSON accordingly, which was testing the
  wrong expectation.
- close body after reading (some code did this)

We should consider to add a "max body size" on this function, similar to
https://github.com/moby/moby/blob/7b9275c0da707b030e62c96b679a976f31f929d3/api/server/middleware/debug.go#L27-L40

Signed-off-by: Sebastiaan van Stijn &lt;github@gone.nl&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Implement a ReadJSON() utility to help reduce some code-duplication,
and to make sure we handle JSON requests consistently (e.g. always
check for the content-type).

Differences compared to current handling:

- prevent possible panic if request.Body is nil ("should never happen")
- always require Content-Type to be "application/json"
- be stricter about additional content after JSON (previously ignored)
- but, allow the body to be empty (an empty body is not invalid);
  update TestContainerInvalidJSON accordingly, which was testing the
  wrong expectation.
- close body after reading (some code did this)

We should consider to add a "max body size" on this function, similar to
https://github.com/moby/moby/blob/7b9275c0da707b030e62c96b679a976f31f929d3/api/server/middleware/debug.go#L27-L40

Signed-off-by: Sebastiaan van Stijn &lt;github@gone.nl&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>api: normalize comment formatting</title>
<updated>2019-11-27T14:37:30+00:00</updated>
<author>
<name>Sebastiaan van Stijn</name>
<email>github@gone.nl</email>
</author>
<published>2019-11-27T14:37:30+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/docker.git/commit/?id=c9b2a3cff51a6403f4eac319af5a794b0dbdeba4'/>
<id>c9b2a3cff51a6403f4eac319af5a794b0dbdeba4</id>
<content type='text'>
Signed-off-by: Sebastiaan van Stijn &lt;github@gone.nl&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Signed-off-by: Sebastiaan van Stijn &lt;github@gone.nl&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>api/server: explicitly ignore unhandled errors (errcheck)</title>
<updated>2019-09-18T10:57:46+00:00</updated>
<author>
<name>Sebastiaan van Stijn</name>
<email>github@gone.nl</email>
</author>
<published>2019-08-28T15:38:51+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/docker.git/commit/?id=4e621a34ac89f79e04e2a91a56ecc09695f2a6f7'/>
<id>4e621a34ac89f79e04e2a91a56ecc09695f2a6f7</id>
<content type='text'>
```
api/server/router/build/build_routes.go:309:41: Error return value of `(*encoding/json.Decoder).Decode` is not checked (errcheck)
api/server/router/build/build_routes.go:431:11: Error return value of `io.Copy` is not checked (errcheck)
api/server/router/container/container_routes.go:582:13: Error return value of `conn.Write` is not checked (errcheck)
api/server/router/grpc/grpc_routes.go:38:12: Error return value of `conn.Write` is not checked (errcheck)
api/server/router/grpc/grpc_routes.go:39:12: Error return value of `resp.Write` is not checked (errcheck)
api/server/router/image/image_routes.go:94:15: Error return value of `output.Write` is not checked (errcheck)
api/server/router/image/image_routes.go:139:15: Error return value of `output.Write` is not checked (errcheck)
api/server/router/image/image_routes.go:164:15: Error return value of `output.Write` is not checked (errcheck)
api/server/router/image/image_routes.go:180:15: Error return value of `output.Write` is not checked (errcheck)
api/server/router/plugin/plugin_routes.go:126:15: Error return value of `output.Write` is not checked (errcheck)
api/server/router/plugin/plugin_routes.go:165:15: Error return value of `output.Write` is not checked (errcheck)
api/server/router/plugin/plugin_routes.go:273:15: Error return value of `output.Write` is not checked (errcheck)
```

Signed-off-by: Sebastiaan van Stijn &lt;github@gone.nl&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
```
api/server/router/build/build_routes.go:309:41: Error return value of `(*encoding/json.Decoder).Decode` is not checked (errcheck)
api/server/router/build/build_routes.go:431:11: Error return value of `io.Copy` is not checked (errcheck)
api/server/router/container/container_routes.go:582:13: Error return value of `conn.Write` is not checked (errcheck)
api/server/router/grpc/grpc_routes.go:38:12: Error return value of `conn.Write` is not checked (errcheck)
api/server/router/grpc/grpc_routes.go:39:12: Error return value of `resp.Write` is not checked (errcheck)
api/server/router/image/image_routes.go:94:15: Error return value of `output.Write` is not checked (errcheck)
api/server/router/image/image_routes.go:139:15: Error return value of `output.Write` is not checked (errcheck)
api/server/router/image/image_routes.go:164:15: Error return value of `output.Write` is not checked (errcheck)
api/server/router/image/image_routes.go:180:15: Error return value of `output.Write` is not checked (errcheck)
api/server/router/plugin/plugin_routes.go:126:15: Error return value of `output.Write` is not checked (errcheck)
api/server/router/plugin/plugin_routes.go:165:15: Error return value of `output.Write` is not checked (errcheck)
api/server/router/plugin/plugin_routes.go:273:15: Error return value of `output.Write` is not checked (errcheck)
```

Signed-off-by: Sebastiaan van Stijn &lt;github@gone.nl&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>Rely on request.Context() cancellation</title>
<updated>2018-11-28T01:06:31+00:00</updated>
<author>
<name>Brian Goff</name>
<email>cpuguy83@gmail.com</email>
</author>
<published>2018-11-27T22:13:43+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/docker.git/commit/?id=05390c4f6e9e2761d56ab374b55defdf3b09a214'/>
<id>05390c4f6e9e2761d56ab374b55defdf3b09a214</id>
<content type='text'>
The cancellable handler is no longer needed as the context that is
passed with the http request will be cancelled just like the close
notifier was doing.

Signed-off-by: Brian Goff &lt;cpuguy83@gmail.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
The cancellable handler is no longer needed as the context that is
passed with the http request will be cancelled just like the close
notifier was doing.

Signed-off-by: Brian Goff &lt;cpuguy83@gmail.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>API: properly handle invalid JSON to return a 400 status</title>
<updated>2018-11-06T20:30:44+00:00</updated>
<author>
<name>Sebastiaan van Stijn</name>
<email>github@gone.nl</email>
</author>
<published>2018-11-05T13:50:33+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/docker.git/commit/?id=c7b488fbc82604ec23b862ec1edc5a0be9c7793d'/>
<id>c7b488fbc82604ec23b862ec1edc5a0be9c7793d</id>
<content type='text'>
The API did not treat invalid JSON payloads as a 400 error, as a result
returning a 500 error;

Before this change, an invalid JSON body would return a 500 error;

```bash
curl -v \
  --unix-socket /var/run/docker.sock \
  -X POST \
  "http://localhost/v1.30/networks/create" \
  -H "Content-Type: application/json" \
  -d '{invalid json'
```

```
&gt; POST /v1.30/networks/create HTTP/1.1
&gt; Host: localhost
&gt; User-Agent: curl/7.52.1
&gt; Accept: */*
&gt; Content-Type: application/json
&gt; Content-Length: 13
&gt;
* upload completely sent off: 13 out of 13 bytes
&lt; HTTP/1.1 500 Internal Server Error
&lt; Api-Version: 1.40
&lt; Content-Type: application/json
&lt; Docker-Experimental: false
&lt; Ostype: linux
&lt; Server: Docker/dev (linux)
&lt; Date: Mon, 05 Nov 2018 11:55:20 GMT
&lt; Content-Length: 79
&lt;
{"message":"invalid character 'i' looking for beginning of object key string"}
```

Empty request:

```bash
curl -v \
  --unix-socket /var/run/docker.sock \
  -X POST \
  "http://localhost/v1.30/networks/create" \
  -H "Content-Type: application/json"
```

```
&gt; POST /v1.30/networks/create HTTP/1.1
&gt; Host: localhost
&gt; User-Agent: curl/7.54.0
&gt; Accept: */*
&gt; Content-Type: application/json
&gt;
&lt; HTTP/1.1 500 Internal Server Error
&lt; Api-Version: 1.38
&lt; Content-Length: 18
&lt; Content-Type: application/json
&lt; Date: Mon, 05 Nov 2018 12:00:18 GMT
&lt; Docker-Experimental: true
&lt; Ostype: linux
&lt; Server: Docker/18.06.1-ce (linux)
&lt;
{"message":"EOF"}
```

After this change, a 400 is returned;

```bash
curl -v \
  --unix-socket /var/run/docker.sock \
  -X POST \
  "http://localhost/v1.30/networks/create" \
  -H "Content-Type: application/json" \
  -d '{invalid json'
```

```
&gt; POST /v1.30/networks/create HTTP/1.1
&gt; Host: localhost
&gt; User-Agent: curl/7.52.1
&gt; Accept: */*
&gt; Content-Type: application/json
&gt; Content-Length: 13
&gt;
* upload completely sent off: 13 out of 13 bytes
&lt; HTTP/1.1 400 Bad Request
&lt; Api-Version: 1.40
&lt; Content-Type: application/json
&lt; Docker-Experimental: false
&lt; Ostype: linux
&lt; Server: Docker/dev (linux)
&lt; Date: Mon, 05 Nov 2018 11:57:15 GMT
&lt; Content-Length: 79
&lt;
{"message":"invalid character 'i' looking for beginning of object key string"}
```

Empty request:

```bash
curl -v \
  --unix-socket /var/run/docker.sock \
  -X POST \
  "http://localhost/v1.30/networks/create" \
  -H "Content-Type: application/json"
```

```
&gt; POST /v1.30/networks/create HTTP/1.1
&gt; Host: localhost
&gt; User-Agent: curl/7.52.1
&gt; Accept: */*
&gt; Content-Type: application/json
&gt;
&lt; HTTP/1.1 400 Bad Request
&lt; Api-Version: 1.40
&lt; Content-Type: application/json
&lt; Docker-Experimental: false
&lt; Ostype: linux
&lt; Server: Docker/dev (linux)
&lt; Date: Mon, 05 Nov 2018 11:59:22 GMT
&lt; Content-Length: 49
&lt;
{"message":"got EOF while reading request body"}
```

Signed-off-by: Sebastiaan van Stijn &lt;github@gone.nl&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
The API did not treat invalid JSON payloads as a 400 error, as a result
returning a 500 error;

Before this change, an invalid JSON body would return a 500 error;

```bash
curl -v \
  --unix-socket /var/run/docker.sock \
  -X POST \
  "http://localhost/v1.30/networks/create" \
  -H "Content-Type: application/json" \
  -d '{invalid json'
```

```
&gt; POST /v1.30/networks/create HTTP/1.1
&gt; Host: localhost
&gt; User-Agent: curl/7.52.1
&gt; Accept: */*
&gt; Content-Type: application/json
&gt; Content-Length: 13
&gt;
* upload completely sent off: 13 out of 13 bytes
&lt; HTTP/1.1 500 Internal Server Error
&lt; Api-Version: 1.40
&lt; Content-Type: application/json
&lt; Docker-Experimental: false
&lt; Ostype: linux
&lt; Server: Docker/dev (linux)
&lt; Date: Mon, 05 Nov 2018 11:55:20 GMT
&lt; Content-Length: 79
&lt;
{"message":"invalid character 'i' looking for beginning of object key string"}
```

Empty request:

```bash
curl -v \
  --unix-socket /var/run/docker.sock \
  -X POST \
  "http://localhost/v1.30/networks/create" \
  -H "Content-Type: application/json"
```

```
&gt; POST /v1.30/networks/create HTTP/1.1
&gt; Host: localhost
&gt; User-Agent: curl/7.54.0
&gt; Accept: */*
&gt; Content-Type: application/json
&gt;
&lt; HTTP/1.1 500 Internal Server Error
&lt; Api-Version: 1.38
&lt; Content-Length: 18
&lt; Content-Type: application/json
&lt; Date: Mon, 05 Nov 2018 12:00:18 GMT
&lt; Docker-Experimental: true
&lt; Ostype: linux
&lt; Server: Docker/18.06.1-ce (linux)
&lt;
{"message":"EOF"}
```

After this change, a 400 is returned;

```bash
curl -v \
  --unix-socket /var/run/docker.sock \
  -X POST \
  "http://localhost/v1.30/networks/create" \
  -H "Content-Type: application/json" \
  -d '{invalid json'
```

```
&gt; POST /v1.30/networks/create HTTP/1.1
&gt; Host: localhost
&gt; User-Agent: curl/7.52.1
&gt; Accept: */*
&gt; Content-Type: application/json
&gt; Content-Length: 13
&gt;
* upload completely sent off: 13 out of 13 bytes
&lt; HTTP/1.1 400 Bad Request
&lt; Api-Version: 1.40
&lt; Content-Type: application/json
&lt; Docker-Experimental: false
&lt; Ostype: linux
&lt; Server: Docker/dev (linux)
&lt; Date: Mon, 05 Nov 2018 11:57:15 GMT
&lt; Content-Length: 79
&lt;
{"message":"invalid character 'i' looking for beginning of object key string"}
```

Empty request:

```bash
curl -v \
  --unix-socket /var/run/docker.sock \
  -X POST \
  "http://localhost/v1.30/networks/create" \
  -H "Content-Type: application/json"
```

```
&gt; POST /v1.30/networks/create HTTP/1.1
&gt; Host: localhost
&gt; User-Agent: curl/7.52.1
&gt; Accept: */*
&gt; Content-Type: application/json
&gt;
&lt; HTTP/1.1 400 Bad Request
&lt; Api-Version: 1.40
&lt; Content-Type: application/json
&lt; Docker-Experimental: false
&lt; Ostype: linux
&lt; Server: Docker/dev (linux)
&lt; Date: Mon, 05 Nov 2018 11:59:22 GMT
&lt; Content-Length: 49
&lt;
{"message":"got EOF while reading request body"}
```

Signed-off-by: Sebastiaan van Stijn &lt;github@gone.nl&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>Switch from x/net/context -&gt; context</title>
<updated>2018-04-23T20:52:44+00:00</updated>
<author>
<name>Kir Kolyshkin</name>
<email>kolyshkin@gmail.com</email>
</author>
<published>2018-04-19T22:30:59+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/docker.git/commit/?id=7d62e40f7e4f3c17d229a7687d6fcca5448de813'/>
<id>7d62e40f7e4f3c17d229a7687d6fcca5448de813</id>
<content type='text'>
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 &lt;kolyshkin@gmail.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
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 &lt;kolyshkin@gmail.com&gt;
</pre>
</div>
</content>
</entry>
</feed>
