Commit b73e7ea
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 a7ebf3a commit b73e7ea
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 | |
|---|---|---|---|
| |||
13 | 13 | | |
14 | 14 | | |
15 | 15 | | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
16 | 31 | | |
17 | 32 | | |
18 | 33 | | |
| |||
54 | 69 | | |
55 | 70 | | |
56 | 71 | | |
57 | | - | |
58 | | - | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
59 | 75 | | |
60 | 76 | | |
61 | 77 | | |
62 | 78 | | |
63 | 79 | | |
64 | | - | |
| 80 | + | |
65 | 81 | | |
66 | 82 | | |
67 | 83 | | |
| |||
| 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 | | |
| |||
134 | 134 | | |
135 | 135 | | |
136 | 136 | | |
137 | | - | |
| 137 | + | |
138 | 138 | | |
139 | 139 | | |
140 | 140 | | |
141 | 141 | | |
142 | 142 | | |
143 | 143 | | |
144 | | - | |
145 | | - | |
146 | | - | |
147 | | - | |
148 | | - | |
149 | | - | |
150 | | - | |
| 144 | + | |
| 145 | + | |
| 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 | + | |
151 | 173 | | |
152 | 174 | | |
153 | 175 | | |
| |||
278 | 300 | | |
279 | 301 | | |
280 | 302 | | |
281 | | - | |
| 303 | + | |
282 | 304 | | |
283 | 305 | | |
284 | 306 | | |
285 | | - | |
286 | | - | |
| 307 | + | |
| 308 | + | |
| 309 | + | |
| 310 | + | |
| 311 | + | |
| 312 | + | |
| 313 | + | |
| 314 | + | |
| 315 | + | |
| 316 | + | |
| 317 | + | |
| 318 | + | |
| 319 | + | |
| 320 | + | |
| 321 | + | |
| 322 | + | |
| 323 | + | |
| 324 | + | |
| 325 | + | |
287 | 326 | | |
288 | 327 | | |
289 | 328 | | |
| |||
0 commit comments