> Enhances `FileServerHandler` in the jdk.httpserver module to support the > `Range` header. > > This change contains: > 1. A new constant `HTTP_RANGE_NOT_SATISFIABLE` to the `Code` to indicate > unsatisifiable ranges. > 2. `Accept-Ranges: bytes` for all file retrievals. > 3. Single `bytes` ranges, returning `206 Partial Content` with > `Content-Range`. > 4. Multiple `bytes` ranges with `multipart/byteranges`. > 5. Sorting and merging of overlapping or adjacent ranges. > > As discussed in #28021, `If-Range` support is left out of scope for this > change. > However, as required by [RFC > 9110](https://www.rfc-editor.org/rfc/rfc9110.html#section-13.1.5-8), when > `If-Range` is present, the `Range` header is ignored and the full content is > returned. > > `Range` parsing is tested in `FileServerHandlerTest`, > while `SimpleFileServerTest` tests the externally observable HTTP behavior. > > This is a rework of #28021. > The earlier PR contains the previous review discussion and feedback that > informed this version. > > --------- > - [x] I confirm that I make this contribution in accordance with the [OpenJDK > Interim AI Policy](https://openjdk.org/legal/ai).
Daisuke Yamazaki has updated the pull request with a new target base due to a merge or a rebase. The pull request now contains two commits: - Merge branch 'master' into 8355572-rw-support-http-range-header - 8355572: Support HTTP Range requests in Simple Web Server ------------- Changes: https://git.openjdk.org/jdk/pull/32266/files Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=32266&range=01 Stats: 650 lines in 5 files changed: 638 ins; 0 del; 12 mod Patch: https://git.openjdk.org/jdk/pull/32266.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/32266/head:pull/32266 PR: https://git.openjdk.org/jdk/pull/32266
