Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(318)

Unified Diff: components/cronet/android/java/src/org/chromium/net/ChromiumUrlRequest.java

Issue 640593004: Fix a pair of Cronet upload bugs and add tests. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Reorder fields Created 6 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « components/cronet.gypi ('k') | components/cronet/android/test/cronet_test_jni.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/cronet/android/java/src/org/chromium/net/ChromiumUrlRequest.java
diff --git a/components/cronet/android/java/src/org/chromium/net/ChromiumUrlRequest.java b/components/cronet/android/java/src/org/chromium/net/ChromiumUrlRequest.java
index 228682f3e65130201af8af6117a5b7737940285e..ccbf06394c3a92e27f1b73644952bfe448b818d0 100644
--- a/components/cronet/android/java/src/org/chromium/net/ChromiumUrlRequest.java
+++ b/components/cronet/android/java/src/org/chromium/net/ChromiumUrlRequest.java
@@ -319,19 +319,6 @@ public class ChromiumUrlRequest implements HttpUrlRequest {
mStarted = true;
- String method = mMethod;
- if (method == null &&
- ((mUploadData != null && mUploadData.length > 0) ||
- mUploadChannel != null || mChunkedUpload)) {
- // Default to POST if there is data to upload but no method was
- // specified.
- method = "POST";
- }
-
- if (method != null) {
- nativeSetMethod(mUrlRequestAdapter, method);
- }
-
if (mHeaders != null && !mHeaders.isEmpty()) {
for (Entry<String, String> entry : mHeaders.entrySet()) {
nativeAddHeader(mUrlRequestAdapter, entry.getKey(),
@@ -358,6 +345,13 @@ public class ChromiumUrlRequest implements HttpUrlRequest {
mUploadContentType);
}
+ // Note: The above functions to set the upload body also set the
+ // method to POST, behind the scenes, so if mMethod is null but
+ // there's an upload body, the method will default to POST.
+ if (mMethod != null) {
+ nativeSetMethod(mUrlRequestAdapter, mMethod);
+ }
+
nativeStart(mUrlRequestAdapter);
}
}
« no previous file with comments | « components/cronet.gypi ('k') | components/cronet/android/test/cronet_test_jni.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698