Commit d5487a16 authored by Ricki Hirner's avatar Ricki Hirner

Don't require ETag for GET (because this is required for CalDAV/CardDAV only,...

Don't require ETag for GET (because this is required for CalDAV/CardDAV only, but not for WebDAV in general)
parent fde96be2
......@@ -109,17 +109,13 @@ public class DavResourceTest extends TestCase {
assertEquals("GET", rq.getMethod());
assertEquals("/target", rq.getPath());
/* NEGATIVE TEST CASES */
// 200 OK without ETag in response
dav.properties.put(GetETag.NAME, new GetETag("test"));
mockServer.enqueue(new MockResponse()
.setResponseCode(HttpURLConnection.HTTP_OK)
.setBody(sampleText));
try {
body = dav.get("*/*");
fail();
} catch (DavException e) {
}
dav.get("*/*");
assertNull(dav.properties.get(GetETag.NAME));
}
public void testPut() throws InterruptedException, IOException, HttpException, DavException {
......
......@@ -152,10 +152,9 @@ public class DavResource {
String eTag = response.header("ETag");
if (TextUtils.isEmpty(eTag))
// CalDAV servers MUST return ETag on GET [https://tools.ietf.org/html/rfc4791#section-5.3.4]
// CardDAV servers MUST return ETag on GET [https://tools.ietf.org/html/rfc6352#section-6.3.2.3]
throw new DavException("Received GET response without ETag");
properties.put(GetETag.NAME, new GetETag(eTag));
properties.remove(GetETag.NAME);
else
properties.put(GetETag.NAME, new GetETag(eTag));
ResponseBody body = response.body();
if (body == null)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment