lookfirst / sardine

an easy to use webdav client for java
Other
579 stars 185 forks source link

Digest authentication #205

Closed axelrose closed 8 years ago

axelrose commented 9 years ago

It is perhaps a misunderstanding or a documentation problem only in https://github.com/lookfirst/sardine/wiki/UsageGuide

Does "Only the Basic scheme is supported" mean this is generelly the case or just after setting preemptive authentication?

I have a server (Adobe CQMS) which is ok if I run curl -u "me:pass" --digest --upload-file test.jpg https://host/path but not ok with curl -u "me:pass" --upload-file test.jpg https://host/path

When coding just

        conn = SardineFactory.begin(username, password);
        File localFile = new File("/tmp/test.jpg");
        conn.put(
            "https://host/path/test.jpg",
            new FileInputStream(localFile), "image/jpeg");

I get

Exception in thread "main" org.apache.http.client.ClientProtocolException
Caused by: org.apache.http.client.NonRepeatableRequestException: Cannot retry request with a non-repeatable request entity.

It doesn't make a difference to me if I add conn.disablePreemptiveAuthentication(); or conn.enablePreemptiveAuthentication("host");

sardineuser commented 9 years ago

with "large file put", i saw a workaroud for this problem with adding a conn.exists(url); before doing the put.

dkocher commented 8 years ago

Preemptive authentication only configures Basic authentication.

dkocher commented 8 years ago

Make sure your entities are repeatable for operations that require several requests such as when responding to authentication challenges.