I'm also having issues with the okHttp client.
I'm on Android 9, TC 3.0, WebDAV 3.0
The okHttp client works fine for the HTTP request methods PROPFIND, MKCOL, MOVE, COPY, DELETE.
Only the PUT request method causes a problem and only if used with HTTP 2.0 (HTTP 1.1 plain or encrypted work fine).
I created a log file, here is the relevant part:
Code: Select all
2020-07-09 16:32:08.560 WebDAV:OkHttpClient: new connection to: ue-pc
2020-07-09 16:32:08.625 WebDAV:Cert subject: CN=das-ue-pc.fritz.box,O=Internet Widgits Pty Ltd,ST=Some-State,C=de
2020-07-09 16:32:08.627 WebDAV:Cert issuer: CN=das-ue-pc.fritz.box,O=Internet Widgits Pty Ltd,ST=Some-State,C=de
2020-07-09 16:32:12.238 HOST:WebDAV:get dir: /ue-pc/webdav/
2020-07-09 16:32:12.240 WebDAV:LIST /ue-pc/webdav/
2020-07-09 16:32:12.298 WebDAV:PUT /ue-pc/webdav/bla.txt
2020-07-09 16:32:13.311 WebDAV:PUT /ue-pc/webdav/bla.txt
2020-07-09 16:32:23.319 WebDAV:Exception: timeout
2020-07-09 16:32:23.324 WebDAV:timeout
From what I can gather the okHttp client does not send any request body via HTTP 2.0 to nginx. Nginx times out the client after 10 seconds.
Nginx is set up with ssl, http2 (TLSv1.2/ECDHE-ECDSA-AES128-GCM-SHA256 dont know if that is important) and the following location block:
Code: Select all
location /webdav/ {
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Port $server_port;
proxy_http_version 1.1;
proxy_set_header Connection "";
proxy_pass http://127.0.0.1:9004$request_uri;
client_max_body_size 0;
# proxy_request_buffering off;
# proxy_buffering off;
}
The backend that runs at 127.0.0.1:9004 is written in GO and just puts out an "unexpected EOF" error because the connection is prematurely closed by nginx.
If I disable the request buffering in nginx, so nginx sends everything it gets directly to the backend, the backend does not read any bytes from the request body.
For testing purposes I configured the backend to use HTTP 2.0 with the same ssl certificate and cipher suite (TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256, TLS1.2), connected directly to it with TC and there everything works just fine.
So it does not seems to be a general problem with HTTP 2.0, just some quirk with nginx's http2.
Hope you can figure this out.
Edit:
I tested 2 nginx versions:
- nginx version: nginx/1.17.3
built by cl 16.00.40219.01 for 80x86
built with OpenSSL 1.1.1c 28 May 2019
on Windows 10
- nginx version: nginx/1.14.1
built with OpenSSL 1.1.0f 25 May 2017 (running with OpenSSL 1.1.0l 10 Sep 2019)
on armv7 Linux (raspian)
Edit2:
Upload via curl works fine too.
Code: Select all
$ curl -v --insecure --upload-file bla.txt https://localhost/webdav/bla.txt
* Trying ::1:443...
* Connected to localhost (::1) port 443 (#0)
* ALPN, offering h2
* ALPN, offering http/1.1
* TLSv1.3 (OUT), TLS handshake, Client hello (1):
* TLSv1.3 (IN), TLS handshake, Server hello (2):
* TLSv1.2 (IN), TLS handshake, Certificate (11):
* TLSv1.2 (IN), TLS handshake, Server key exchange (12):
* TLSv1.2 (IN), TLS handshake, Server finished (14):
* TLSv1.2 (OUT), TLS handshake, Client key exchange (16):
* TLSv1.2 (OUT), TLS change cipher, Change cipher spec (1):
* TLSv1.2 (OUT), TLS handshake, Finished (20):
* TLSv1.2 (IN), TLS handshake, Finished (20):
* SSL connection using TLSv1.2 / ECDHE-ECDSA-AES128-GCM-SHA256
* ALPN, server accepted to use h2
* Server certificate:
* subject: C=de; ST=Some-State; O=Internet Widgits Pty Ltd; CN=das-ue-pc.fritz.box
* start date: Oct 31 00:51:42 2018 GMT
* expire date: Oct 28 00:51:42 2028 GMT
* issuer: C=de; ST=Some-State; O=Internet Widgits Pty Ltd; CN=das-ue-pc.fritz.box
* SSL certificate verify result: self signed certificate (18), continuing anyway.
* Using HTTP2, server supports multi-use
* Connection state changed (HTTP/2 confirmed)
* Copying HTTP/2 data in stream buffer to connection buffer after upgrade: len=0
* Using Stream ID: 1 (easy handle 0x1ee5816b7a0)
> PUT /webdav/bla.txt HTTP/2
> Host: localhost
> user-agent: curl/7.70.0
> accept: */*
> content-length: 3
>
* Connection state changed (MAX_CONCURRENT_STREAMS == 128)!
* We are completely uploaded and fine
< HTTP/2 201
< server: nginx/1.17.3
< date: Thu, 09 Jul 2020 16:58:35 GMT
< content-type: text/plain; charset=utf-8
< content-length: 7
< etag: "1620240f386302a83"
< strict-transport-security: max-age=15768000; includeSubdomains; preload
< x-content-type-options: nosniff
<
Created* Connection #0 to host localhost left intact