Fix HEAD requests on large files for Android

ByteArrayOutputStream was always allocated with the size of content-length, even on HEAD requests
This commit is contained in:
Daniel Freiling
2016-07-06 16:06:32 +02:00
parent 7fba041567
commit 8368c42716

View File

@@ -41,6 +41,7 @@ public class Async
{
private static final String DeleteMethod = "DELETE";
private static final String GetMethod = "GET";
private static final String HeadMethod = "HEAD";
private static CookieManager cookieManager;
public static class KeyValuePair
@@ -300,7 +301,10 @@ public class Async
// build the result
result.getHeaders(connection);
if (!requestMethod.equals(HeadMethod))
{
result.readResponseStream(connection, openedStreams, options);
}
// close the opened streams (saves copy-paste implementation
// in each method that throws IOException)