Apply Content-Range and Content-Length headers to resumable upload request.

master
Alex Hart 2020-08-21 14:03:28 -03:00
parent a7aec6bfbc
commit b94a636542
1 changed files with 6 additions and 1 deletions

View File

@ -1128,13 +1128,18 @@ public class PushServiceSocket {
Request.Builder request = new Request.Builder().url(urlBuilder.build())
.post(RequestBody.create(null, ""));
for (Map.Entry<String, String> header : headers.entrySet()) {
request.header(header.getKey(), header.getValue());
if (!header.getKey().equalsIgnoreCase("host")) {
request.header(header.getKey(), header.getValue());
}
}
if (connectionHolder.getHostHeader().isPresent()) {
request.header("host", connectionHolder.getHostHeader().get());
}
request.addHeader("Content-Length", "0");
request.addHeader("Content-Type", "application/octet-stream");
Call call = okHttpClient.newCall(request.build());
synchronized (connections) {