mirror of https://github.com/axmolengine/axmol.git
receive content data even though status code is not 2xx
This commit is contained in:
parent
6f53719772
commit
753335726a
|
@ -87,13 +87,13 @@
|
||||||
| “205” ; Reset Content
|
| “205” ; Reset Content
|
||||||
| “206” ; Partial Content
|
| “206” ; Partial Content
|
||||||
*/
|
*/
|
||||||
if (responseCode < 200 || responseCode >= 300)
|
// if (responseCode < 200 || responseCode >= 300)
|
||||||
{// something went wrong, abort the whole thing
|
// {// something went wrong, abort the whole thing
|
||||||
|
|
||||||
[connection cancel];
|
// [connection cancel];
|
||||||
finish = true;
|
// finish = true;
|
||||||
return;
|
// return;
|
||||||
}
|
// }
|
||||||
|
|
||||||
[responseData setLength:0];
|
[responseData setLength:0];
|
||||||
}
|
}
|
||||||
|
|
|
@ -260,8 +260,17 @@ public class Cocos2dxHttpURLConnection
|
||||||
}
|
}
|
||||||
|
|
||||||
static byte[] getResponseContent(HttpURLConnection http) {
|
static byte[] getResponseContent(HttpURLConnection http) {
|
||||||
try {
|
DataInputStream in;
|
||||||
DataInputStream in = new DataInputStream(http.getInputStream());
|
try {
|
||||||
|
in = new DataInputStream(http.getInputStream());
|
||||||
|
} catch (IOException e) {
|
||||||
|
in = new DataInputStream(http.getErrorStream());
|
||||||
|
} catch (Exception e) {
|
||||||
|
Log.e("Cocos2dxHttpURLConnection exception", e.toString());
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
byte[] buffer = new byte[1024];
|
byte[] buffer = new byte[1024];
|
||||||
int size = 0;
|
int size = 0;
|
||||||
ByteArrayOutputStream bytestream = new ByteArrayOutputStream();
|
ByteArrayOutputStream bytestream = new ByteArrayOutputStream();
|
||||||
|
@ -272,12 +281,13 @@ public class Cocos2dxHttpURLConnection
|
||||||
byte retbuffer[] = bytestream.toByteArray();
|
byte retbuffer[] = bytestream.toByteArray();
|
||||||
bytestream.close();
|
bytestream.close();
|
||||||
return retbuffer;
|
return retbuffer;
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
Log.e("Cocos2dxHttpURLConnection exception", e.toString());
|
Log.e("Cocos2dxHttpURLConnection exception", e.toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int getResponseCode(HttpURLConnection http) {
|
static int getResponseCode(HttpURLConnection http) {
|
||||||
int code = 0;
|
int code = 0;
|
||||||
try {
|
try {
|
||||||
|
|
Loading…
Reference in New Issue