@mic Thanks for the test accounts, I was now able to identify the problem:
It's all about the
OPTIONS request. Basically, it can be sent with or without request body. Currently, an
OPTIONS request body has no defined semantic value and is not required for DAVdroid's purposes, so we choose to send the request without request body.
With HTTP/1.1, it's quite easy. The request is sent as
OPTIONS /path HTTP/1.1
Content-Length and request body, and everything works fine.
However, with HTTP/2, it becomes more difficult, because there are
DATA frames. If a request has no body, no
DATA frame should be sent. However, okhttp sends an empty
DATA frame with 0 bytes:
davdroid.DavResourceFinder: [HttpClient$1] --> OPTIONS https://yourserver/katana/public/server.php/principals/bitfire/ http/1.1
davdroid.DavResourceFinder: [HttpClient$1] --> END OPTIONS
davdroid.dav4android: [dav4android.BasicDigestAuthHandler] Adding Basic authorization header for https://yourserver/katana/public/server.php/principals/bitfire/
okhttp3.internal.framed.Http2$FrameLogger: [okhttp3.internal.framed.Http2$Writer] >> 0x0000001f 218 HEADERS END_HEADERS
[!!!] okhttp3.internal.framed.Http2$FrameLogger: [okhttp3.internal.framed.Http2$Writer] >> 0x0000001f 0 DATA END_STREAM
okhttp3.internal.framed.Http2$FrameLogger: [okhttp3.internal.framed.Http2$Reader] << 0x0000001f 7 HEADERS END_HEADERS
although dav4android specifies a request without body (body is null). The Apache 2.4 server then rejects the request because there's a request body (i.e. data frame), but no
So, it seems to be an okhttp problem. I have reported this to okhttp and I'm waiting for response.
The problem can be simulated with nghttp, too:
nghttp -v -H ':method:OPTIONS' -H 'Authorization: Basic ***' https://yourserver/baikal/html/dav.php works as expected, while a 0-byte data frame without
Content-Length, generated by
nghttp -v -d /dev/null --no-content-length -H ':method:OPTIONS' -H 'Authorization: Basic ***' https://yourserver/baikal/html/dav.php causes an error.
A workaround is to specify
Content-Length: 0 in the
OPTIONS request (so the request has a body, but with specified length, which is OK for the server, too). We'll implement this for the next DAVdroid version until okhttp is fixed.