Skip to content

PushRegistrationManager: fix repeated sending of requests#2082

Merged
rfc2822 merged 2 commits intomainfrom
2073-push-subscription-registration-doesnt-work-the-input-element-to-parse-is-empty
Mar 18, 2026
Merged

PushRegistrationManager: fix repeated sending of requests#2082
rfc2822 merged 2 commits intomainfrom
2073-push-subscription-registration-doesnt-work-the-input-element-to-parse-is-empty

Conversation

@rfc2822
Copy link
Member

@rfc2822 rfc2822 commented Mar 17, 2026

See bitfireAT/dav4jvm#156 first

Purpose

This PR updates the PushRegistrationManager to use TextContent instead of ByteReadChannel for POST requests, addressing issue #2073.

Short description

  • Replaced ByteReadChannel with TextContent in PushRegistrationManager.
  • Updated the bitfire-dav4jvm dependency to commit 30472e34d6.

Note: dav4jvm commit ID will be updated to latest main before merging.

Checklist

  • The PR has a proper title, description and label.
  • I have self-reviewed the PR.
  • I have added documentation to complex functions and functions that can be used by other modules.
  • I have added reasonable tests or consciously decided to not add tests.

…loses #2073)

* Replace ByteReadChannel with TextContent in PushRegistrationManager
* Update bitfire-dav4jvm dependency to 30472e34d6
@rfc2822 rfc2822 self-assigned this Mar 17, 2026
@rfc2822 rfc2822 changed the title Update PushRegistrationManager POST request handling PushRegistrationManager: fix repeated sending of requests Mar 17, 2026
@rfc2822 rfc2822 added pr-bugfix Fixes something that isn't working (only used for PRs) push Related to WebDAV-Push dependencies Pull requests that update a dependency file labels Mar 17, 2026
@rfc2822 rfc2822 marked this pull request as ready for review March 18, 2026 15:15
@rfc2822 rfc2822 requested a review from a team as a code owner March 18, 2026 15:15
@rfc2822 rfc2822 requested a review from ArnyminerZ March 18, 2026 15:15
Copy link
Member

@ArnyminerZ ArnyminerZ left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't fully 100% understand why this fixes the issue, but makes sense I guess. Feel free to merge.

@rfc2822
Copy link
Member Author

rfc2822 commented Mar 18, 2026

I don't fully 100% understand why this fixes the issue, but makes sense I guess. Feel free to merge.

👍🏻 In short:

content = { ByteReadChannel(writer.toString()) } only looks as if it would create a ByteReadChannel for every request, but actually dav4jvm calls the content() and then feeds a single ByteReadChannel to Ktor. And by definition, ByteReadChannels are one-shot, so they only work if Ktor is sending only one request.

As soon as it has to repeat the request for whatever reason (authentication required, redirect, retry on timeout, whatever), it sends an empty request instead (because the ByteReadChannel is already consumed).

Using OutgoingContent guarantees that everything is as needed by Ktor.

@rfc2822 rfc2822 merged commit 309687e into main Mar 18, 2026
2 checks passed
@rfc2822 rfc2822 deleted the 2073-push-subscription-registration-doesnt-work-the-input-element-to-parse-is-empty branch March 18, 2026 15:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

dependencies Pull requests that update a dependency file pr-bugfix Fixes something that isn't working (only used for PRs) push Related to WebDAV-Push

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Push subscription registration doesn't work (The input element to parse is empty.)

2 participants