Skip to content
Andreas H edited this page Jul 31, 2020 · 1 revision

Sardine and Nextcloud

We had troubles when using Sardine to PUT files onto a Nextcloud instance. The Nextcloud instance has little resources and we often had connection errors (timeouts, resets). Sardine uses the Apache HTTP client. By analyzing the wire log of the HTTP client, we found out that Sardine uses the Expect-100-Continue header to speed up the PUT process. The HTTP client uses a timeout of 3 seconds to wait for the 100-Continue response header. Unfortunately, our Nextcloud instance was partially too slow to respond within these 3 seconds. RFC 2616 allows to continue without waiting for the 100-Continue response header, which the HTTP client does. This lead to a communication hiccup between the client and Nextcloud. We are not sure whether this should be fixed in the HTTP client or in Nextcloud.

Anyway, we found a workaround that solved the problem for us:

  • Disable the Expect-100-Continue header: sardine.put(url, stream, null, false)
  • Enable preemptive authentication: sardine.enablePreemptiveAuthentication
Clone this wiki locally