Signed-off-by: Jean-Tiare Le Bigot <jt@yadutaf.fr>
| ... | ... |
@@ -390,8 +390,10 @@ Get stdout and stderr logs from the container ``id`` |
| 390 | 390 |
|
| 391 | 391 |
**Example response**: |
| 392 | 392 |
|
| 393 |
- HTTP/1.1 200 OK |
|
| 393 |
+ HTTP/1.1 101 UPGRADED |
|
| 394 | 394 |
Content-Type: application/vnd.docker.raw-stream |
| 395 |
+ Connection: Upgrade |
|
| 396 |
+ Upgrade: tcp |
|
| 395 | 397 |
|
| 396 | 398 |
{{ STREAM }}
|
| 397 | 399 |
|
| ... | ... |
@@ -406,7 +408,8 @@ Query Parameters: |
| 406 | 406 |
|
| 407 | 407 |
Status Codes: |
| 408 | 408 |
|
| 409 |
-- **200** – no error |
|
| 409 |
+- **101** – no error, hints proxy about hijacking |
|
| 410 |
+- **200** – no error, no upgrade header found |
|
| 410 | 411 |
- **404** – no such container |
| 411 | 412 |
- **500** – server error |
| 412 | 413 |
|
| ... | ... |
@@ -641,8 +644,10 @@ Attach to the container `id` |
| 641 | 641 |
|
| 642 | 642 |
**Example response**: |
| 643 | 643 |
|
| 644 |
- HTTP/1.1 200 OK |
|
| 644 |
+ HTTP/1.1 101 UPGRADED |
|
| 645 | 645 |
Content-Type: application/vnd.docker.raw-stream |
| 646 |
+ Connection: Upgrade |
|
| 647 |
+ Upgrade: tcp |
|
| 646 | 648 |
|
| 647 | 649 |
{{ STREAM }}
|
| 648 | 650 |
|
| ... | ... |
@@ -660,7 +665,8 @@ Query Parameters: |
| 660 | 660 |
|
| 661 | 661 |
Status Codes: |
| 662 | 662 |
|
| 663 |
-- **200** – no error |
|
| 663 |
+- **101** – no error, hints proxy about hijacking |
|
| 664 |
+- **200** – no error, no upgrade header found |
|
| 664 | 665 |
- **400** – bad parameter |
| 665 | 666 |
- **404** – no such container |
| 666 | 667 |
- **500** – server error |
| ... | ... |
@@ -1739,7 +1745,18 @@ As an example, the `docker run` command line makes the following API calls: |
| 1739 | 1739 |
## 3.2 Hijacking |
| 1740 | 1740 |
|
| 1741 | 1741 |
In this version of the API, /attach, uses hijacking to transport stdin, |
| 1742 |
-stdout and stderr on the same socket. This might change in the future. |
|
| 1742 |
+stdout and stderr on the same socket. |
|
| 1743 |
+ |
|
| 1744 |
+To hint potential proxies about connection hijacking, Docker client sends |
|
| 1745 |
+connection upgrade headers similarly to websocket. |
|
| 1746 |
+ |
|
| 1747 |
+ Upgrade: tcp |
|
| 1748 |
+ Connection: Upgrade |
|
| 1749 |
+ |
|
| 1750 |
+When Docker daemon detects the `Upgrade` header, it will switch its status code |
|
| 1751 |
+from **200 OK** to **101 UPGRADED** and resend the same headers. |
|
| 1752 |
+ |
|
| 1753 |
+This might change in the future. |
|
| 1743 | 1754 |
|
| 1744 | 1755 |
## 3.3 CORS Requests |
| 1745 | 1756 |
|