Skip to main content

Crate fast_dav_rs

Crate fast_dav_rs 

Source
Expand description

§fast-dav-rs

Crates.io Documentation CI dependency status License: LGPL v3 Coverage Quality Gate CodSpeed

fast-dav-rs is a high-performance asynchronous CalDAV/CardDAV client for Rust. It blends hyper 1.x, tokio, rustls, and streaming XML tooling so your services can discover calendars, manage events, sync addressbooks, and keep remote DAV stores in sync without re-implementing the protocol by hand.

§Why This Library?

  • CalDAV and CardDAV discovery, queries, and sync with a consistent API surface.
  • HTTP/2, connection pooling, and configurable timeouts built on hyper and tokio.
  • Automatic response decompression plus optional request compression (br, zstd, gzip).
  • Streaming XML parsing for large multistatus responses.
  • Safe conditional methods and ETag helpers for update/delete workflows.
  • Batch operations with bounded concurrency and predictable ordering.

§Stability & Maturity

This library focuses on correctness and predictable behavior across CalDAV and CardDAV servers.

  • Core discovery, CRUD, and query flows are covered by unit and e2e tests.
  • Streaming parsing and sync are stable, but server quirks still vary.
  • Compatibility feedback from real deployments is welcome.

§Roadmap

  • Documentation parity across CalDAV and CardDAV, with more recipes and examples.
  • Expanded server compatibility notes and fixtures.
  • Incremental improvements to error reporting and diagnostics.
  • API stability gated by cargo-semver-checks on every PR, with 1.0 to be declared once the remediation roadmap stabilizes.

§Versioning & Backward Compatibility

This project follows Semantic Versioning. Patch releases fix bugs, minor releases add compatible features, and major releases introduce breaking changes when needed.

§Table of Contents

§Features

§Core Features

  • CalDAV calendar discovery, queries, and event CRUD.
  • CalDAV free-busy-query reports and server-side recurrence expansion (expand, RFC 4791 §9.6-9.7).
  • CalDAV scheduling (RFC 6638): schedule endpoint discovery, outbox POST, schedule-inbox listing, schedule-tag retrieval (Schedule-Tag header + schedule-tag property), and If-Schedule-Tag-Match conditional writes.
  • CalDAV calendar proxies (calendar-proxy companion spec of RFC 6638): list delegations (list_calendar_proxies), resolve proxy group members, and grant/revoke delegations through the low-level ACL method with the typed body builder (webdav::acl::{Ace, AcePrincipal, build_acl_body}); delegate hrefs are normalized before comparison and revoke_calendar_proxy fails with Error::InvalidInput when the delegate is not a current group member. The delegation wire form is server-dependent.
  • CalDAV calendar-timezone read + write (RFC 4791 §5.2.2): per-calendar read and via CalendarInfo.timezone; set_calendar_timezone stores/removes the property via PROPPATCH.
  • CalDAV managed attachments (RFC 8607, sent in the non-IETF CalendarServer collection-targeted form): post_managed_attachment stores an attachment via ?action=attachment-add and returns its href + Cal-Managed-ID; put_managed_attachment / delete_managed_attachment update/remove it with the Cal-Managed-ID header (§5.2/§5.3); the streaming parser reads the managed-ids property into DavItem.managed_ids.
  • Client-side iCalendar validation for CalDAV writes (ValidationLevel, default Structural). CardDAV vCard writes are sent verbatim — no client-side vCard validation.
  • CardDAV addressbook discovery, queries, and contact CRUD.
  • HTTP/2 with connection pooling and automatic response decompression.
  • Streaming XML parsing for multistatus responses.
  • Item-by-item streams with constant memory: propfind_items_stream/report_items_stream (WebDAV), calendar_query_stream (CalDAV), and addressbook_query_stream (CardDAV) yield each parsed entry as it arrives, decompress on the fly, and abort the download when dropped.
  • ETag helpers and conditional methods for safe updates, with a typed 412/428 classifier (conditional_write_error) for conditional-write responses.
  • Depth-aware COPY/MOVE (copy_with_depth, move_with_depth) and an If header builder (if_header_for_lock_token) for lock-token-guarded writes.
  • Typed current-user privileges (current_user_privileges, RFC 3744 §5.4), also surfaced per calendar on CalendarInfo.privileges with the aggregate all mapped to Privilege::All.

§Advanced Features

  • WebDAV locking (RFC 4918 class 2): LOCK/UNLOCK, lock refresh via the If header, and lockdiscovery parsing (LockInfo, LockScope).
  • WebDAV-Sync (RFC 6578) for incremental sync.
  • Bounded parallelism for batch PROPFIND/REPORT operations.
  • Automatic request compression negotiation (br, zstd, gzip) with overrides.
  • Request-body builders: PROPFIND allprop/propname/prop-list helpers (RFC 4918 §9.1), a typed MkCalendarProps MKCALENDAR body (RFC 4791 §9.5), and calendar-query data limits via CalendarDataLimits (RFC 4791 §9.6.4) with the extensible CalendarQueryOptions entry point.
  • Streaming send APIs for custom workflows.
  • RFC 6764 .well-known service discovery (discover_caldav/discover_carddav). DNS SRV (§3) and TXT (§6) record lookup are deliberately excluded (lean dependency tree — no DNS resolver); callers supply the base URL, and the .well-known probes cover the RFC 6764 §5 step plus the §6 base-URL fallback.
  • Retry with exponential backoff for transient failures (429/503/504) with Retry-After support.
  • Optional tracing instrumentation behind the tracing feature (zero-cost when disabled).

§Requirements

  • Rust 2024 edition.
  • tokio runtime with the macros, rt-multi-thread, and time features.
  • Optional: Docker and Docker Compose for e2e tests.
  • The low-level APIs in some snippets in this README and the docs/ guides use hyper (HeaderMap, Method) and bytes (Bytes) directly; fast-dav-rs does not re-export them, so add them to your own Cargo.toml when you use those APIs.

§Installation

cargo add fast-dav-rs

§Quick Start

§CalDAV discovery

use fast_dav_rs::{CalDavClient, Error, Result};

#[tokio::main]
async fn main() -> Result<()> {
    let client = CalDavClient::new(
        "https://caldav.example.com/users/alice/",
        Some("alice"),
        Some("hunter2"),
    )?;

    let principal = client
        .discover_current_user_principal()
        .await?
        .ok_or_else(|| Error::other("no principal returned"))?;

    let homes = client.discover_calendar_home_set(&principal).await?;
    let home = homes.first().expect("missing calendar-home-set");

    for calendar in client.list_calendars(home).await? {
        println!("Calendar: {:?}", calendar.displayname);
    }

    Ok(())
}

§CardDAV discovery

use fast_dav_rs::{CardDavClient, Error, Result};

#[tokio::main]
async fn main() -> Result<()> {
    let client = CardDavClient::new(
        "https://carddav.example.com/users/alice/",
        Some("alice"),
        Some("hunter2"),
    )?;

    let principal = client
        .discover_current_user_principal()
        .await?
        .ok_or_else(|| Error::other("no principal returned"))?;

    let homes = client.discover_addressbook_home_set(&principal).await?;
    let home = homes.first().expect("missing addressbook-home-set");

    for book in client.list_addressbooks(home).await? {
        println!("Addressbook: {:?}", book.displayname);
    }

    Ok(())
}

§Discovery order and principal-404 hardening

discover_current_user_principal probes the authenticated root URL directly — a single credentialed PROPFIND, and the primary discovery step. The RFC 6764 .well-known probes (discover_caldav / discover_carddav) are the fallback for servers that host DAV under a context path; some providers answer .well-known unreliably.

RFC 6764’s DNS-based discovery steps are deliberately not implemented: SRV record lookup (§3) and TXT record lookup (§6) are excluded to keep the dependency tree lean (no DNS resolver crate). Callers resolve the base URL themselves; the .well-known probes cover the RFC 6764 §5 step and implement the §6 base-URL fallback (404 on .well-known returns the base URL).

If authentication succeeds but the principal PROPFIND returns 404 (the server never answers 401), discovery fails with Error::PrincipalNotFound. On some providers this is the signature of a wrong username form — e.g. an email address where the provider expects an internal short account ID:

use fast_dav_rs::CalDavClient;
use fast_dav_rs::Error;

async fn retry_guidance(client: &CalDavClient) -> fast_dav_rs::Result<()> {
match client.discover_current_user_principal().await {
    Err(Error::PrincipalNotFound { url, .. }) => {
        eprintln!(
            "auth OK but no principal at {url}: retry with the provider's \
             canonical account ID"
        );
    }
    other => {
        other?;
    }
}
Ok(())
}

The OPTIONS DAV: compliance header (RFC 4918 §10.1) is available as a typed view: WebDavClient::capabilities parses the header into DavCapabilities, and DavCapabilities::compliance() maps it to DavCompliance values (One, Two (locking), Three, AccessControl, CalendarAccess, Addressbook, ExtendedMkcol, CalendarProxy), with calendarserver-* vendor tokens and unknown extensions passing through as DavCompliance::Other.

§Current-user privileges (RFC 3744 §5.4)

current_user_privileges (all clients) PROPFINDs the current-user-privilege-set property and returns the typed Privilege set the authenticated user holds on a path. The set is advisory — servers may grant privileges through inherited or aggregated ACEs, and an absent privilege does not prove an operation will be denied. Unrecognized privilege elements surface as Privilege::Other(name):

use fast_dav_rs::CalDavClient;
use fast_dav_rs::webdav::Privilege;

async fn check_privileges(client: &CalDavClient) -> fast_dav_rs::Result<()> {
let privileges = client.current_user_privileges("calendars/alice/").await?;
if privileges.contains(&Privilege::WriteContent) {
    // safe to offer editing in the UI
}
// `#[non_exhaustive]`: always keep a wildcard arm when matching.
for privilege in &privileges {
    match privilege {
        Privilege::Read => println!("read"),
        Privilege::Other(name) => println!("server-specific: {name}"),
        _ => println!("other"),
    }
}
Ok(())
}

§Conditional writes: typed 412/428, If headers, Depth on COPY/MOVE

The conditional write methods (put_if_match, delete_if_match, put_if_schedule_tag, …) return the raw response for any status by design. Apply the conditional_write_error classifier to get typed errors:

StatusTyped errorMeaning
2xx—the write happened
412Error::PreconditionFailed { operation }the validator (ETag/lock/schedule-tag) did not match; reload the item and retry
428Error::PreconditionRequired { operation }the server requires a conditional header on this write (RFC 6585 §3)
otherError::UnexpectedStatus { operation, status }unexpected server status
use fast_dav_rs::Operation;
use fast_dav_rs::webdav::conditional_write_error;

async fn guarded_delete(
    client: &fast_dav_rs::WebDavClient,
    path: &str,
    etag: &str,
) -> fast_dav_rs::Result<()> {
    let resp = client.delete_if_match(path, etag).await?;
    match conditional_write_error(Operation::DeleteIfMatch, &resp) {
        Ok(()) => Ok(()),
        // Stale validator: reload the item, re-apply the change, retry.
        Err(fast_dav_rs::Error::PreconditionFailed { .. }) => Ok(()),
        Err(other) => Err(other),
    }
}

Writes issued while a WebDAV lock is held must carry the token in an If header (RFC 4918 §10.4) — if_header_for_lock_token(&lock.token) builds the parenthesized Coded-URL form (<lock-token>), validated against the Coded-URL rules before anything is sent.

COPY/MOVE gain explicit depth control: copy_with_depth sends the Depth header verbatim (Depth::Zero = shallow copy, RFC 4918 §9.8.3), and move_with_depth accepts Depth::Zero only (RFC 4918 §9.9.3 — MOVE acts as infinity for collections; a Depth header is only meaningful as 0 for a non-collection move).

list_calendars also requests current-user-privilege-set and surfaces the granted set on the new CalendarInfo.privileges field (typed Privilege, empty when the server omits the property; the aggregate all maps to Privilege::All).

§Documentation

Deep-dives live in the docs/ directory (they are also part of the crate docs on docs.rs, and their Rust snippets are run by the doc tests):

§Configuration

§Request compression

fn main() -> fast_dav_rs::Result<()> {
use fast_dav_rs::{CalDavClient, ContentEncoding};
use fast_dav_rs::webdav::RequestCompressionMode;

let mut client = CalDavClient::new("https://caldav.example.com/users/alice/", None, None)?;
client.set_request_compression_mode(RequestCompressionMode::Force(ContentEncoding::Gzip));
client.set_request_compression_mode(RequestCompressionMode::Auto);
client.set_request_compression_mode(RequestCompressionMode::Disabled);
Ok(())
}

In Auto mode the client sends one extra compressed PROPFIND probe per client instance until the server’s answer is cached (clones share the cache). Short-lived clients — e.g. one built per request in serverless setups — pay that probe every time; prefer reusing a client, or pin Disabled/Force to skip the probe. A transient probe failure is not cached: the current request proceeds uncompressed and the next request re-probes. Re-selecting Auto with set_request_compression_mode resets the cached answer.

§Per-request timeouts

The low-level send and send_stream methods accept an optional per_req_timeout: Option<Duration> so you can override the default timeout for specific requests.

§Batch concurrency

propfind_many and report_many accept a max_concurrency parameter to bound the number of in-flight requests while preserving input order in the result list.

CalDavClient::calendar_multiget_many applies the same machinery to calendar-multiget: the href list is chunked into batch_size slices, one REPORT is issued per chunk with at most max_concurrency in flight, and results come back as Vec<BatchItem<CalendarObject>> ordered by chunk. A failed chunk is a single error BatchItem; sibling chunks are unaffected. Every BatchItem carries the request hrefs of its batch in hrefs, so a failed chunk is attributable to the hrefs to re-fetch. Multiget REPORTs are sent with Depth: 0 (RFC 4791 §7.9, RFC 6352 §8.7). Pick batch_size (e.g. 100 hrefs per REPORT) and max_concurrency (e.g. 4) to match your server’s limits.

CardDavClient::addressbook_multiget_many mirrors those semantics for addressbook-multiget and returns Vec<BatchItem<AddressObject>> (no expand parameter). Both batched multigets share one engine, so they behave identically apart from the object type.

§missing_hrefs reconciliation

Every BatchItem from a batched multiget also carries missing_hrefs: the requested hrefs the server did not answer with a <D:response> element (exact href string comparison — a compliant server echoes every requested href, possibly with an error status, RFC 4791 §9.6.1 / RFC 6352 §8.7). A non-empty value signals a non-compliant server; the answered objects are still delivered. missing_hrefs is empty for non-multiget batch operations (propfind_many, report_many) and for batches that failed as a whole — their hrefs already name everything to re-fetch.

§Empty hrefs are dropped before chunking

Both batched multigets filter empty hrefs out of the input before chunking: they never reach a REPORT and are not recorded in any BatchItem::hrefs. An input with no non-empty href yields Ok(Vec::new()) without any network I/O.

Note on exact comparison: some servers percent-encode characters such as @ in the hrefs they echo (a@b.ics comes back a%40b.ics). If you construct hrefs yourself instead of using the hrefs the server published (e.g. from sync_collection or PROPFIND responses), compare against that server’s echo behavior — missing_hrefs uses exact string matching.

§Security

Basic credentials are sent as an Authorization: Basic header on every request. Base64 is an encoding, not encryption: over plain http:// your username and password travel effectively in cleartext and can be read by anyone on the network path. The connector intentionally accepts both http:// and https:// (plain HTTP is convenient for isolated test environments such as the bundled Docker setup), so the library does not reject http:// at runtime — always use https:// outside isolated test environments.

The same applies to Bearer tokens (static or resolved through a TokenProvider): they are sent as an Authorization: Bearer header on every request and must never travel over plain http:// in production. Token material — access tokens, refresh tokens, client secrets — never appears in the crate’s Debug output, error messages, or tracing events; errors about failed token refreshes carry only a typed reason and an HTTP status.

For deployments that know they never talk plain HTTP, the builder offers an opt-in require HTTPS guard (issue #200). With require_https(true) a plain http:// base URL is rejected at construction with Error::InvalidConfig, and any redirect whose target is not https:// — including an https→http downgrade during request handling or .well-known service discovery — fails the request with Error::InvalidInput instead of being followed:

use fast_dav_rs::WebDavClient;
let client = WebDavClient::builder("https://dav.example.com/")
    .require_https(true)
    .build()?;
Ok::<(), fast_dav_rs::Error>(())

The flag is additive and off by default: without it, behavior is unchanged (plain http:// base URLs remain accepted for isolated test environments, and an https→http downgrade redirect is never followed — the 3xx response is returned as-is; with require_https(true) that downgrade is rejected with Error::InvalidInput instead).

§Observability

The client optionally emits structured diagnostics through the tracing ecosystem standard. Enable it with a feature flag:

cargo add fast-dav-rs --features tracing

Everything (WebDAV, CalDAV, and CardDAV) is instrumented in the shared request pipeline, so one feature flag covers all three clients:

LevelEvents
DEBUGRequest start (method, uri) and finish (method, uri, status, duration_us) per attempt; each redirect hop (source, target, status); transient retries (status, delay_ms, attempt number); exhausted retry budget; per-request timeout hit (limit_ms); compression-probe outcome and negotiated encoding
TRACEDecompressed response body size (bytes) after the aggregated send path

The feature is disabled by default and zero-cost when off: no tracing dependency is pulled in and no instrumentation code is compiled into your binary. When enabled, no subscriber is installed for you — plug in your own (tracing-subscriber’s fmt() layer, OpenTelemetry, …):

ⓘ
tracing_subscriber::fmt().with_max_level(tracing::Level::DEBUG).init();

§Usage Examples

§CalDAV event CRUD

use fast_dav_rs::{CalDavClient, Result};
use bytes::Bytes;

#[tokio::main]
async fn main() -> Result<()> {
    let client = CalDavClient::new("https://caldav.example.com/users/alice/", None, None)?;
    let calendar_path = "calendars/alice/work/";

    let event_path = format!("{calendar_path}kickoff.ics");
    let create = Bytes::from("BEGIN:VCALENDAR\nVERSION:2.0\nPRODID:-//example//EN\nBEGIN:VEVENT\nUID:kickoff\nEND:VEVENT\nEND:VCALENDAR\n");
    client.put_if_none_match(&event_path, create).await?;

    let events = client
        .calendar_query_timerange(calendar_path, "VEVENT", None, None, true, None)
        .await?;

    if let Some(event) = events.first() {
        if let Some(etag) = &event.etag {
            let updated = Bytes::from("BEGIN:VCALENDAR\nVERSION:2.0\nPRODID:-//example//EN\nBEGIN:VEVENT\nUID:kickoff\nSUMMARY:Updated\nEND:VEVENT\nEND:VCALENDAR\n");
            client.put_if_match(&event.href, updated, etag).await?;
        }
    }

    Ok(())
}

§Timezones (RFC 4791 §5.2.2)

CalDavClient::calendar_timezone(path) reads a calendar’s calendar-timezone property (Depth: 0 PROPFIND) and returns the stored iCalendar object — an ICS document with exactly one VTIMEZONE component — verbatim as Option<String> (None when the server does not store it). The same value is surfaced per calendar in CalendarInfo.timezone by list_calendars.

Pair the returned object with a dedicated iCalendar parser (e.g. icalendar) to derive the UTC offset rules; this library does not interpret VTIMEZONE data — neither on read nor on write.

CalDavClient::set_calendar_timezone(path, vtimezone) writes the property with a Depth: 0 PROPPATCH (RFC 4791 §5.2.2): Some(vtimezone) sends a <D:set> with the VTIMEZONE iCalendar object verbatim (XML-escaped), None sends a <D:remove>. A blank value is rejected as Error::InvalidInput before any network I/O. Because servers commonly accept the request but reject the property, the per-property status inside the 207 multistatus decides the outcome: a non-success propstat for calendar-timezone maps to Error::UnexpectedStatus with Operation::ProppatchCalendarTimezone — except for a remove, where a 404 propstat is success (removing an absent property is not an error per RFC 4918 §14.23, which makes the remove idempotent).

Server support:

Servercalendar-timezone support
RadicaleSupported (3.7.6): the PROPPATCH set stores the object and the remove makes it read back absent (the read-back value has LF line endings — every conformant XML processor normalizes CRLF → LF in parsed content per XML 1.0 §2.11); verified against the fixture
SabreDAVSupported on calendar creation (set at MKCALENDAR time); the PROPPATCH write path is untested on this fixture
NextcloudSupported on calendar creation, and the PROPPATCH write path round-trips (set → read back the stored object, remove → absent; the read-back value has LF line endings — every conformant XML processor normalizes CRLF → LF in parsed content per XML 1.0 §2.11; verified against the fixture)

§Request-body builders and query data limits (RFC 4791 §9.6.4)

The webdav module exposes pure body builders that render wire-accurate request XML without a server. PROPFIND bodies (RFC 4918 §9.1) come in three flavors — all properties, property names only, or an explicit (namespace, local-name) list — and the typed MkCalendarProps renders a MKCALENDAR body (RFC 4791 §9.5) usable with CalDavClient::mkcalendar:

use fast_dav_rs::webdav::{MkCalendarProps, build_mkcalendar_body, build_propfind_allprop,
    build_propfind_propname, build_propfind_props};

// All properties / property names only (RFC 4918 §9.1).
assert_eq!(
    build_propfind_allprop(),
    "<D:propfind xmlns:D=\"DAV:\"><D:allprop/></D:propfind>"
);
assert_eq!(
    build_propfind_propname(),
    "<D:propfind xmlns:D=\"DAV:\"><D:propname/></D:propfind>"
);

// Explicit property list: namespace declarations are grouped on the root
// (DAV: keeps the conventional D: prefix, others get sequential ns1, ns2, ...)
// and every namespace URI / local name is escaped.
let propfind = build_propfind_props(&[
    ("DAV:", "displayname"),
    ("urn:ietf:params:xml:ns:caldav", "calendar-description"),
]);
assert_eq!(
    propfind,
    "<D:propfind xmlns:D=\"DAV:\" xmlns:ns1=\"urn:ietf:params:xml:ns:caldav\">\
<D:prop><D:displayname/><ns1:calendar-description/></D:prop></D:propfind>"
);

// Typed MKCALENDAR properties (RFC 4791 §9.5): component names are
// validated (ASCII alphanumeric + '-', non-empty) and text values escaped;
// an empty property set renders the minimal skeleton.
let mkcalendar = build_mkcalendar_body(
    &MkCalendarProps::new()
        .with_displayname("Work")
        .with_description("Work events")
        .with_supported_components(["VEVENT", "VTODO"]),
)?;
assert!(mkcalendar.contains("<C:comp name=\"VEVENT\"/>"));

CalendarQueryOptions is the extensible calendar-query entry point: one struct carrying the filter window, data inclusion, server-side expansion (RFC 4791 §9.6.5) and data-return limits (CalendarDataLimits, RFC 4791 §9.6.4) — new options are added to the struct instead of new positional method variants. Setting expand or limits implies requesting <C:calendar-data> (a server cannot expand or limit data it does not return):

use fast_dav_rs::caldav::CalendarQueryOptions;
use fast_dav_rs::webdav::CalendarDataLimits;
use fast_dav_rs::{CalDavClient, Result, TimeRange};

#[tokio::main]
async fn main() -> Result<()> {
    let client = CalDavClient::new("https://caldav.example.com/users/alice/", None, None)?;
    let calendar_path = "calendars/alice/work/";

    // Create a calendar advertising its supported components (RFC 4791 §9.5).
    let body = fast_dav_rs::webdav::build_mkcalendar_body(
        &fast_dav_rs::webdav::MkCalendarProps::new()
            .with_displayname("Work")
            .with_supported_components(["VEVENT", "VTODO"]),
    )?;
    client.mkcalendar(calendar_path, &body).await?;

    // Expanded VEVENTs for 2024, with the recurrence-set expansion limited
    // to one year server-side (RFC 4791 §9.6.4 limit-recurrence-set).
    let options = CalendarQueryOptions::new("VEVENT")
        .with_start("20240101T000000Z")
        .with_end("20250101T000000Z")
        .with_expand(TimeRange::new("20240101T000000Z").with_end("20250101T000000Z"))
        .with_limits(
            CalendarDataLimits::new()
                .with_recurrence_set(
                    TimeRange::new("20240101T000000Z").with_end("20250101T000000Z"),
                ),
        );
    let events = client.calendar_query_options(calendar_path, &options).await?;
    println!("{} events", events.len());

    Ok(())
}

§CalDAV scheduling (RFC 6638)

use fast_dav_rs::{CalDavClient, Result};
use bytes::Bytes;

#[tokio::main]
async fn main() -> Result<()> {
    let client = CalDavClient::new("https://caldav.example.com/users/alice/", None, None)?;

    let principal = client
        .discover_current_user_principal()
        .await?
        .ok_or_else(|| fast_dav_rs::Error::other("no principal returned"))?;
    let endpoints = client.discover_schedule_endpoints(&principal).await?;

    // Scheduling request against the outbox: `Originator` header (the
    // sender's cal-address) plus one `Recipient` header per attendee (a
    // widely-implemented CalendarServer extension, not defined by
    // RFC 6638); the raw iTIP body is sent verbatim, no parsing.
    // RFC 6638 §5 requires the outbox POST body to be a VFREEBUSY
    // component with METHOD:REQUEST.
    if let Some(outbox) = &endpoints.outbox {
        let request = Bytes::from(
            "BEGIN:VCALENDAR\nVERSION:2.0\nMETHOD:REQUEST\nBEGIN:VFREEBUSY\nUID:kickoff\nDTSTAMP:20260101T000000Z\nDTSTART:20260104T000000Z\nDTEND:20260105T000000Z\nORGANIZER:mailto:alice@example.com\nATTENDEE:mailto:bob@example.com\nEND:VFREEBUSY\nEND:VCALENDAR\n",
        );
        let response = client
            .post_schedule(
                outbox,
                "mailto:alice@example.com",
                &["mailto:bob@example.com"],
                request,
            )
            .await?;
        println!("scheduling POST returned {}", response.status);
    }

    // Incoming scheduling messages in the schedule inbox.
    if let Some(inbox) = &endpoints.inbox {
        for item in client.list_inbox(inbox).await? {
            println!("scheduling message: {}", item.href);
        }
    }

    Ok(())
}

Schedule-tag retrieval (RFC 6638 §10.1): a scheduling object resource carries an opaque schedule-tag that the server bumps on attendee-driven changes even when the resource data (and its ETag) did not change. Read it from the Schedule-Tag response header (§10.1.2) or the schedule-tag multistatus property (§10.1.1) and send it back with the If-Schedule-Tag-Match conditional writes (§8.3):

use bytes::Bytes;
use fast_dav_rs::webdav::schedule_tag_from_headers;
use fast_dav_rs::{CalDavClient, Result};

#[tokio::main]
async fn main() -> Result<()> {
    let client = CalDavClient::new("https://caldav.example.com/users/alice/", None, None)?;
    let ics = Bytes::from("BEGIN:VCALENDAR\nVERSION:2.0\nEND:VCALENDAR\n");

    let response = client.get("calendars/work/meeting.ics").await?;
    if let Some(tag) = schedule_tag_from_headers(response.headers()) {
        // The token is opaque: treat it as a black box and echo it back.
        // 412 Precondition Failed means an attendee-driven change landed
        // in between — reload the event and retry.
        let status = client
            .put_if_schedule_tag("calendars/work/meeting.ics", ics, &tag)
            .await?;
        println!("conditional PUT returned {}", status.status());
    }

    Ok(())
}

DavItem.schedule_tag exposes the same token parsed verbatim from multistatus bodies (PROPFIND / calendar-query / calendar-multiget responses), for callers that discover the tag through a listing instead of a resource GET.

Provider quirks (outbox POST): SabreDAV 4.7.1 answers a well-formed VFREEBUSY REQUEST with 200 OK and a CALDAV:schedule-response XML body whose request-status is 2.0;Success (RFC 6638 §5.2 success family), and rejects a malformed (non-iCalendar) body with 400 Bad Request and a <D:error> body (verified against the fixture).

§Calendar proxies (RFC 6638 companion)

use fast_dav_rs::webdav::acl::{Ace, AcePrincipal, build_acl_body};
use fast_dav_rs::webdav::Privilege;
use fast_dav_rs::{CalDavClient, Result};

#[tokio::main]
async fn main() -> Result<()> {
    let client = CalDavClient::new("https://dav.example.com/", Some("user01"), Some("secret"))?;
    let principal = client
        .discover_current_user_principal()
        .await?
        .ok_or_else(|| fast_dav_rs::Error::other("no principal returned"))?;

    // Which principals does user01 act as a calendar proxy for?
    let proxies = client.list_calendar_proxies(&principal).await?;
    println!("read proxy for: {:?}", proxies.read_for);
    println!("write proxy for: {:?}", proxies.write_for);

    // Grant a delegate read access on the read proxy group principal.
    // The delegation wire form is server-dependent — see the
    // grant/revoke method docs before relying on it.
    let body = build_acl_body(&[Ace {
        principal: AcePrincipal::Href("/principals/users/bob/".into()),
        grant: vec![Privilege::Read],
        deny: Vec::new(),
        protected: false,
    }])?;
    client
        .acl("principals/users/user01/calendar-proxy-read/", &body)
        .await?;

    Ok(())
}

§CardDAV contact CRUD

use fast_dav_rs::{CardDavClient, Result};
use bytes::Bytes;

#[tokio::main]
async fn main() -> Result<()> {
    let client = CardDavClient::new("https://carddav.example.com/users/alice/", None, None)?;
    let addressbook_path = "addressbooks/alice/team/";

    let contact_path = format!("{addressbook_path}jane.vcf");
    let vcard = Bytes::from("BEGIN:VCARD\nVERSION:3.0\nFN:Jane Doe\nUID:jane-1\nEMAIL:jane@example.com\nEND:VCARD\n");
    client.put_if_none_match(&contact_path, vcard).await?;

    let matches = client
        .addressbook_query_email(addressbook_path, "jane@example.com", true)
        .await?;

    if let Some(contact) = matches.first() {
        if let Some(etag) = &contact.etag {
            let updated = Bytes::from("BEGIN:VCARD\nVERSION:3.0\nFN:Jane Doe\nUID:jane-1\nEMAIL:jane@example.com\nTEL:+1-555-0100\nEND:VCARD\n");
            client.put_if_match(&contact.href, updated, etag).await?;
        }
    }

    Ok(())
}

For structured filtering, CardDavClient::addressbook_query_filter takes a CardDavFilter and validates the RFC 6352 DTD exclusivity (§10.5.1: a prop-filter cannot combine is-not-defined with a text-match or param-filter children; §10.5.2: a param-filter cannot combine is-not-defined with a text-match) before any network I/O, mirroring the pre-I/O comp-filter/prop-filter/param-filter exclusivity validation of CalDAV calendar_query (RFC 4791 §9.7.1-§9.7.3).

§CardDAV limited address-data and result limits (RFC 6352 §10.4/§10.6)

CardDavClient::addressbook_query_options takes an AddressQueryOptions: the raw filter XML, the address-data payload shape, and the <D:limit><D:nresults> result cap. With address_data_props set, only those vCard properties are returned; Collation::Octet (i;octet) is available for byte-wise case-sensitive text-match comparisons.

use fast_dav_rs::webdav::AddressQueryOptions;
use fast_dav_rs::{CardDavClient, Result};

#[tokio::main]
async fn main() -> Result<()> {
    let client = CardDavClient::new("https://carddav.example.com/users/alice/", None, None)?;

    // Only the FN + EMAIL properties of the first 50 matching cards:
    let options = AddressQueryOptions::new(
        "<C:filter><C:prop-filter name=\"EMAIL\">\
         <C:text-match collation=\"i;octet\">jane@example.com</C:text-match>\
         </C:prop-filter></C:filter>",
    )
    .with_include_data(true)
    .with_address_data_props(vec!["FN".to_owned(), "EMAIL".to_owned()])
    .with_limit(Some(50));

    let contacts = client
        .addressbook_query_options("addressbooks/alice/team/", &options)
        .await?;

    for contact in &contacts {
        println!("{} -> {:?}", contact.href, contact.etag);
    }
    Ok(())
}

Property names must be non-empty ASCII [A-Za-z0-9-]+ (validated before any network I/O; duplicates are dropped, keeping the first occurrence) and the limit is serialized as the last child of addressbook-query per §10.6.

§Batch Operations

use fast_dav_rs::{CalDavClient, Depth, Result};
use bytes::Bytes;
use std::sync::Arc;

#[tokio::main]
async fn main() -> Result<()> {
    let client = CalDavClient::new("https://caldav.example.com/users/alice/", None, None)?;
    let paths = vec!["calendars/alice/work/".to_string(), "calendars/alice/home/".to_string()];

    let body = Arc::new(Bytes::from(r#"<D:propfind xmlns:D="DAV:"><D:prop><D:displayname/></D:prop></D:propfind>"#));
    let results = client.propfind_many(paths, Depth::Zero, body, 4).await;

    for item in results {
        println!("{} -> {:?}", item.pub_path, item.result.as_ref().map(|r| r.status()));
    }

    Ok(())
}

§Runnable Examples

The examples/ directory ships eight standalone binaries covering the main workflows of this library. Each one documents its fixture prerequisites at the top of the file and runs against one of the local e2e fixtures (start them with the setup.sh scripts from End-to-End Testing; typed_error_handling needs no server):

cargo run --example <name>
ExampleFixtureDemonstrates
getting_startedRadicale (:8081)Discovery, calendar CRUD, If-None-Match/If-Match conditional writes and the 412 stale-etag race
sync_loopRadicale (:8081)SyncSession initial + incremental + stale-token resync, icalendar parsing, file-based sync-token persistence
nextcloud_clientNextcloud (:8083)Bearer-token builder vs Basic auth, VTODO creation and calendar-query fetch
radicale_clientRadicale (:8081)Compliance/SyncSession probes on a no-LOCK provider, graceful LOCK → 405 handling
streaming_large_collectionsRadicale (:8081)propfind_items_stream yielding DavStreamEvents with constant memory
streaming_itemsRadicale (:8081)calendar_query_stream yielding parsed CalendarObjects item by item
locking_concurrent_editsSabreDAV (:8080)Full lock/refresh_lock/unlock lifecycle, 423 for token-less writes, graceful 405 on Radicale
multiget_batchedRadicale (:8081)calendar_multiget_many chunked REPORTs with per-chunk failure reporting
typed_error_handlingnone (offline)Matching on Error variants with the #[non_exhaustive] wildcard arm

Fixture-specific details (credentials, quirks) are in the fixture READMEs under sabredav-test/, radicale-test/, and nextcloud-test/.

§Testing

# Unit tests (nextest; equivalent: cargo test --all-features --test unit_tests)
cargo nextest run --all-features --locked --test unit_tests

# Doc tests — compile and run every Rust snippet in this README and docs/
cargo test --doc --all-features

# E2E — bring the fixture up first (see docs/e2e-testing.md)
./sabredav-test/setup.sh
./run-e2e-tests.sh

§Provider compatibility matrix

Feature coverage per fixture — every ✅ cites the e2e test that asserts it (full matrix, evidence, and per-fixture notes: docs/compatibility.md):

FeatureSabreDAVRadicaleNextcloudProvider A
Discovery (RFC 6764)✅✅✅◐
WebDAV-Sync (RFC 6578)✅✅✅—
LOCK (RFC 4918 class 2)✅❌◐—
Scheduling (RFC 6638)✅———
Calendar proxies (RFC 6638 companion)————
calendar-timezone (RFC 4791 §5.2.2)—✅✅—
Managed attachments (RFC 8607)—❌——
Compression✅———
OAuth / Bearer————

✅ asserted by an e2e test · ❌ known unsupported (Radicale: LOCK → 405 despite an advertised class 2; managed attachments: attachment-add POST → 405 and a non-iCalendar PUT into a calendar → 400 — asserted by e2e) · ◐ partial (Provider A: unauthenticated smoke-tier probes only; Nextcloud LOCK: asserted on the files tree — the CalDAV tree accepts but does not enforce locks) · — not tested. New providers are added only with a fixture.

§Limitations & Non-Goals

This library focuses on being a fast, low-level CalDAV/CardDAV client.

  • It does not provide a server implementation.
  • It does not model iCalendar or vCard data into high-level domain types.
  • It does not manage offline sync state or conflict resolution for you.
  • Some server-specific behaviors may require custom XML payloads.

§When NOT to Use This Library

Consider alternatives if:

  • You need a full calendaring or contact domain model (RRULE handling, normalization, etc.).
  • You need an offline-first sync engine with conflict resolution and local storage.
  • You are looking for a server implementation rather than a client.

§Performance Tips

  1. Prefer sync_collection over full scans when WebDAV-Sync is supported.
  2. Use streaming parsing for large multistatus responses.
  3. Reuse a single client instance to take advantage of connection pooling.
  4. Use bounded concurrency for batch operations to avoid overload.
  5. Keep request compression in Auto unless your payloads are tiny.

§Contributing

We welcome contributions. See CONTRIBUTING.md for the workflow and AGENTS.md for repository-specific guidelines.

§Credits

fast-dav-rs builds on the Rust ecosystem, including hyper, tokio, rustls, quick-xml, and async-compression.

§License

This package is licensed under the GNU Lesser General Public License v3.0 (LGPL-3.0). See LICENSE for details.

§Support

§Error Handling & Migration

Public APIs return fast_dav_rs::Result<T>, whose error type is the public fast_dav_rs::Error enum. The enum is #[non_exhaustive], so always include a wildcard arm (_ => …) when matching — new variants may be added in future releases without a breaking change.

Applications can match its variants to make decisions without inspecting error messages or downcasting an opaque error:

use fast_dav_rs::Error;

fn is_retryable(error: &Error) -> bool {
    matches!(error, Error::Timeout { .. } | Error::Transport(_))
}

§Error variants

VariantWhen it occurs
InvalidUrlA base URL or resolved request URI is invalid
InvalidInputCatch-all for a caller-provided value that failed validation
InvalidEtagAn ETag value failed validation
InvalidComponentNameA calendar/addressbook component name failed validation
InvalidDateTimeA date-time value did not match the expected iCalendar UTC format
InvalidICalendarAn iCalendar body failed structural validation (CalDAV PUT)
InvalidConfigA builder configuration value is invalid
InvalidHeaderAn HTTP header value could not be constructed
InvalidMethodAn HTTP method was invalid
HttpBuilding an HTTP request failed
HyperA low-level Hyper connection or body operation failed
ConnectionThe TCP/TLS handshake failed (DNS, refused, TLS)
TransportA request was sent but the response stream broke
UnexpectedStatusThe server returned an unexpected HTTP status code
UnexpectedStatusWithDavUnexpected status with a <D:error> body (e.g. 423 + no-conflicting-lock)
PreconditionFailedA conditional write returned 412 — the validator (ETag/lock/schedule-tag) did not match; reload the item and retry. Classify raw conditional-write responses with conditional_write_error
PreconditionRequiredA conditional write returned 428 (RFC 6585 §3) — the server requires a conditional header on this write
SyncIncompleteA sync-collection result set was truncated (507 inside the 207) and cannot be continued (no new sync token, or a repeated one)
PrincipalNotFoundAuthentication succeeded but current-user-principal PROPFIND returned 404 — on some providers the signature of a wrong username form (e.g. email instead of the account ID)
TimeoutAn operation exceeded its configured time limit
BodyTooLargeA decompressed response body exceeded the 256 MiB limit
XmlParsing or decoding XML failed
XmlStructureThe XML element hierarchy is malformed or incomplete
XmlEscapeUnescaping XML entity references failed
XmlAttributeParsing an XML attribute failed
IoAn I/O operation failed
Utf8Decoding UTF-8 text failed
TlsRustlsA rustls TLS operation failed
TlsTLS, certificate, or PEM parsing failed
OtherUser callback error or error that doesn’t fit another variant

The Operation enum identifies which DAV operation produced an UnexpectedStatus (e.g. PropfindCollections, ReportCalendarQuery, PropfindScheduleEndpoints, PostSchedule, ScheduleInbox, PostManagedAttachment, Lock, Unlock, PutIfMatch, DeleteIfMatch). The EtagReason enum describes why an ETag was rejected (Empty, InvalidFormat, InvalidCharacters, InvalidHeaderValue, Weak).

Note: TLS errors may appear as either TlsRustls (automatic rustls::Error propagation via ?) or Tls (manually wrapped with context, e.g. PEM parsing). Consumers checking for TLS errors should match both variants.

§Migrating from anyhow

Earlier releases returned anyhow::Error. Replace library-facing anyhow::Result<T> signatures with fast_dav_rs::Result<T> when you want to preserve and match the typed error:

use fast_dav_rs::{CalDavClient, Error, Result};

async fn discover_principal(client: &CalDavClient) -> Result<String> {
    client
        .discover_current_user_principal()
        .await?
        .ok_or_else(|| Error::other("no principal returned"))
}

Applications that use anyhow at their own boundary can continue to propagate library errors with ?; fast_dav_rs::Error implements std::error::Error:

use anyhow::Result;
use fast_dav_rs::CalDavClient;

async fn synchronize(client: &CalDavClient) -> Result<()> {
    client.discover_current_user_principal().await?;
    Ok(())
}

Replace calls specific to anyhow::Error, such as downcast_ref, context, or with_context, with pattern matching on variants such as Error::Timeout, Error::UnexpectedStatus, Error::InvalidInput, and Error::Transport. Error messages remain intended for diagnostics; use variants and their fields for programmatic handling.

§Distinguishing connection vs transport errors

Error::Connection is returned when the TCP/TLS handshake itself fails (DNS resolution, connection refused, TLS error), while Error::Transport covers failures during an already-established connection (read/write abort, body decode error). This lets retry logic target only transient connection issues:

use fast_dav_rs::Error;

fn should_retry(error: &Error) -> bool {
    match error {
        // The server was unreachable; a retry may reach a different node.
        Error::Connection(_) | Error::Timeout { .. } => true,
        // The request was sent but the response stream broke mid-flight.
        // Retrying is only safe for idempotent methods (GET, PUT with If-Match).
        Error::Transport(_) => false,
        // The server explicitly rejected the request.
        Error::UnexpectedStatus { status, .. } => {
            status.is_server_error()
        }
        _ => false,
    }
}

For errors originating in user callbacks or when wrapping an error that does not fit a specific variant, use Error::other for a standalone message or Error::with_source to preserve the underlying cause in the error chain:

use fast_dav_rs::Error;
use std::error::Error as _;

let standalone = Error::other("no principal returned");
let with_cause = Error::with_source("callback failed", std::io::Error::other("disk full"));
assert!(with_cause.source().is_some());

§Custom errors in streaming callbacks

When using streaming APIs with a visitor callback, return Error::other for application-level failures and Error::with_source to wrap an underlying cause:

use fast_dav_rs::{CalDavClient, Depth, Error, Result};
use fast_dav_rs::caldav::{DavItem, parse_multistatus_bytes_visit};

async fn sync_calendar(client: &CalDavClient, path: &str) -> Result<()> {
    let report_xml = r#"<C:calendar-query xmlns:D="DAV:" xmlns:C="urn:ietf:params:xml:ns:caldav"><D:prop><D:getetag/></D:prop></C:calendar-query>"#;
    let resp = client.report(path, Depth::One, report_xml).await?;

    parse_multistatus_bytes_visit(&resp.into_body(), |item: DavItem| {
        // Save to a database; wrap the DB error with context.
        save_to_db(&item).map_err(|e| {
            Error::with_source(format!("failed to save {}", item.href), e)
        })
    })?;

    Ok(())
}

fn save_to_db(_item: &DavItem) -> std::result::Result<(), DbError> {
    Ok(())
}

#[derive(Debug)]
struct DbError;
impl std::fmt::Display for DbError {
    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
        write!(f, "database error")
    }
}
impl std::error::Error for DbError {}

§Migrating from anyhow with map_err

If your codebase uses anyhow::Context to add context to library errors, replace .context("...") with .map_err(|e| Error::with_source("...", e)):

use fast_dav_rs::CalDavClient;
async fn migrate(client: &CalDavClient) -> anyhow::Result<()> {
// Before (anyhow)
use anyhow::Context;
let principal = client
    .discover_current_user_principal()
    .await
    .context("discovery failed")?
    .ok_or_else(|| anyhow::anyhow!("no principal"))?;

// After (typed errors)
use fast_dav_rs::Error;
let principal = client
    .discover_current_user_principal()
    .await
    .map_err(|e| Error::with_source("discovery failed", e))?
    .ok_or_else(|| Error::other("no principal"))?;
let _ = principal;
Ok(())
}

§Complete migration example

The doctest below covers defining a typed Error enum with #[from] and #[error(...)], using ? with automatic conversions, replacing anyhow!() and .context(), and pattern matching on variants for programmatic error handling.

Key patterns at a glance:

use std::num::ParseIntError;
// 1. Define typed variants — #[from] for simple variants, #[source] for rich ones
//
// #[from] generates a From<E> impl so `?` works automatically — but only
// for newtype/tuple variants with NO extra fields:
#[derive(Debug, thiserror::Error)]
pub enum AppError {
    #[error("parse failed: {0}")]
    Parse(#[from] ParseIntError),  // ? converts automatically

    // For struct variants with extra context, use #[source] + .map_err():
    #[error("invalid port `{raw}`: {source}")]
    InvalidPort { raw: String, #[source] source: ParseIntError },

    #[error("port out of range: {0}")]
    OutOfRange(u16),
}

// 2. Use ? for #[from] variants; .map_err() for #[source] variants
fn parse_port(raw: &str) -> Result<u16, AppError> {
    let port: u16 = raw.parse()
        .map_err(|source| AppError::InvalidPort { raw: raw.to_owned(), source })?;
    Ok(port)
}

// 3. Match on variants — the payoff over anyhow
match parse_port("abc") {
    Ok(port) => println!("port: {port}"),
    Err(AppError::InvalidPort { raw, .. }) => eprintln!("bad input: {raw}"),
    Err(AppError::OutOfRange(p)) => eprintln!("port {p} is reserved"),
    Err(AppError::Parse(source)) => eprintln!("not a number: {source}"),
}

§Removed legacy module paths

The former top-level modules (client, streaming, types, compression) — previously available behind the legacy Cargo feature — have been removed. Use the canonical paths:

use fast_dav_rs::caldav::client::CalDavClient;
use fast_dav_rs::caldav::SyncSession;

§Advanced Configuration

For production use, use the builder pattern to configure auth, timeouts, connection pool, TLS, proxy, and more:

§Basic auth + timeout + pool

fn main() -> fast_dav_rs::Result<()> {
use fast_dav_rs::CalDavClient;
use std::time::Duration;

let client = CalDavClient::builder("https://cal.example.com/dav/")
    .basic_auth("user", "pass")
    .timeout(Duration::from_secs(30))
    .user_agent("MyApp/1.0")
    .pool_max_idle_per_host(10)
    .build()?;
let _ = client;
Ok(())
}

§Bearer/OAuth 2.0 token

use fast_dav_rs::CalDavClient;
fn main() -> fast_dav_rs::Result<()> {
let client = CalDavClient::builder("https://cal.example.com/dav/")
    .bearer_token("ya29.token...")
    .build()?;
let _ = client;
Ok(())
}

§Base-URL credentials are rejected

A base URL carrying user:pass@ userinfo is rejected at build time with Error::InvalidConfig — before any network I/O. Pass credentials via basic_auth(...), bearer_token(...), or a TokenProvider instead. URLs discovered through .well-known redirects (RFC 6764 §5) are likewise returned without userinfo: redirect targets are server-controlled, so discovery never echoes credentials back to the caller.

§Pluggable token provider (renewable OAuth2)

token_provider(...) is the third auth mode (mutually exclusive with basic_auth/bearer_token, last-set wins): the client asks a TokenProvider for the bearer token before each request, and when the server rejects a token with 401 it refreshes once and retries. The provided OAuth2RefreshProvider implements the generic RFC 6749 §6 refresh grant (pure HTTP — no browser flows, no provider presets; obtaining the initial refresh token is the caller’s job):

fn main() -> fast_dav_rs::Result<()> {
use std::sync::Arc;
use fast_dav_rs::webdav::{OAuth2RefreshProvider, WebDavClient};

let provider = OAuth2RefreshProvider::new(
    "https://auth.example.com/oauth2/token",
    "my-client-id",
    "my-client-secret",
    "the-long-lived-refresh-token",
)?;

let client = WebDavClient::builder("https://dav.example.com/")
    .token_provider(Arc::new(provider))
    .build()?;
let _ = client;
Ok(())
}

Renewal is transparent and single-flight: tokens are cached until expires_in passes or a 401 arrives, and concurrent requests share one in-flight refresh instead of stampeding the token endpoint. Refresh failures surface as Error::TokenRefresh (Rejected / MalformedResponse / Transport); a 401 after one refresh is returned as-is. Clones of the client share the provider’s cache. Any custom token source works by implementing the TokenProvider trait (see its docs for the exact 401-renewal contract).

Security: tokens travel as Authorization: Bearer headers on every request — always use https:// outside isolated test environments. Tokens never appear in the crate’s Debug output, error messages, or tracing events.

§Proxy + custom CA for debugging

Route traffic through a debugging proxy (Proxyman/Charles/mitmproxy) and trust its MITM CA — works on Android non-rooted and iOS/macOS alike:

use fast_dav_rs::CalDavClient;
fn main() -> fast_dav_rs::Result<()> {
let proxy_uri: hyper::Uri = "http://127.0.0.1:9090".parse().expect("valid proxy URI");
let client = CalDavClient::builder("https://cal.example.com/dav/")
    .basic_auth("user", "pass")
    .proxy(proxy_uri)
    .proxy_basic_auth("proxyuser", "proxypass")
    .extra_root_certs_pem(vec![std::fs::read("/path/proxyman-ca.pem")?])
    .build()?;
let _ = client;
Ok(())
}

§Force HTTP/1.1

For servers or proxies that misbehave with HTTP/2:

use fast_dav_rs::CalDavClient;
fn main() -> fast_dav_rs::Result<()> {
let client = CalDavClient::builder("https://cal.example.com/dav/")
    .force_http1(true)
    .build()?;
let _ = client;
Ok(())
}

HTTP/2 is negotiated over TLS via ALPN on https:// URLs only. Cleartext http:// connections always use HTTP/1.1 (h2c is not attempted).

§Custom Hyper client injection

Bring your own hyper client — for custom transports, wiremock-style test harnesses, or tailored TLS/pool settings. The injected client is used as-is: the builder skips its own transport construction, so force_http1, pool, TLS, and proxy options are not applied (the caller owns the transport). Request-level options (auth, timeout, compression, redirects, Prefer, retries) still apply:

use fast_dav_rs::CalDavClient;
fn main() -> fast_dav_rs::Result<()> {
use fast_dav_rs::common::http::MaybeProxied;
use fast_dav_rs::webdav::{HyperClient, WebDavClient};
use hyper_rustls::HttpsConnectorBuilder;
use hyper_util::client::legacy::{Client, connect::HttpConnector};
use hyper_util::rt::TokioExecutor;

let mut http = HttpConnector::new();
http.enforce_http(false);
let https = HttpsConnectorBuilder::new()
    .with_webpki_roots()
    .https_or_http()
    .enable_http1()
    .enable_http2()
    .wrap_connector(MaybeProxied::direct(http));
let hyper_client: HyperClient = Client::builder(TokioExecutor::new())
    .pool_max_idle_per_host(8)
    .build(https);

let client = CalDavClient::builder("https://cal.example.com/dav/")
    .with_hyper_client(hyper_client)
    .build()?;
let _ = client;
Ok(())
}

The method is available on WebDavClientBuilder, CalDavClientBuilder, and CardDavClientBuilder.

§Redirect following

HTTP redirects (301/302/303/307/308) are followed automatically in send/send_stream, up to a configurable limit. On 303 the request is re-sent as GET without a body, and when a redirect crosses origins (scheme, host, or port change) the Authorization, Cookie, If-Match, and If-None-Match headers are stripped for the remainder of the chain. An https→http downgrade is never followed (RFC 6764 §6 is TLS-first): the 3xx response is returned as-is so the caller can observe it. Exceeding the limit fails with Error::TooManyRedirects:

use fast_dav_rs::CalDavClient;
fn main() -> fast_dav_rs::Result<()> {
let client = CalDavClient::builder("https://cal.example.com/dav/")
    .follow_redirects(true) // default
    .max_redirects(5)       // default
    .build()?;
let _ = client;
Ok(())
}

§Auto-discovery (RFC 6764)

discover_caldav and discover_carddav (free functions taking &WebDavClient) locate the service “context path” for a base URL per RFC 6764 §5: a PROPFIND with Depth: 0 and a DAV:current-user-principal body is sent to {base}/.well-known/caldav (or /carddav). Redirects are followed by the client’s redirect pipeline when follow_redirects is enabled (the builder default — RFC 6764 §5 requires clients to handle .well-known redirects), so the final request URL is the discovered service URL. A 404 (or a success answered directly on the .well-known URI) returns the base URL unchanged as a documented fallback; any other non-success status fails with Error::UnexpectedStatus, except a 3xx that could not be followed (redirect following disabled, unresolvable Location, or an https→http downgrade), which fails with a descriptive error. Client credentials are attached to the probe and stripped automatically on cross-origin redirect hops, and the discovered service URL is returned without userinfo (redirect targets are server-controlled; see “Base-URL credentials are rejected”). RFC 6764’s DNS-based discovery steps are deliberately out of scope: SRV record lookup (§3) and TXT record lookup (§6) are excluded to keep the dependency tree lean (no DNS resolver crate). Supply the base URL the DNS records would have resolved to — the .well-known probe above covers the RFC 6764 §5 step and implements the §6 base-URL fallback (a 404 returns the base URL). DNS SRV/TXT record lookup is not implemented:

use fast_dav_rs::{WebDavClient, discover_caldav};

async fn example() -> fast_dav_rs::Result<()> {
let client = WebDavClient::builder("https://dav.example.com/")
    .basic_auth("user", "pass")
    .build()?;
let service_url = discover_caldav(&client).await?;
Ok(())
}

§Retry & backoff

Transient failures are retried automatically in send/send_stream once you opt in with max_retries (default 0 — no retry, each request is sent exactly once). Retries apply to 429, 503, and 504 responses: a 429 honors the server’s Retry-After header (integer seconds or HTTP-date; absent → exponential backoff), while 503/504 always use an exponential backoff (base 2, initial ~250 ms, doubling per attempt, capped at ~8 s) with ±25 % jitter. Only idempotent methods (GET, HEAD, OPTIONS, PROPFIND, REPORT) are retried by default; retry_all(true) extends retrying to every method (PUT, POST, DELETE, MKCOL, COPY, MOVE, LOCK, …). Beware: re-sending a non-idempotent write whose first attempt actually reached the origin duplicates its effect (e.g. a PUT behind a gateway answering 504 after applying the write is sent a second time) — only enable it against origins where a duplicated write is acceptable. When retries are exhausted, the last response is returned as-is — callers see the real status through the existing error handling. The retry budget counts every HTTP attempt across the whole redirect chain (total attempts = 1 + max_retries), and each attempt — retries included — runs under the same per-request timeout:

use fast_dav_rs::CalDavClient;
fn main() -> fast_dav_rs::Result<()> {
let client = CalDavClient::builder("https://cal.example.com/dav/")
    .max_retries(3)     // default 0 — no retry
    .retry_all(false)   // default — only idempotent methods are retried
    .build()?;
let _ = client;
Ok(())
}

§Prefer header

The Prefer header (RFC 7240) can be set client-wide and is then sent on every request. put_if_match_prefer sends a conditional PUT with Prefer: return=representation so servers that honor it include the stored representation (typically with the new ETag) in the response. Servers may ignore preferences — check the Preference-Applied response header with preference_applied_from_headers to see whether one was actually applied. Other preferences (wait, handling, …) and per-request overrides can be sent manually via the HeaderMap accepted by send/send_stream (an explicit per-request Prefer header wins over the builder default):

use fast_dav_rs::CalDavClient;
fn main() -> fast_dav_rs::Result<()> {
use fast_dav_rs::webdav::Prefer;

let client = CalDavClient::builder("https://cal.example.com/dav/")
    .prefer(Some(Prefer::Minimal)) // default: none
    .build()?;
let _ = client;
Ok(())
}

§Conditional requests (If-Match)

put_if_match, put_if_match_prefer, and delete_if_match send If-Match guarded requests using RFC 9110 strong comparison. Quoted strong ETags are sent as-is; bare ETags (as returned by some servers) are quoted automatically. Weak entity-tags (W/"abc") are rejected client-side before any network I/O with Error::InvalidEtag and EtagReason::Weak: under strong comparison a weak validator never matches, so a server would always answer 412 Precondition Failed. Weak ETags remain accepted everywhere they are purely informational (etag_from_headers, normalize_etag).

§iCalendar validation (CalDAV)

CalDAV PUT bodies (put, put_if_match, put_if_none_match) are validated client-side before any network I/O. The default ValidationLevel::Structural checks that the body is valid UTF-8, starts with BEGIN:VCALENDAR, ends with END:VCALENDAR, declares VERSION:2.0 and a PRODID, and has balanced BEGIN/END component pairs. On a body that declares a VERSION, the wire Content-Type gains a matching version parameter (text/calendar; charset=utf-8; version=2.0). Invalid bodies fail with Error::InvalidICalendar (carrying an ICalendarViolation) without a request being sent:

fn main() -> fast_dav_rs::Result<()> {
use fast_dav_rs::caldav::ValidationLevel;
use fast_dav_rs::CalDavClient;

let client = CalDavClient::builder("https://cal.example.com/dav/")
    .validation_level(ValidationLevel::Strict) // also require UID in every VEVENT/VTODO
    // .validation_level(ValidationLevel::None) // pre-validation behavior
    .build()?;
let _ = client;
Ok(())
}

fast_dav_rs::caldav::validate_icalendar(&body) runs all seven structural checks directly. CardDAV (vCard) requests are never validated as iCalendar.

§Streaming & Sync

  • Stream CalDAV/CardDAV responses item by item with the *_items_stream methods (propfind_items_stream, report_items_stream, calendar_query_stream, addressbook_query_stream). The low-level parse_multistatus_stream* parsers are deprecated since 0.18.0.
  • supports_webdav_sync and sync_collection work for both calendars and addressbooks.
  • sync_collection_with_level (all clients) sends a configurable sync-level (RFC 6578 §3.3): SyncLevel::One restricts the sync to the collection members, SyncLevel::Infinite includes all descendants.
  • SyncSession (all clients) is the resilient sync engine: it recovers automatically from a stale sync token — 410 Gone (RFC 6578 §3.11) or 403 Forbidden + valid-sync-token (§3.2) — by re-issuing the report as an initial sync, and the delta it yields carries resynced == true on the rebuild. Per RFC 6578 §3.4 an initial sync MUST NOT report deletions that predate the stale token, so rebuild your caches from the delta instead of applying it incrementally when the flag is set. The raw sync_collection_resilient methods are deprecated since 0.18.0 in favour of SyncSession.
  • Result truncation (RFC 6578 §3.6): when the server truncates a sync result set it reports 507 Insufficient Storage inside the 207 multistatus (normally on the request-URI). caldav::SyncResponse/carddav::SyncResponse expose this as truncated == true; the 507 element still appears in items with its per-item status, and the returned sync_token stays valid for fetching the next page. At the WebDavClient level, inspect items for a HTTP/1.1 507 … status.
  • The sync types and helpers (SyncItem, SyncResponse, build_sync_collection_body, map_sync_response) are module-qualified: CalDAV and CardDAV define distinct same-named items, so they are only available as fast_dav_rs::caldav::{SyncItem, SyncResponse, …} and fast_dav_rs::carddav::{SyncItem, SyncResponse, …} — never at the crate root.

§Item-by-item streams (no aggregation)

The *_items_stream methods parse the multistatus incrementally over the response body — each complete <D:response> is yielded as soon as it parses, so memory stays bounded by the current item regardless of collection size (the XML is also decompressed on the fly, br/gzip/zstd). At the WebDavClient level, propfind_items_stream and report_items_stream (plus *_with_timeout variants) yield DavStreamEvent items and the <D:sync-token> in document order; a non-success status is rejected eagerly by the call itself as Error::UnexpectedStatus. Dropping the stream aborts the download and frees (rather than re-pools) the connection.

use fast_dav_rs::{CalDavClient, Result};
use futures::StreamExt;

#[tokio::main]
async fn main() -> Result<()> {
    let client = CalDavClient::new("https://caldav.example.com/users/alice/", None, None)?;

    // Each CalendarObject arrives as soon as its <D:response> is parsed.
    let mut stream = client
        .calendar_query_stream("calendars/alice/work/", "VEVENT", None, None, true, None)
        .await?;
    while let Some(object) = stream.next().await {
        let object = object?;
        if let Some(data) = &object.calendar_data {
            println!("{} -> {} bytes", object.href, data.len());
        }
    }

    Ok(())
}

CardDavClient::addressbook_query_stream works the same way for vCards, and the raw event engine behind them is available as fast_dav_rs::webdav::streaming::multistatus_events (an idle-read timeout variant, multistatus_events_with_timeout, is there too).

§SyncSession (stateful sync with transparent fallback)

SyncSession (new in this release, issue #160) packages the sync algorithm above into a per-collection, in-memory state machine — the DAVx⁵ approach:

  1. it probes supported-report-set once and caches the answer;
  2. while the server supports RFC 6578 sync-collection, initial() returns the full state snapshot and incremental() returns a typed delta (added / modified / deleted) carrying the token to persist; 507 result-set truncation is continued with the page token, and a truncation that cannot be continued (no new token, or a repeated token) fails with Error::SyncIncomplete instead of surfacing a partial delta;
  3. on an unsupported server (or one that rejects the report with 405) it falls back transparently to a PROPFIND Depth: 1 etag diff, fetching content for changed members via batched calendar-multiget / addressbook-multiget REPORTs (CalDAV/CardDAV sessions); a bare 403 propagates as an error instead of downgrading (a transient ACL flap must not silently pin the session to the slow path — the next call re-attempts sync-collection);
  4. a stale token — 410 Gone, or 403 + valid-sync-token as observed on Radicale — resets the session transparently to a full initial sync, flagged resynced == true (rebuild caches; per RFC 6578 §3.4 the delta then reports no deletions);
  5. conflicts: the server wins.

The session is in-memory only: you persist sync_token between runs (store it next to your application data) and restore it with with_sync_token. Clones share the token and the probe cache, like client clones share the connection pool, and concurrent initial()/incremental() calls on clones are serialized (single-flight): one probe and one report at a time, with the session state transitions kept consistent.

use fast_dav_rs::{CalDavClient, Result, SyncSession};

async fn sync_loop(client: &CalDavClient, saved_token: Option<&str>) -> Result<()> {
    // Restore the persisted token from your own storage when resuming.
    let session = client
        .sync_session("calendars/alice/work/")
        .with_sync_token(saved_token);

    let delta = session.incremental().await?;
    if delta.resynced {
        // Stale token: this is a full snapshot — rebuild your cache from
        // `delta.added` instead of applying it incrementally.
        println!("resync: {} live items", delta.added.len());
    }
    for entry in delta.added.iter().chain(&delta.modified) {
        println!("upsert {} (etag {:?})", entry.href, entry.etag);
    }
    for href in &delta.deleted {
        println!("remove {href}");
    }
    println!("persist this token: {:?}", delta.sync_token);
    Ok(())
}

A plain WebDavClient::sync_session(collection) requests getetag only; the CalDavClient/CardDavClient constructors also fetch calendar-data/address-data for every entry (and via multiget on the fallback path).

A runnable end-to-end version — initial + incremental + stale-token resync against the Radicale fixture, with calendar-data parsed by the icalendar crate and a file-based token store — lives in examples/sync_loop.rs.

§WebDAV locking (class 2)

All clients (WebDavClient, CalDavClient, CardDavClient) support WebDAV locking (RFC 4918 class 2). lock sends LOCK with an explicit Depth: 0 header (RFC 4918 §9.10.4), a Timeout: Second-N header (clamped to u32::MAX seconds, RFC 4918 §10.7) and a <D:lockinfo> body and returns the parsed <D:activelock> (LockInfo: token, timeout, scope, owner, lockroot, depth); refresh_lock re-issues the LOCK with the token in an If header (RFC 4918 §9.10.7) and falls back to the request token when the server omits <D:locktoken> in the response; unlock sends UNLOCK with the token in a Lock-Token header. Tokens are validated (RFC 4918 §10.5 Coded-URL grammar) before being embedded in a header. Non-success statuses surface as Error::UnexpectedStatus with Operation::Lock/Operation::Unlock — or as Error::UnexpectedStatusWithDav when the error body carries a <D:error> precondition (e.g. 423 Locked + no-conflicting-lock, RFC 4918 §16). A successful LOCK response without a lock token fails with Error::InvalidInput (RFC 4918 §9.10.9).

The client keeps no implicit lock state: callers keep the token and pass it to refresh_lock/unlock, or send it in an If header via the low-level send on conditional writes. Check capabilities() (class2) to confirm the server supports locking. PROPFIND responses containing the lockdiscovery property can be parsed with webdav::parse_lock_discovery_bytes.

use fast_dav_rs::webdav::LockScope;
use fast_dav_rs::{CalDavClient, Result};

async fn edit_shared_doc(client: &CalDavClient) -> Result<()> {
    let lock = client
        .lock(
            "docs/plan.txt",
            LockScope::Exclusive,
            "<D:href>https://example.com/alice</D:href>",
            Some(300),
        )
        .await?;

    // Write while holding the lock: the token goes in an If header.
    let mut headers = hyper::HeaderMap::new();
    headers.insert("If", format!("(<{}>)", lock.token).parse().expect("valid coded-URL token"));
    client
        .send(
            hyper::Method::PUT,
            "docs/plan.txt",
            headers,
            Some(bytes::Bytes::from_static(b"updated content")),
            None,
        )
        .await?;

    client.refresh_lock("docs/plan.txt", &lock.token, Some(300)).await?;
    client.unlock("docs/plan.txt", &lock.token).await?;
    Ok(())
}

§Resilient sync example

sync_collection_resilient is deprecated since 0.18.0 — prefer SyncSession (described above). The raw method remains available:

use fast_dav_rs::{CalDavClient, Result, SyncLevel};

// `sync_collection_resilient` is deprecated; `SyncSession` is the supported path.
#[allow(deprecated)]
async fn sync(client: &CalDavClient) -> Result<()> {
    // Incremental sync; on 410 Gone the report is re-issued as an initial sync
    // and the full result set with the new token is returned.
    let sync = client
        .sync_collection_resilient("calendars/alice/work/", Some("stale-token"), None, true)
        .await?;
    println!("new token: {:?}", sync.sync_token);

    // Custom sync-level (RFC 6578 §3.3).
    let full = client
        .sync_collection_with_level("calendars/alice/work/", None, None, false, SyncLevel::Infinite)
        .await?;
    println!("items: {}", full.items.len());

    Ok(())
}

§CalDAV streaming example

use fast_dav_rs::{CalDavClient, Result};
use futures::StreamExt;

#[tokio::main]
async fn main() -> Result<()> {
    let client = CalDavClient::new("https://caldav.example.com/users/alice/", None, None)?;

    // Each parsed object arrives as soon as its <D:response> completes;
    // dropping the stream aborts the download.
    let mut stream = client
        .calendar_query_stream("calendars/alice/work/", "VEVENT", None, None, true, None)
        .await?;

    while let Some(object) = stream.next().await {
        let object = object?;
        if let Some(data) = object.calendar_data {
            println!("{} -> {} bytes", object.href, data.len());
        }
    }

    Ok(())
}

§CardDAV streaming example

use fast_dav_rs::{CardDavClient, Result};
use futures::StreamExt;

#[tokio::main]
async fn main() -> Result<()> {
    let client = CardDavClient::new("https://carddav.example.com/users/alice/", None, None)?;
    let filter_xml = r#"<C:filter><C:prop-filter name="FN"><C:text-match collation="i;unicode-casemap">Ada</C:text-match></C:prop-filter></C:filter>"#;

    let mut stream = client
        .addressbook_query_stream("addressbooks/alice/team/", filter_xml, true)
        .await?;

    while let Some(object) = stream.next().await {
        let object = object?;
        if let Some(data) = object.address_data {
            println!("{} -> {} bytes", object.href, data.len());
        }
    }

    Ok(())
}

§End-to-End Testing

The project ships three Docker e2e fixtures (SabreDAV, Radicale, Nextcloud) plus an opt-in, credential-free smoke tier against a real-world deployment (referred to as Provider A — never named in the repository). The suites live in one tree per fixture under tests/e2e/ (sabredav/, radicale/, nextcloud/, provider_a/), with shared fixture helpers in tests/e2e/util.rs.

TierFixture dirTest targetURL (env override)Credentials
SabreDAVsabredav-test/--test e2e_testshttp://localhost:8080 (SABREDAV_URL)test / test
Radicaleradicale-test/--test e2e_radicalehttp://localhost:8081 (RADICALE_URL)test / test
Nextcloudnextcloud-test/--test e2e_nextcloudhttp://localhost:8083 (NEXTCLOUD_URL)test / fixture-dav-password
Provider A smoke— (no fixture)--test e2e_provider_a_smoke -- --ignoredPROVIDER_A_DAV_URL (required)none

CI runs the SabreDAV, Radicale, and Nextcloud tiers (jobs e2e-tests, e2e-radicale, e2e-nextcloud); the Provider A smoke tier is #[ignore]-gated, never runs in CI, uses zero credentials, and skips itself when PROVIDER_A_DAV_URL is unset:

PROVIDER_A_DAV_URL=https://dav.example.test \
  cargo test --test e2e_provider_a_smoke -- --ignored --nocapture

It probes only the unauthenticated surface (OPTIONS /, the two well-known URIs, an unauthenticated principal PROPFIND — 4 requests) and asserts the 401 + WWW-Authenticate: Basic challenge while recording the well-known shape (redirect vs direct 401).

§SabreDAV (primary fixture)

This project includes a complete e2e testing environment with a SabreDAV server that supports CalDAV and CardDAV features including compression, WebDAV locking (class 2), and WebDAV sync.

§Prerequisites

  1. Docker and Docker Compose
  2. The SabreDAV test environment (located in sabredav-test/)

§Setting up the test environment

cd sabredav-test
./setup.sh

This will start a complete SabreDAV environment with:

  • Nginx with gzip, Brotli, and zstd compression modules
  • PHP-FPM for better performance
  • MySQL database with preconfigured SabreDAV tables
  • Test user (test/test) and sample calendar events

§Running e2e tests

./run-e2e-tests.sh

Or manually:

cargo test --test e2e_tests -- --nocapture

§Resetting the test environment

To reset the database to a clean state:

cd sabredav-test
./reset-db.sh

§Radicale fixture

./radicale-test/setup.sh   # http://localhost:8081, user test/test
./radicale-test/reset.sh   # restart wipes the tmpfs data, re-seeds
cargo test --test e2e_radicale

Radicale is the second engine in the matrix and exercises different failure modes: sync-token invalidation (403 + valid-sync-token), no LOCK support (405 despite an advertised class 2), and the auto-create-on-first-principal- access quirk. See radicale-test/README.md for the full quirk list.

§Nextcloud fixture

./nextcloud-test/setup.sh   # http://localhost:8083, first boot installs the instance
./nextcloud-test/reset.sh   # full wipe + reinstall (slow)
cargo test --test e2e_nextcloud

Nextcloud is the real-world reference: DAV strictly under /remote.php/dav/, principals/users/{uid} paths, VTODO coverage, and Basic auth (with app passwords as the documented path for hardened instances; Bearer/OIDC is out of scope for the fixture). See nextcloud-test/README.md.

§Provider quirks: UTF-8 double-encoding on CardDAV writes

Provider A’s CardDAV write path can double-encode multi-byte UTF-8 in vCard writes (corrupted text on later reads). The full quirk note and the read-back workaround live in compatibility.md.

Re-exports§

pub use caldav::builder::CalDavClientBuilder;
pub use caldav::streaming::parse_multistatus_bytes;
pub use caldav::streaming::parse_multistatus_bytes_visit;
pub use caldav::streaming::parse_multistatus_stream;Deprecated
pub use caldav::streaming::parse_multistatus_stream_visit;Deprecated
pub use caldav::streaming::parse_multistatus_stream_visit_with_timeout;Deprecated
pub use caldav::streaming::parse_multistatus_stream_with_timeout;Deprecated
pub use caldav::BatchItem;
pub use caldav::CalDavClient;
pub use caldav::CalendarDataLimits;
pub use caldav::CalendarInfo;
pub use caldav::CalendarObject;
pub use caldav::CalendarProxyInfo;
pub use caldav::CalendarQueryOptions;
pub use caldav::DavItem;
pub use caldav::Depth;
pub use caldav::InboxItem;
pub use caldav::ManagedAttachment;
pub use caldav::MediaType;
pub use caldav::MkCalendarProps;
pub use caldav::ScheduleEndpoints;
pub use caldav::SchedulingResponse;
pub use caldav::TimeRange;
pub use caldav::ValidationLevel;
pub use caldav::build_calendar_multiget_body;
pub use caldav::build_calendar_query_body;
pub use caldav::build_calendar_query_body_with_limits;
pub use caldav::build_mkcalendar_body;
pub use caldav::map_calendar_list;
pub use caldav::map_calendar_object;
pub use caldav::map_calendar_objects;
pub use caldav::validate_icalendar;
pub use carddav::builder::CardDavClientBuilder;
pub use carddav::AddressBookInfo;
pub use carddav::AddressObject;
pub use carddav::AddressQueryOptions;
pub use carddav::CardDavClient;
pub use carddav::CardDavFilter;
pub use carddav::Collation;
pub use carddav::MatchType;
pub use carddav::ParamFilter;
pub use carddav::TextMatch;
pub use carddav::map_address_object;
pub use carddav::map_address_objects;
pub use common::compression::ContentEncoding;
pub use common::compression::add_accept_encoding;
pub use common::compression::add_content_encoding;
pub use common::compression::compress_payload;
pub use common::compression::detect_encoding;
pub use common::compression::detect_encodings;
pub use common::compression::detect_request_compression_preference;
pub use webdav::builder::WebDavClientBuilder;
pub use webdav::Ace;
pub use webdav::AcePrincipal;
pub use webdav::DavCapabilities;
pub use webdav::DavCompliance;
pub use webdav::DavStreamEvent;
pub use webdav::HyperClient;
pub use webdav::ItemStream;
pub use webdav::LockInfo;
pub use webdav::LockScope;
pub use webdav::OAuth2RefreshProvider;
pub use webdav::Prefer;
pub use webdav::Privilege;
pub use webdav::PropStat;
pub use webdav::RequestCompressionMode;
pub use webdav::SyncCapability;
pub use webdav::SyncDelta;
pub use webdav::SyncEntry;
pub use webdav::SyncLevel;
pub use webdav::SyncSession;
pub use webdav::SyncSnapshot;
pub use webdav::TokenProvider;
pub use webdav::WebDavClient;
pub use webdav::WebDavError;
pub use webdav::build_acl_body;
pub use webdav::build_propfind_allprop;
pub use webdav::build_propfind_propname;
pub use webdav::build_propfind_props;
pub use webdav::conditional_write_error;
pub use webdav::data_element_xml_with_limits;
pub use webdav::discover_caldav;
pub use webdav::discover_carddav;
pub use webdav::etag_from_headers;
pub use webdav::if_header_for_lock_token;
pub use webdav::normalize_etag;
pub use webdav::normalize_sync_token;
pub use webdav::preference_applied_from_headers;
pub use webdav::principal_href_for_acl;
pub use webdav::schedule_tag_from_headers;

Modules§

caldav
carddav
CardDAV client, streaming helpers, and types for addressbook discovery, queries, and sync.
common
webdav

Macros§

apply_common_fields
impl_dav_builder
Generates a thin wrapper builder that delegates all setters to WebDavClientBuilder and wraps the result via from_webdav.
impl_dav_client_delegates
Generates the shared delegate methods for the thin CalDAV/CardDAV client wrappers over WebDavClient.

Enums§

Error
Error returned by fast-dav-rs operations.
EtagReason
Why an ETag was rejected by validation.
ICalendarViolation
Why an iCalendar body was rejected by structural validation.
Operation
Identifies which DAV operation produced an Error::UnexpectedStatus.
TokenRefreshReason
Why an OAuth2 token refresh (RFC 6749 §6) failed.

Type Aliases§

Result
Result type used by all fallible fast-dav-rs APIs.