mirror of
https://github.com/apache/cordova-android.git
synced 2025-02-27 04:42:51 +08:00
Change related to FileTransfer, need to get a test going for this somehow
This commit is contained in:
parent
77547f8826
commit
ee4c91539a
@ -277,6 +277,18 @@ public class FileTransfer extends Plugin {
|
|||||||
conn.setRequestProperty("Connection", "Keep-Alive");
|
conn.setRequestProperty("Connection", "Keep-Alive");
|
||||||
conn.setRequestProperty("Content-Type", "multipart/form-data;boundary="+BOUNDRY);
|
conn.setRequestProperty("Content-Type", "multipart/form-data;boundary="+BOUNDRY);
|
||||||
|
|
||||||
|
// Handle the other headers
|
||||||
|
try {
|
||||||
|
JSONObject headers = params.getJSONObject("headers");
|
||||||
|
for (Iterator iter = params.keys(); iter.hasNext();)
|
||||||
|
{
|
||||||
|
String headerKey = iter.next().toString();
|
||||||
|
conn.setRequestProperty(headerKey, params.getString(headerKey));
|
||||||
|
}
|
||||||
|
} catch (JSONException e1) {
|
||||||
|
// No headers to be manipulated!
|
||||||
|
}
|
||||||
|
|
||||||
// Set the cookies on the response
|
// Set the cookies on the response
|
||||||
String cookie = CookieManager.getInstance().getCookie(server);
|
String cookie = CookieManager.getInstance().getCookie(server);
|
||||||
if (cookie != null) {
|
if (cookie != null) {
|
||||||
@ -294,12 +306,15 @@ public class FileTransfer extends Plugin {
|
|||||||
try {
|
try {
|
||||||
for (Iterator iter = params.keys(); iter.hasNext();) {
|
for (Iterator iter = params.keys(); iter.hasNext();) {
|
||||||
Object key = iter.next();
|
Object key = iter.next();
|
||||||
|
if(key.toString() != "headers")
|
||||||
|
{
|
||||||
dos.writeBytes(LINE_START + BOUNDRY + LINE_END);
|
dos.writeBytes(LINE_START + BOUNDRY + LINE_END);
|
||||||
dos.writeBytes("Content-Disposition: form-data; name=\"" + key.toString() + "\";");
|
dos.writeBytes("Content-Disposition: form-data; name=\"" + key.toString() + "\";");
|
||||||
dos.writeBytes(LINE_END + LINE_END);
|
dos.writeBytes(LINE_END + LINE_END);
|
||||||
dos.write(params.getString(key.toString()).getBytes());
|
dos.write(params.getString(key.toString()).getBytes());
|
||||||
dos.writeBytes(LINE_END);
|
dos.writeBytes(LINE_END);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
} catch (JSONException e) {
|
} catch (JSONException e) {
|
||||||
Log.e(LOG_TAG, e.getMessage(), e);
|
Log.e(LOG_TAG, e.getMessage(), e);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user