Fixes Pleroma upload issue
This commit is contained in:
parent
46b07ea255
commit
b103f661a9
|
@ -88,6 +88,7 @@ public class HttpsConnection {
|
|||
int type = sharedpreferences.getInt(Helper.SET_PROXY_TYPE, 0);
|
||||
proxy = null;
|
||||
if( proxyEnabled ){
|
||||
try {
|
||||
String host = sharedpreferences.getString(Helper.SET_PROXY_HOST, "127.0.0.1");
|
||||
int port = sharedpreferences.getInt(Helper.SET_PROXY_PORT, 8118);
|
||||
if( type == 0 )
|
||||
|
@ -106,6 +107,10 @@ public class HttpsConnection {
|
|||
};
|
||||
Authenticator.setDefault(authenticator);
|
||||
}
|
||||
}catch (Exception e){
|
||||
proxy = null;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1075,7 +1080,8 @@ public class HttpsConnection {
|
|||
byte[] pixels = ous.toByteArray();
|
||||
|
||||
int lengthSent = pixels.length;
|
||||
lengthSent += 2 * (twoHyphens + boundary + twoHyphens + lineEnd).getBytes().length;
|
||||
lengthSent += (twoHyphens + boundary + lineEnd).getBytes().length;
|
||||
lengthSent += (twoHyphens + boundary + twoHyphens +lineEnd).getBytes().length;
|
||||
lengthSent += ("Content-Disposition: form-data; name=\"file\"; filename=\""+fileName+"\"" + lineEnd).getBytes().length;
|
||||
lengthSent += 2 * (lineEnd).getBytes().length;
|
||||
|
||||
|
@ -1102,7 +1108,7 @@ public class HttpsConnection {
|
|||
|
||||
DataOutputStream request = new DataOutputStream(httpsURLConnection.getOutputStream());
|
||||
|
||||
request.writeBytes(twoHyphens + boundary + twoHyphens + lineEnd);
|
||||
request.writeBytes(twoHyphens + boundary + lineEnd);
|
||||
request.writeBytes("Content-Disposition: form-data; name=\"file\"; filename=\""+fileName+"\"" + lineEnd);
|
||||
request.writeBytes(lineEnd);
|
||||
|
||||
|
@ -1233,7 +1239,8 @@ public class HttpsConnection {
|
|||
byte[] pixels = ous.toByteArray();
|
||||
|
||||
int lengthSent = pixels.length;
|
||||
lengthSent += 2 * (twoHyphens + boundary + twoHyphens + lineEnd).getBytes().length;
|
||||
lengthSent += (twoHyphens + boundary + lineEnd).getBytes().length;
|
||||
lengthSent += (twoHyphens + boundary + twoHyphens +lineEnd).getBytes().length;
|
||||
lengthSent += ("Content-Disposition: form-data; name=\"file\";filename=\""+fileName+"\"" + lineEnd).getBytes().length;
|
||||
lengthSent += 2 * (lineEnd).getBytes().length;
|
||||
|
||||
|
@ -1259,7 +1266,7 @@ public class HttpsConnection {
|
|||
|
||||
DataOutputStream request = new DataOutputStream(httpURLConnection.getOutputStream());
|
||||
|
||||
request.writeBytes(twoHyphens + boundary + twoHyphens + lineEnd);
|
||||
request.writeBytes(twoHyphens + boundary + lineEnd);
|
||||
request.writeBytes("Content-Disposition: form-data; name=\"file\";filename=\""+fileName+"\"" + lineEnd);
|
||||
request.writeBytes(lineEnd);
|
||||
|
||||
|
|
Loading…
Reference in New Issue