Commit 359ab60
committed
Keep re-authorization on its own request's protocol version
Releasing context.lock before the protected request is yielded let a second
request restamp the shared context.protocol_version while the first was in
flight. The first request's 401 or 403 re-authorization then ran on the other
request's MCP-Protocol-Version, which decides whether the resource parameter is
sent. Holding the lock across the yield used to hide this.
Read the header into a local once, and restamp context.protocol_version from it
inside the 401 and 403 blocks after the lock is re-acquired. Every read of
context.protocol_version happens under the lock in one of those regions, so this
needs no new parameter on the token-request helpers.
Also wrap the concurrency test's call_done.wait() in anyio.fail_after(5) so a
failure in the sibling task fails fast instead of hanging.1 parent c3c6e59 commit 359ab60
2 files changed
Lines changed: 75 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
579 | 579 | | |
580 | 580 | | |
581 | 581 | | |
| 582 | + | |
| 583 | + | |
| 584 | + | |
582 | 585 | | |
583 | 586 | | |
584 | 587 | | |
585 | 588 | | |
586 | | - | |
587 | | - | |
| 589 | + | |
588 | 590 | | |
589 | 591 | | |
590 | 592 | | |
| |||
605 | 607 | | |
606 | 608 | | |
607 | 609 | | |
| 610 | + | |
| 611 | + | |
| 612 | + | |
| 613 | + | |
608 | 614 | | |
609 | 615 | | |
610 | 616 | | |
| |||
759 | 765 | | |
760 | 766 | | |
761 | 767 | | |
| 768 | + | |
| 769 | + | |
762 | 770 | | |
763 | 771 | | |
764 | 772 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3278 | 3278 | | |
3279 | 3279 | | |
3280 | 3280 | | |
3281 | | - | |
| 3281 | + | |
| 3282 | + | |
3282 | 3283 | | |
3283 | 3284 | | |
3284 | 3285 | | |
| |||
3295 | 3296 | | |
3296 | 3297 | | |
3297 | 3298 | | |
| 3299 | + | |
| 3300 | + | |
| 3301 | + | |
| 3302 | + | |
| 3303 | + | |
| 3304 | + | |
| 3305 | + | |
| 3306 | + | |
| 3307 | + | |
| 3308 | + | |
| 3309 | + | |
| 3310 | + | |
| 3311 | + | |
| 3312 | + | |
| 3313 | + | |
| 3314 | + | |
| 3315 | + | |
| 3316 | + | |
| 3317 | + | |
| 3318 | + | |
| 3319 | + | |
| 3320 | + | |
| 3321 | + | |
| 3322 | + | |
| 3323 | + | |
| 3324 | + | |
| 3325 | + | |
| 3326 | + | |
| 3327 | + | |
| 3328 | + | |
| 3329 | + | |
| 3330 | + | |
| 3331 | + | |
| 3332 | + | |
| 3333 | + | |
| 3334 | + | |
| 3335 | + | |
| 3336 | + | |
| 3337 | + | |
| 3338 | + | |
| 3339 | + | |
| 3340 | + | |
| 3341 | + | |
| 3342 | + | |
| 3343 | + | |
| 3344 | + | |
| 3345 | + | |
| 3346 | + | |
| 3347 | + | |
| 3348 | + | |
| 3349 | + | |
| 3350 | + | |
| 3351 | + | |
| 3352 | + | |
| 3353 | + | |
| 3354 | + | |
| 3355 | + | |
| 3356 | + | |
| 3357 | + | |
| 3358 | + | |
| 3359 | + | |
| 3360 | + | |
| 3361 | + | |
0 commit comments