Commit 90084e7
committed
fix(sandbox): relay WebSocket frames after HTTP 101 Switching Protocols
The L7 REST proxy treats 101 Switching Protocols as a generic 1xx
informational response via is_bodiless_response(), forwarding the
headers and returning to the HTTP parsing loop. After a 101, the
connection has been upgraded (e.g. to WebSocket) and subsequent bytes
are protocol frames, not HTTP requests. The relay loop either blocks
or silently drops them.
This patch:
- Adds RelayOutcome::Upgraded variant to signal protocol upgrades
- Detects 101 responses before the generic 1xx handler in
relay_response(), capturing any overflow bytes read past the headers
- Switches relay_rest() and relay_passthrough_with_credentials() to
raw bidirectional TCP copy (tokio::io::copy_bidirectional) after
receiving an Upgraded outcome
- Adds a test verifying 101 response handling and overflow capture
This enables WebSocket connections (OpenClaw node meshes, Discord/Slack
bots) to work from inside fully sandboxed environments.
Fixes: #652
Related: NVIDIA/NemoClaw#409
Signed-off-by: David Peden <davidpeden3@gmail.com>1 parent 2538bea commit 90084e7
File tree
3 files changed
+179
-38
lines changed- crates/openshell-sandbox/src/l7
3 files changed
+179
-38
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
14 | 14 | | |
15 | 15 | | |
16 | 16 | | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
17 | 32 | | |
18 | 33 | | |
19 | 34 | | |
| |||
57 | 72 | | |
58 | 73 | | |
59 | 74 | | |
60 | | - | |
61 | | - | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
62 | 78 | | |
63 | 79 | | |
64 | 80 | | |
65 | 81 | | |
66 | 82 | | |
67 | | - | |
| 83 | + | |
68 | 84 | | |
69 | 85 | | |
70 | 86 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
10 | | - | |
| 10 | + | |
11 | 11 | | |
12 | 12 | | |
13 | 13 | | |
14 | 14 | | |
15 | | - | |
| 15 | + | |
16 | 16 | | |
17 | 17 | | |
18 | 18 | | |
| |||
136 | 136 | | |
137 | 137 | | |
138 | 138 | | |
139 | | - | |
| 139 | + | |
140 | 140 | | |
141 | 141 | | |
142 | 142 | | |
143 | 143 | | |
144 | 144 | | |
145 | 145 | | |
146 | | - | |
147 | | - | |
148 | | - | |
149 | | - | |
150 | | - | |
151 | | - | |
152 | | - | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
153 | 175 | | |
154 | 176 | | |
155 | 177 | | |
| |||
281 | 303 | | |
282 | 304 | | |
283 | 305 | | |
284 | | - | |
| 306 | + | |
285 | 307 | | |
286 | 308 | | |
287 | 309 | | |
288 | | - | |
289 | | - | |
| 310 | + | |
| 311 | + | |
| 312 | + | |
| 313 | + | |
| 314 | + | |
| 315 | + | |
| 316 | + | |
| 317 | + | |
| 318 | + | |
| 319 | + | |
| 320 | + | |
| 321 | + | |
| 322 | + | |
| 323 | + | |
| 324 | + | |
| 325 | + | |
| 326 | + | |
| 327 | + | |
| 328 | + | |
290 | 329 | | |
291 | 330 | | |
292 | 331 | | |
| |||
0 commit comments