Bug 1310127 - Part 10: Handle netwerk/protocol/http MOZ_MUST_USE functions in PSM. r=wcpan
authorCykesiopka <cykesiopka.bmo@gmail.com>
Wed, 28 Dec 2016 16:25:22 +0800
changeset 346164 685cc73841014ff84f0aa92b227866952df4f9ec
parent 346163 bd6e0e3fa6190231129f1693cbddfcc0cfbb9a04
child 346165 614c0b551ab789f798cb504985df331f5d453d73
push id31459
push usercbook@mozilla.com
push dateTue, 07 Mar 2017 14:05:14 +0000
treeherdermozilla-central@1fb56ba248d5 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerswcpan
bugs1310127
milestone54.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1310127 - Part 10: Handle netwerk/protocol/http MOZ_MUST_USE functions in PSM. r=wcpan The only unhandled call updates nsHTTPListener::mHttpResponseContentType, but nothing actually uses the value of mHttpResponseContentType. MozReview-Commit-ID: FQXESvoO2ZN
security/certverifier/OCSPRequestor.cpp
security/manager/ssl/nsNSSCallbacks.cpp
security/manager/ssl/nsNSSCallbacks.h
--- a/security/certverifier/OCSPRequestor.cpp
+++ b/security/certverifier/OCSPRequestor.cpp
@@ -191,17 +191,17 @@ DoOCSPRequest(const UniquePLArenaPool& a
       return rv;
     }
   }
 
   uint16_t httpResponseCode;
   const char* httpResponseData;
   uint32_t httpResponseDataLen = 0; // 0 means any response size is acceptable
   rv = nsNSSHttpInterface::trySendAndReceiveFcn(requestSession.get(), nullptr,
-                                                &httpResponseCode, nullptr,
+                                                &httpResponseCode,
                                                 nullptr, &httpResponseData,
                                                 &httpResponseDataLen);
   if (rv != Success) {
     return rv;
   }
 
   if (httpResponseCode != 200) {
     return Result::ERROR_OCSP_SERVER_ERROR;
--- a/security/manager/ssl/nsNSSCallbacks.cpp
+++ b/security/manager/ssl/nsNSSCallbacks.cpp
@@ -270,17 +270,16 @@ nsNSSHttpRequestSession::setPostDataFcn(
   mPostContentType.Assign(http_content_type);
 
   return Success;
 }
 
 mozilla::pkix::Result
 nsNSSHttpRequestSession::trySendAndReceiveFcn(PRPollDesc** pPollDesc,
                                               uint16_t* http_response_code,
-                                              const char** http_response_content_type,
                                               const char** http_response_headers,
                                               const char** http_response_data,
                                               uint32_t* http_response_data_len)
 {
   MOZ_LOG(gPIPNSSLog, LogLevel::Debug,
          ("nsNSSHttpRequestSession::trySendAndReceiveFcn to %s\n", mURL.get()));
 
   bool onSTSThread;
@@ -323,17 +322,17 @@ nsNSSHttpRequestSession::trySendAndRecei
       PR_Sleep( PR_MillisecondsToInterval(300) * retry_count );
     }
 
     ++retry_count;
     retryable_error = false;
 
     rv =
       internal_send_receive_attempt(retryable_error, pPollDesc, http_response_code,
-                                    http_response_content_type, http_response_headers,
+                                    http_response_headers,
                                     http_response_data, http_response_data_len);
   }
   while (retryable_error &&
          retry_count < max_retries);
 
   if (retry_count > 1)
   {
     if (retryable_error)
@@ -362,24 +361,22 @@ nsNSSHttpRequestSession::Release()
     delete this;
   }
 }
 
 mozilla::pkix::Result
 nsNSSHttpRequestSession::internal_send_receive_attempt(bool &retryable_error,
                                                        PRPollDesc **pPollDesc,
                                                        uint16_t *http_response_code,
-                                                       const char **http_response_content_type,
                                                        const char **http_response_headers,
                                                        const char **http_response_data,
                                                        uint32_t *http_response_data_len)
 {
   if (pPollDesc) *pPollDesc = nullptr;
   if (http_response_code) *http_response_code = 0;
-  if (http_response_content_type) *http_response_content_type = 0;
   if (http_response_headers) *http_response_headers = 0;
   if (http_response_data) *http_response_data = 0;
 
   uint32_t acceptableResultSize = 0;
 
   if (http_response_data_len)
   {
     acceptableResultSize = *http_response_data_len;
@@ -526,22 +523,16 @@ nsNSSHttpRequestSession::internal_send_r
       return Result::ERROR_OCSP_SERVER_ERROR;
     }
 
     // Return data by reference, result data will be valid until "this" gets
     // destroyed.
     *http_response_data = (const char*)mListener->mResultData;
   }
 
-  if (mListener->mHttpRequestSucceeded && http_response_content_type) {
-    if (mListener->mHttpResponseContentType.Length()) {
-      *http_response_content_type = mListener->mHttpResponseContentType.get();
-    }
-  }
-
   return Success;
 }
 
 nsNSSHttpRequestSession::nsNSSHttpRequestSession()
   : mRefCount(1)
   , mHasPostData(false)
   , mTimeout(0)
   , mListener(new nsHTTPListener)
@@ -643,24 +634,21 @@ nsHTTPListener::OnStreamComplete(nsIStre
     aStatus = NS_SUCCESS_ADOPTED_DATA;
 
     unsigned int rcode;
     rv = hchan->GetResponseStatus(&rcode);
     if (NS_FAILED(rv))
       mHttpResponseCode = 500;
     else
       mHttpResponseCode = rcode;
-
-    hchan->GetResponseHeader(NS_LITERAL_CSTRING("Content-Type"), 
-                                    mHttpResponseContentType);
   }
 
   if (mResponsibleForDoneSignal)
     send_done_signal();
-  
+
   return aStatus;
 }
 
 void nsHTTPListener::send_done_signal()
 {
   mResponsibleForDoneSignal = false;
 
   {
--- a/security/manager/ssl/nsNSSCallbacks.h
+++ b/security/manager/ssl/nsNSSCallbacks.h
@@ -52,17 +52,16 @@ public:
   NS_DECL_NSISTREAMLOADEROBSERVER
 
   nsCOMPtr<nsIStreamLoader> mLoader;
 
   nsresult mResultCode;
 
   bool mHttpRequestSucceeded;
   uint16_t mHttpResponseCode;
-  nsCString mHttpResponseContentType;
 
   const uint8_t* mResultData; // allocated in loader, but owned by listener
   uint32_t mResultLen;
 
   mozilla::Mutex mLock;
   mozilla::CondVar mCondition;
   volatile bool mWaitFlag;
 
@@ -108,17 +107,16 @@ public:
                   /*out*/ nsNSSHttpRequestSession** pRequest);
 
   Result setPostDataFcn(const char* httpData,
                         const uint32_t httpDataLen,
                         const char* httpContentType);
 
   Result trySendAndReceiveFcn(PRPollDesc** pPollDesc,
                               uint16_t* httpResponseCode,
-                              const char** httpResponseContentType,
                               const char** httpResponseHeaders,
                               const char** httpResponseData,
                               uint32_t* httpResponseDataLen);
 
   void AddRef();
   void Release();
 
   nsCString mURL;
@@ -136,17 +134,16 @@ public:
 
 protected:
   nsNSSHttpRequestSession();
   ~nsNSSHttpRequestSession();
 
   Result internal_send_receive_attempt(bool& retryableError,
                                        PRPollDesc** pPollDesc,
                                        uint16_t* httpResponseCode,
-                                       const char** httpResponseContentType,
                                        const char** httpResponseHeaders,
                                        const char** httpResponseData,
                                        uint32_t* httpResponseDataLen);
 };
 
 class nsNSSHttpInterface
 {
 public:
@@ -179,21 +176,19 @@ public:
                                const char* httpContentType)
   {
     return request->setPostDataFcn(httpData, httpDataLen, httpContentType);
   }
 
   static Result trySendAndReceiveFcn(nsNSSHttpRequestSession* request,
                                      PRPollDesc** pPollDesc,
                                      uint16_t* httpResponseCode,
-                                     const char** httpResponseContentType,
                                      const char** httpResponseHeaders,
                                      const char** httpResponseData,
                                      uint32_t* httpResponseDataLen)
   {
     return request->trySendAndReceiveFcn(pPollDesc, httpResponseCode,
-                                         httpResponseContentType,
                                          httpResponseHeaders,
                                          httpResponseData, httpResponseDataLen);
   }
 };
 
 #endif // nsNSSCallbacks_h