Commit 63e646e7 authored by valenting's avatar valenting
Browse files

Bug 1824723 - Set the content type to the proper name when...

Bug 1824723 - Set the content type to the proper name when ObliviousHTTPChannel is used with POST r=necko-reviewers,jesup, a=dsmith

Depends on D173671

Differential Revision: https://phabricator.services.mozilla.com/D173690
parent 1f522be1
Loading
Loading
Loading
Loading
+7 −1
Original line number Diff line number Diff line
@@ -492,7 +492,8 @@ ObliviousHttpChannel::GetContentType(nsACString& aContentType) {

NS_IMETHODIMP
ObliviousHttpChannel::SetContentType(const nsACString& aContentType) {
  return mInnerChannel->SetContentType(aContentType);
  mContentType = aContentType;
  return NS_OK;
}

NS_IMETHODIMP
@@ -559,6 +560,10 @@ ObliviousHttpChannel::AsyncOpen(nsIStreamListener* aListener) {
    headerNames.AppendElement(iter.Key());
    headerValues.AppendElement(iter.Data());
  }
  if (!mContentType.IsEmpty() && !headerNames.Contains("Content-Type")) {
    headerNames.AppendElement("Content-Type"_ns);
    headerValues.AppendElement(mContentType);
  }
  nsCOMPtr<nsIBinaryHttp> bhttp(
      do_GetService("@mozilla.org/network/binary-http;1"));
  nsCOMPtr<nsIBinaryHttpRequest> bhttpRequest(new BinaryHttpRequest(
@@ -815,6 +820,7 @@ NS_IMETHODIMP ObliviousHttpChannel::ExplicitSetUploadStream(
  if (written != available) {
    return NS_ERROR_FAILURE;
  }
  mContentType = aContentType;
  return NS_OK;
}

+1 −0
Original line number Diff line number Diff line
@@ -51,6 +51,7 @@ class ObliviousHttpChannel final : public nsIHttpChannel,
  nsTArray<uint8_t> mEncodedConfig;

  nsCString mMethod{"GET"_ns};
  nsCString mContentType;
  nsTHashMap<nsCStringHashKey, nsCString> mHeaders;
  nsTArray<uint8_t> mContent;