Repository navigation
Commit 8bf370d
authored
[Core] Honour Expect: 100-continue in the Vert.x HTTP client (#50312)
* Honour Expect: 100-continue in the Vert.x HTTP client
sendBody always wrote the headers and the body together, so a request
carrying Expect: 100-continue behaved exactly like one without it and the
service had no opportunity to reject it before receiving the body.
Vert.x already exposes the two pieces needed. When the header is present,
send the head and write the body from continueHandler; otherwise keep the
existing behaviour. The body writing is now shared by both paths, so this
covers in-memory and streaming bodies alike.
Adds wire level tests that drive the client against a socket which delays
its 100 Continue, asserting that no body bytes arrive before the response
and that the full body arrives after it.
* Avoid the deprecated URL constructor in the test
The core modules compile with -Werror, and URL(String) is deprecated as
of Java 20, so the test failed to compile on the JDK 25 build agents.
* Address review feedback
Send the body after a one second fallback if the service never answers
the expectation, so a server that ignores it cannot stall the request
until the response timeout. The body is guarded so it is written once
whether the interim response or the fallback comes first, and the timer
is cancelled on continue.
Expect is a comma separated list and values may carry whitespace, so
compare each expectation rather than the header as a whole.
The test server now reads for the whole settle window rather than taking
an available() snapshot after a sleep. Adds cases for the header spelling
variants and for a service that ignores the expectation entirely.
* Do not write the body once the exchange is terminal
The fallback was cancelled only from continueHandler, so a service that
rejected the headers with a final status left the timer armed. It would
then write onto a finished exchange, and for a streaming body would
subscribe the source needlessly.
Cancel the fallback and claim the write when the response future reaches
any terminal state, so neither the timer nor a late interim response can
send the body afterwards. Adds a regression test for a service that
answers the headers with 401 and never reads the body.1 parent fbeb1a7 commit 8bf370d
3 files changed
Lines changed: 386 additions & 17 deletions
File tree
- sdk/core/azure-core-http-vertx
- src
- main/java/com/azure/core/http/vertx
- test/java/com/azure/core/http/vertx
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
6 | 11 | | |
7 | 12 | | |
8 | 13 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
26 | 26 | | |
27 | 27 | | |
28 | 28 | | |
| 29 | + | |
29 | 30 | | |
30 | 31 | | |
31 | 32 | | |
| |||
39 | 40 | | |
40 | 41 | | |
41 | 42 | | |
| 43 | + | |
42 | 44 | | |
43 | 45 | | |
44 | 46 | | |
| |||
49 | 51 | | |
50 | 52 | | |
51 | 53 | | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
52 | 58 | | |
53 | 59 | | |
54 | 60 | | |
| |||
183 | 189 | | |
184 | 190 | | |
185 | 191 | | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
186 | 230 | | |
187 | | - | |
188 | | - | |
189 | | - | |
190 | | - | |
191 | | - | |
192 | | - | |
193 | | - | |
194 | | - | |
195 | | - | |
196 | | - | |
197 | | - | |
198 | | - | |
199 | | - | |
200 | | - | |
201 | | - | |
202 | | - | |
203 | | - | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
204 | 247 | | |
205 | 248 | | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
| 266 | + | |
| 267 | + | |
| 268 | + | |
| 269 | + | |
| 270 | + | |
| 271 | + | |
| 272 | + | |
| 273 | + | |
| 274 | + | |
206 | 275 | | |
207 | 276 | | |
208 | 277 | | |
| |||
0 commit comments