Fixes #1064 - HttpClient sets chunked transfer-encoding.
Replaced the hint that there is a body by setting the Content-Type header rather than the Transfer-Encoding header.
This commit is contained in:
parent
bbc21e8648
commit
7e903cfc6b
|
@ -122,14 +122,15 @@ public abstract class HttpConnection implements Connection
|
|||
// Add content headers
|
||||
if (content != null)
|
||||
{
|
||||
if (content instanceof ContentProvider.Typed)
|
||||
if (!headers.containsKey(HttpHeader.CONTENT_TYPE.asString()))
|
||||
{
|
||||
if (!headers.containsKey(HttpHeader.CONTENT_TYPE.asString()))
|
||||
{
|
||||
String contentType = ((ContentProvider.Typed)content).getContentType();
|
||||
if (contentType != null)
|
||||
headers.put(HttpHeader.CONTENT_TYPE, contentType);
|
||||
}
|
||||
String contentType = null;
|
||||
if (content instanceof ContentProvider.Typed)
|
||||
contentType = ((ContentProvider.Typed)content).getContentType();
|
||||
if (contentType != null)
|
||||
headers.put(HttpHeader.CONTENT_TYPE, contentType);
|
||||
else
|
||||
headers.put(HttpHeader.CONTENT_TYPE, "application/octet-stream");
|
||||
}
|
||||
long contentLength = content.getLength();
|
||||
if (contentLength >= 0)
|
||||
|
@ -137,11 +138,6 @@ public abstract class HttpConnection implements Connection
|
|||
if (!headers.containsKey(HttpHeader.CONTENT_LENGTH.asString()))
|
||||
headers.put(HttpHeader.CONTENT_LENGTH, String.valueOf(contentLength));
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!headers.containsKey(HttpHeader.TRANSFER_ENCODING.asString()))
|
||||
headers.put(CHUNKED_FIELD);
|
||||
}
|
||||
}
|
||||
|
||||
// Cookies
|
||||
|
|
Loading…
Reference in New Issue