[DavResource] Propagate (permanent) redirects to caller instead of only updating `location` internally

Open
#209 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
5/5
Estimated time
Over a week
Newbie friendliness
42/100
Issue type
Feature
Clarity
Mostly clear
Activity status
Quiet
Tech stack
kotlin
Domain
api, networking

Research direction

Start at DavResource.location and followRedirects, then trace how the listed Flow-returning methods build and collect requests. Decide how permanent redirects should be reported to callers without silently mutating shared resource state, and verify that flows built before collection retain the intended location.

Written by the indexing model from the issue text.

Description

DavResource.location is mutated in place by followRedirects whenever the server sends a redirect. Since Flow-returning methods (propfind, proppatch, search, reportChanges, addressbookQuery, multiget, calendarQuery) build their request lazily, building several flows off one DavResource before collecting any of them can race: collecting one flow first can redirect and mutate location, so a different flow built earlier but collected later ends up using the already-redirected location instead of the one in effect when it was built.

One possible approach: introduce a redirect policy (e.g. a RedirectPolicy/callback parameter) that, on a permanent redirect (301/308), reports the new URL back to the caller instead of only updating internal state -- so the caller can decide how/whether to update its own stored URL for this resource, rather than dav4jvm silently mutating shared instance state that concurrent/out-of-order flow collection can race on.

Currently documented as an accepted, known limitation on DavResource.location's KDoc.

Dominant language
Kotlin
Stars
104
Forks
23
Avg merge
2h 22m
Merged PRs (30d)
5

Getting set up

This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from bitfireAT/dav4jvm

All issues in bitfireAT/dav4jvm

Similar issues

More Kotlin issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.