Fix http requests always failing on old android

This commit is contained in:
UnknownShadow200 2021-01-30 12:53:36 +11:00
parent 5700988e49
commit ebc4d9f753
2 changed files with 12 additions and 11 deletions

View File

@ -711,16 +711,17 @@ public class MainActivity extends Activity implements SurfaceHolder.Callback2 {
int len;
try {
conn.connect();
Map<String, List<String>> all = conn.getHeaderFields();
for (Map.Entry<String, List<String>> h : all.entrySet()) {
String key = h.getKey();
for (String value : h.getValue()) {
if (key == null) {
httpParseHeader(value);
} else {
httpParseHeader(key + ":" + value);
}
// Legitimate webservers aren't going to reply with over 200 headers
for (int i = 0; i < 200; i++) {
String key = conn.getHeaderFieldKey(i);
String val = conn.getHeaderField(i);
if (key == null && val == null) break;
if (key == null) {
httpParseHeader(val);
} else {
httpParseHeader(key + ":" + val);
}
}

View File

@ -51,4 +51,4 @@ $TOOLS_ROOT/aapt add -f obj/cc-unsigned.apk classes.dex lib/armeabi/libclassicub
cp obj/cc-unsigned.apk obj/cc-signed.apk
jarsigner -verbose -sigalg SHA1withRSA -digestalg SHA1 -keystore debug.keystore -storepass android -keypass android obj/cc-signed.apk androiddebugkey
# create aligned .apk file
$TOOLS_ROOT/zipalign -f -v 4 obj/cc-signed.apk obj/cc-final.apk
$TOOLS_ROOT/zipalign -f -v 4 obj/cc-signed.apk ~/client/src/cc.apk