mirror of
https://github.com/ClassiCube/ClassiCube.git
synced 2025-01-22 09:01:57 -05:00
Android: Try to fix 'unexpected status line' errors with texture packs from dropbox, addresses #933
This commit is contained in:
parent
c4fe212b8b
commit
8e61dbc18a
1 changed files with 13 additions and 0 deletions
|
@ -811,11 +811,24 @@ public class MainActivity extends Activity
|
|||
conn.setDoInput(true);
|
||||
conn.setRequestMethod(method);
|
||||
conn.setInstanceFollowRedirects(true);
|
||||
|
||||
httpAddMethodHeaders(method);
|
||||
return 0;
|
||||
} catch (Exception ex) {
|
||||
return httpOnError(ex);
|
||||
}
|
||||
}
|
||||
|
||||
static void httpAddMethodHeaders(String method) {
|
||||
if (!method.equals("HEAD")) return;
|
||||
|
||||
// Ever since dropbox switched to to chunked transfer encoding,
|
||||
// sending a HEAD request to dropbox always seems to result in the
|
||||
// next GET request failing with 'Unexpected status line' ProtocolException
|
||||
// Seems to be a known issue: https://github.com/square/okhttp/issues/3689
|
||||
// Simplest workaround is to ask for connection to be closed after HEAD request
|
||||
httpSetHeader("connection", "close");
|
||||
}
|
||||
|
||||
public static void httpSetHeader(String name, String value) {
|
||||
conn.setRequestProperty(name, value);
|
||||
|
|
Loading…
Reference in a new issue