Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit a0c3aab8 authored by Android (Google) Code Review's avatar Android (Google) Code Review
Browse files

Merge change 1324

* changes:
  Fix #1807059. If it is "POST", always use BasicHttpEntityEnclosingRequest even bodyProvider is null. This ensures the content-type, content-encoding and content-length are set correctly.
parents 70a16b40 45efe69f
Loading
Loading
Loading
Loading
+7 −2
Original line number Diff line number Diff line
@@ -116,13 +116,18 @@ class Request {
        mBodyProvider = bodyProvider;
        mBodyLength = bodyLength;

        if (bodyProvider == null) {
        if (bodyProvider == null && !"POST".equalsIgnoreCase(method)) {
            mHttpRequest = new BasicHttpRequest(method, getUri());
        } else {
            mHttpRequest = new BasicHttpEntityEnclosingRequest(
                    method, getUri());
            // it is ok to have null entity for BasicHttpEntityEnclosingRequest.
            // By using BasicHttpEntityEnclosingRequest, it will set up the
            // correct content-length, content-type and content-encoding.
            if (bodyProvider != null) {
                setBodyProvider(bodyProvider, bodyLength);
            }
        }
        addHeader(HOST_HEADER, getHostPort());

        /* FIXME: if webcore will make the root document a