Sean-Walker0 opened a new pull request, #8033: URL: https://github.com/apache/shenyu/pull/8033
Fixes #7816. Supersedes #7820 (approved, but it conflicted with master after #7857 moved the selection/forwarding into `forwardSelected` with canary routing — this is the same fix rebased onto that structure, as requested in the review follow-up). ## Modifications A positive divide rule `requestMaxSize` was only compared against the `Content-Length` header. Chunked or unknown-length requests report `-1`, so the comparison succeeded without examining a single body byte — oversized streaming bodies were forwarded. For unknown-length requests the limit is enforced on the actual bytes: the request is decorated with a counting body that **resets per subscription** (`Flux.defer`) and aborts the stream with **`ResponseStatusException(PAYLOAD_TOO_LARGE)`** (which `GlobalErrorHandler` already honours) once the forwarded size exceeds the maximum. The known-length fast path is unchanged; the decorated exchange is threaded through the `forwardSelected` call so canary selection, attributes and circuit-breaker recording all operate on it. ## Verifying this change - [x] `doExecuteRejectsChunkedBodyExceedingRequestMaxSize` — 2-byte chunked body under a 1-byte limit; the downstream drains the body and the stream must abort with `ResponseStatusException` carrying `PAYLOAD_TOO_LARGE`. Red on the un-fixed code (verified by temporarily bypassing the decorator), green after. - [x] `./mvnw -pl shenyu-plugin/shenyu-plugin-proxy/shenyu-plugin-divide -am test -B` — full module 103/103 green (all canary/circuit-breaker suites from #7857 included), checkstyle clean. ## Notes - Addresses every point from the #7820 review (413 status, per-subscription counter, javadoc, typed assertions) on the new master structure. - Orthogonality: no open PR modifies `DividePlugin` on top of current master (the #7857 refactor is already merged here). Make sure that: - [x] You have read the [contribution guidelines](https://shenyu.apache.org/community/contributor-guide). - [x] You submit test cases (unit or integration tests) that back your changes. - [x] Your local test passed `./mvnw clean install -Dmaven.javadoc.skip=true` (module-scoped: `shenyu-plugin-divide` with `-am`, 103 tests + checkstyle green). -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
