Skip to content

Conversation

@rfc2822
Copy link
Member

@rfc2822 rfc2822 commented Jan 6, 2026

Purpose

Enable HTTP connection reuse and keep-alive for WebDAV connections to improve performance and reduce connection overhead.

This only applies to okhttp connections and not to Ktor, which manages engine client reuse itself (can be verified / tested at a later time).

It applies to all HTTP operations, so both sync and WebDAV.

Short description

  • Create a shared OkHttpClient instance for connection pooling
  • Utilize sharedOkHttpClient.newBuilder() for new client instances instead of creating new clients from scratch
  • Move timeout configuration to the shared client to ensure consistent settings
  • Remove the now-redundant buildTimeouts() method

This change allows OkHttp to reuse connections and share thread pools across different HTTP clients, which is especially beneficial for WebDAV operations that often involve multiple sequential requests to the same server.

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.

- Create a shared OkHttpClient instance for connection pooling
- Utilize sharedOkHttpClient.newBuilder() for new client instances
@rfc2822 rfc2822 self-assigned this Jan 6, 2026
@rfc2822 rfc2822 linked an issue Jan 6, 2026 that may be closed by this pull request
@rfc2822 rfc2822 force-pushed the 1898-missing-webdav-http-connection-reuse-keep-alive branch from c5e3eb8 to 3c88238 Compare January 6, 2026 10:56
@rfc2822 rfc2822 changed the title Enable HTTP connection reuse Enable HTTP connection reuse for okhttp Jan 6, 2026
@rfc2822 rfc2822 requested a review from sunkup January 6, 2026 11:00
@rfc2822 rfc2822 marked this pull request as ready for review January 6, 2026 11:04
@rfc2822 rfc2822 requested a review from a team as a code owner January 6, 2026 11:04
Copy link
Member

@sunkup sunkup left a comment

Choose a reason for hiding this comment

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

Did not verify whether connections are now shared, but the test looks good to me and sync still works :)

@rfc2822 rfc2822 merged commit 9ad98e4 into main-ose Jan 6, 2026
6 checks passed
@rfc2822 rfc2822 deleted the 1898-missing-webdav-http-connection-reuse-keep-alive branch January 6, 2026 12:28
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.

Unclear HTTP connection reuse

2 participants