Skip to content

fix(opds): bound requests, blocking jobs and download streams - #183

Merged
phildenhoff merged 1 commit into
mainfrom
opds-refresh-hardening
Oct 22, 2026
Merged

phildenhoff merged 1 commit into
mainfrom
opds-refresh-hardening

Conversation

@phildenhoff

@phildenhoff phildenhoff commented Oct 20, 2026 •

Copy link
Copy Markdown
Member

Replaces #154. Retains the original implementation's author credit; the legacy native stack prevents retargeting the original PR.

Bound catalog resource use across every listener without interrupting slow book downloads.

  • Add a shared 64-request pool retained through response-body completion/disconnect, a separate 64-slot blocking-work pool, a 16 KiB body cap (including chunked bodies), and 30-second feed deadlines.
  • Keep blocking-work permits inside jobs so cancelling a timed-out waiter cannot admit an unbounded queue. Retain streaming-worker permits until the worker finishes.
  • Return 503 with Retry-After on overload and distinguish permission-denied binds from occupied ports.
  • Preserve current constant-time authentication, exponential backoff and live credential swaps. The old Argon2/cache changes and one-time-password UI copy are obsolete and omitted.

Tests cover shared admission/body lifetime, blocking-job cancellation, oversized declared/chunked bodies, slow successful asset responses, permission errors and HTTP traversal attempts. Downloads have no feed deadline. These middleware bounds start after headers; slow-header/accepted-connection limits remain outside this implementation.

Stack: #183 → #184. #185, #181 and #182 are merged. #183 targets main.

Validation after rebasing onto merged #182: runtime/server tests, bun lint, bun format:check, and bun run typecheck passed. CI is running on the updated head.

Known catalog follow-ups from #182 remain separate: return facet identity and data atomically during desktop library switches; advertise root start/up links as navigation feeds. This PR bounds resource use and does not change those catalog semantics.

@phildenhoff
phildenhoff force-pushed the opds-refresh-hardening branch from c812389 to 1442f0d Compare October 21, 2026 03:33
@phildenhoff
phildenhoff force-pushed the opds-refresh-catalog branch 2 times, most recently from 43a8efa to 40f58a1 Compare October 21, 2026 05:02
@phildenhoff
phildenhoff force-pushed the opds-refresh-hardening branch from 1442f0d to 9183e0c Compare October 21, 2026 05:02
@phildenhoff
phildenhoff force-pushed the opds-refresh-hardening branch from 9183e0c to 8b400d2 Compare October 21, 2026 05:04
@phildenhoff
phildenhoff force-pushed the opds-refresh-hardening branch from 8b400d2 to 01ae62f Compare October 21, 2026 05:16
@phildenhoff
phildenhoff force-pushed the opds-refresh-hardening branch from 01ae62f to 4a92afe Compare October 21, 2026 07:39
Base automatically changed from opds-refresh-catalog to main October 22, 2026 01:14
@phildenhoff
phildenhoff force-pushed the opds-refresh-hardening branch from 4a92afe to 910db29 Compare October 22, 2026 01:16
@github-actions

Copy link
Copy Markdown

libcalibre Test Coverage Report

Overall coverage: 84.79%

📊 Download HTML Report

Coverage breakdown available in the artifacts.

@phildenhoff
phildenhoff marked this pull request as ready for review October 22, 2026 01:22
@phildenhoff
phildenhoff enabled auto-merge October 22, 2026 01:22
@phildenhoff
phildenhoff merged commit 682bbe5 into main Oct 22, 2026
7 checks passed
@phildenhoff
phildenhoff deleted the opds-refresh-hardening branch October 22, 2026 01:25
@linear-code

linear-code Bot commented Oct 26, 2026 •

Copy link
Copy Markdown
Contributor

CDL-26

CDL-27

CDL-20

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant