<feed xmlns='http://www.w3.org/2005/Atom'>
<title>delta/docker.git/api/server/httputils, branch master</title>
<subtitle>github.com: dotcloud/docker.git
</subtitle>
<link rel='alternate' type='text/html' href='http://trove.baserock.org/cgit/delta/docker.git/'/>
<entry>
<title>chore: use http constants to replace numbers</title>
<updated>2023-02-21T15:02:56+00:00</updated>
<author>
<name>xin.li</name>
<email>xin.li@daocloud.io</email>
</author>
<published>2023-02-21T15:02:56+00:00</published>
<link rel='alternate' type='text/html' href='http://trove.baserock.org/cgit/delta/docker.git/commit/?id=a770153af09716f33dbe1093f8cb886570f8c378'/>
<id>a770153af09716f33dbe1093f8cb886570f8c378</id>
<content type='text'>
Signed-off-by: xin.li &lt;xin.li@daocloud.io&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Signed-off-by: xin.li &lt;xin.li@daocloud.io&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>api: Extract parsing reference from repo and tag</title>
<updated>2023-02-07T14:43:58+00:00</updated>
<author>
<name>Paweł Gronowski</name>
<email>pawel.gronowski@docker.com</email>
</author>
<published>2023-01-31T09:27:09+00:00</published>
<link rel='alternate' type='text/html' href='http://trove.baserock.org/cgit/delta/docker.git/commit/?id=62be425bcc72ba9377f9bde7f6f6978e6036e1b7'/>
<id>62be425bcc72ba9377f9bde7f6f6978e6036e1b7</id>
<content type='text'>
Signed-off-by: Paweł Gronowski &lt;pawel.gronowski@docker.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Signed-off-by: Paweł Gronowski &lt;pawel.gronowski@docker.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>api/server/httputils: move WriteJSON() together with ReadJSON()</title>
<updated>2022-04-11T19:37:57+00:00</updated>
<author>
<name>Sebastiaan van Stijn</name>
<email>github@gone.nl</email>
</author>
<published>2022-04-05T11:21:19+00:00</published>
<link rel='alternate' type='text/html' href='http://trove.baserock.org/cgit/delta/docker.git/commit/?id=ff5f70e55f8cd303efbaee3eafda9dfe86a3da36'/>
<id>ff5f70e55f8cd303efbaee3eafda9dfe86a3da36</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://trove.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/server/httputils: matchesContentType(): return error instead of logging</title>
<updated>2022-04-11T19:37:00+00:00</updated>
<author>
<name>Sebastiaan van Stijn</name>
<email>github@gone.nl</email>
</author>
<published>2022-04-05T09:31:27+00:00</published>
<link rel='alternate' type='text/html' href='http://trove.baserock.org/cgit/delta/docker.git/commit/?id=ef490cae4520ff1c8aa765ec9107885417a2583b'/>
<id>ef490cae4520ff1c8aa765ec9107885417a2583b</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>errdefs: move GetHTTPErrorStatusCode to api/server/httpstatus</title>
<updated>2022-03-21T11:22:39+00:00</updated>
<author>
<name>Sebastiaan van Stijn</name>
<email>github@gone.nl</email>
</author>
<published>2022-03-21T10:27:39+00:00</published>
<link rel='alternate' type='text/html' href='http://trove.baserock.org/cgit/delta/docker.git/commit/?id=e82b7b2fa00d1f30f3eabb58eaf7d74806581369'/>
<id>e82b7b2fa00d1f30f3eabb58eaf7d74806581369</id>
<content type='text'>
This reverts the changes made in 2a9c987e5a72549775ffa4dc31595ceff4f06a78, which
moved the GetHTTPErrorStatusCode() utility to the errdefs package.

While it seemed to make sense at the time to have the errdefs package provide
conversion both from HTTP status codes errdefs and the reverse, a side-effect
of the move was that the errdefs package now had a dependency on various external
modules, to handle conversio of errors coming from those sub-systems, such as;

- github.com/containerd/containerd
- github.com/docker/distribution
- google.golang.org/grpc

This patch moves the conversion from (errdef-) errors to HTTP status-codes to a
 api/server/httpstatus package, which is only used by the API server, and should
not be needed by client-code using the errdefs package.

The MakeErrorHandler() utility was moved to the API server itself, as that's the
only place it's used. While the same applies to the GetHTTPErrorStatusCode func,
I opted for keeping that in its own package for a slightly cleaner interface.

Why not move it into the api/server/httputils package?

The api/server/httputils package is also imported in the client package, which
uses the httputils.ParseForm() and httputils.HijackConnection() functions as
part of the TestTLSCloseWriter() test. While this is only used in tests, I
wanted to avoid introducing the indirect depdencencies outside of the api/server
code.

Signed-off-by: Sebastiaan van Stijn &lt;github@gone.nl&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
This reverts the changes made in 2a9c987e5a72549775ffa4dc31595ceff4f06a78, which
moved the GetHTTPErrorStatusCode() utility to the errdefs package.

While it seemed to make sense at the time to have the errdefs package provide
conversion both from HTTP status codes errdefs and the reverse, a side-effect
of the move was that the errdefs package now had a dependency on various external
modules, to handle conversio of errors coming from those sub-systems, such as;

- github.com/containerd/containerd
- github.com/docker/distribution
- google.golang.org/grpc

This patch moves the conversion from (errdef-) errors to HTTP status-codes to a
 api/server/httpstatus package, which is only used by the API server, and should
not be needed by client-code using the errdefs package.

The MakeErrorHandler() utility was moved to the API server itself, as that's the
only place it's used. While the same applies to the GetHTTPErrorStatusCode func,
I opted for keeping that in its own package for a slightly cleaner interface.

Why not move it into the api/server/httputils package?

The api/server/httputils package is also imported in the client package, which
uses the httputils.ParseForm() and httputils.HijackConnection() functions as
part of the TestTLSCloseWriter() test. While this is only used in tests, I
wanted to avoid introducing the indirect depdencencies outside of the api/server
code.

Signed-off-by: Sebastiaan van Stijn &lt;github@gone.nl&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>api/server: use constants for http methods</title>
<updated>2019-10-13T15:30:19+00:00</updated>
<author>
<name>Sebastiaan van Stijn</name>
<email>github@gone.nl</email>
</author>
<published>2019-10-12T18:40:19+00:00</published>
<link rel='alternate' type='text/html' href='http://trove.baserock.org/cgit/delta/docker.git/commit/?id=93100adb69de2338982b5c2419c4dcef61ea2ca0'/>
<id>93100adb69de2338982b5c2419c4dcef61ea2ca0</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: explicitely ignore unhandled errors</title>
<updated>2019-09-18T10:57:13+00:00</updated>
<author>
<name>Sebastiaan van Stijn</name>
<email>github@gone.nl</email>
</author>
<published>2019-08-05T15:51:22+00:00</published>
<link rel='alternate' type='text/html' href='http://trove.baserock.org/cgit/delta/docker.git/commit/?id=0507c358d9a4c0b27dd32d415621f99d0a543081'/>
<id>0507c358d9a4c0b27dd32d415621f99d0a543081</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>Move httputils error helpers to errdefs package</title>
<updated>2019-03-15T23:42:23+00:00</updated>
<author>
<name>Sebastiaan van Stijn</name>
<email>github@gone.nl</email>
</author>
<published>2019-02-09T14:53:29+00:00</published>
<link rel='alternate' type='text/html' href='http://trove.baserock.org/cgit/delta/docker.git/commit/?id=2a9c987e5a72549775ffa4dc31595ceff4f06a78'/>
<id>2a9c987e5a72549775ffa4dc31595ceff4f06a78</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>Add httputils.FromStatusCode()</title>
<updated>2019-03-15T23:39:48+00:00</updated>
<author>
<name>Sebastiaan van Stijn</name>
<email>github@gone.nl</email>
</author>
<published>2018-12-31T12:59:59+00:00</published>
<link rel='alternate' type='text/html' href='http://trove.baserock.org/cgit/delta/docker.git/commit/?id=1af30c50ca0ad81e2839ff4f2c5e70413f021d52'/>
<id>1af30c50ca0ad81e2839ff4f2c5e70413f021d52</id>
<content type='text'>
This utility allows a client to convert an API response
back to a typed error; allowing the client to perform
different actions based on the type of error, without
having to resort to string-matching the error.

Signed-off-by: Sebastiaan van Stijn &lt;github@gone.nl&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
This utility allows a client to convert an API response
back to a typed error; allowing the client to perform
different actions based on the type of error, without
having to resort to string-matching the error.

Signed-off-by: Sebastiaan van Stijn &lt;github@gone.nl&gt;
</pre>
</div>
</content>
</entry>
</feed>
