--- a/netwerk/base/nsIncrementalDownload.cpp
+++ b/netwerk/base/nsIncrementalDownload.cpp
@@ -297,25 +297,38 @@ nsIncrementalDownload::ProcessTimeout()
if (mInterval || mCurrentSize != int64_t(0)) {
nsAutoCString range;
MakeRangeSpec(mCurrentSize, mTotalSize, mChunkSize, mInterval == 0, range);
rv = http->SetRequestHeader(NS_LITERAL_CSTRING("Range"), range, false);
if (NS_FAILED(rv))
return rv;
- if (!mPartialValidator.IsEmpty())
- http->SetRequestHeader(NS_LITERAL_CSTRING("If-Range"),
- mPartialValidator, false);
+ if (!mPartialValidator.IsEmpty()) {
+ rv = http->SetRequestHeader(NS_LITERAL_CSTRING("If-Range"),
+ mPartialValidator, false);
+ if (NS_FAILED(rv)) {
+ LOG(("nsIncrementalDownload::ProcessTimeout\n"
+ " failed to set request header: If-Range\n"));
+ }
+ }
if (mCacheBust) {
- http->SetRequestHeader(NS_LITERAL_CSTRING("Cache-Control"),
- NS_LITERAL_CSTRING("no-cache"), false);
- http->SetRequestHeader(NS_LITERAL_CSTRING("Pragma"),
- NS_LITERAL_CSTRING("no-cache"), false);
+ rv = http->SetRequestHeader(NS_LITERAL_CSTRING("Cache-Control"),
+ NS_LITERAL_CSTRING("no-cache"), false);
+ if (NS_FAILED(rv)) {
+ LOG(("nsIncrementalDownload::ProcessTimeout\n"
+ " failed to set request header: If-Range\n"));
+ }
+ rv = http->SetRequestHeader(NS_LITERAL_CSTRING("Pragma"),
+ NS_LITERAL_CSTRING("no-cache"), false);
+ if (NS_FAILED(rv)) {
+ LOG(("nsIncrementalDownload::ProcessTimeout\n"
+ " failed to set request header: If-Range\n"));
+ }
}
}
rv = channel->AsyncOpen2(this);
if (NS_FAILED(rv))
return rv;
// Wait to assign mChannel when we know we are going to succeed. This is
@@ -657,21 +670,26 @@ nsIncrementalDownload::OnStartRequest(ns
}
// Do special processing after the first response.
if (mTotalSize == int64_t(-1)) {
// Update knowledge of mFinalURI
rv = http->GetURI(getter_AddRefs(mFinalURI));
if (NS_FAILED(rv))
return rv;
- http->GetResponseHeader(NS_LITERAL_CSTRING("Etag"), mPartialValidator);
+ Unused << http->GetResponseHeader(NS_LITERAL_CSTRING("Etag"), mPartialValidator);
if (StringBeginsWith(mPartialValidator, NS_LITERAL_CSTRING("W/")))
mPartialValidator.Truncate(); // don't use weak validators
- if (mPartialValidator.IsEmpty())
- http->GetResponseHeader(NS_LITERAL_CSTRING("Last-Modified"), mPartialValidator);
+ if (mPartialValidator.IsEmpty()) {
+ rv = http->GetResponseHeader(NS_LITERAL_CSTRING("Last-Modified"), mPartialValidator);
+ if (NS_FAILED(rv)) {
+ LOG(("nsIncrementalDownload::OnStartRequest\n"
+ " empty validator\n"));
+ }
+ }
if (code == 206) {
// OK, read the Content-Range header to determine the total size of this
// download file.
nsAutoCString buf;
rv = http->GetResponseHeader(NS_LITERAL_CSTRING("Content-Range"), buf);
if (NS_FAILED(rv))
return rv;
@@ -864,30 +882,38 @@ nsIncrementalDownload::AsyncOnChannelRed
NS_NAMED_LITERAL_CSTRING(rangeHdr, "Range");
nsresult rv = ClearRequestHeader(newHttpChannel);
if (NS_FAILED(rv))
return rv;
// If we didn't have a Range header, then we must be doing a full download.
nsAutoCString rangeVal;
- http->GetRequestHeader(rangeHdr, rangeVal);
+ Unused << http->GetRequestHeader(rangeHdr, rangeVal);
if (!rangeVal.IsEmpty()) {
rv = newHttpChannel->SetRequestHeader(rangeHdr, rangeVal, false);
NS_ENSURE_SUCCESS(rv, rv);
}
// A redirection changes the validator
mPartialValidator.Truncate();
if (mCacheBust) {
- newHttpChannel->SetRequestHeader(NS_LITERAL_CSTRING("Cache-Control"),
- NS_LITERAL_CSTRING("no-cache"), false);
- newHttpChannel->SetRequestHeader(NS_LITERAL_CSTRING("Pragma"),
- NS_LITERAL_CSTRING("no-cache"), false);
+ rv = newHttpChannel->SetRequestHeader(NS_LITERAL_CSTRING("Cache-Control"),
+ NS_LITERAL_CSTRING("no-cache"), false);
+ if (NS_FAILED(rv)) {
+ LOG(("nsIncrementalDownload::AsyncOnChannelRedirect\n"
+ " failed to set request header: Cache-Control\n"));
+ }
+ rv = newHttpChannel->SetRequestHeader(NS_LITERAL_CSTRING("Pragma"),
+ NS_LITERAL_CSTRING("no-cache"), false);
+ if (NS_FAILED(rv)) {
+ LOG(("nsIncrementalDownload::AsyncOnChannelRedirect\n"
+ " failed to set request header: Pragma\n"));
+ }
}
// Prepare to receive callback
mRedirectCallback = cb;
mNewRedirectChannel = newChannel;
// Give the observer a chance to see this redirect notification.
nsCOMPtr<nsIChannelEventSink> sink = do_GetInterface(mObserver);
--- a/netwerk/base/nsPACMan.cpp
+++ b/netwerk/base/nsPACMan.cpp
@@ -37,18 +37,20 @@ static bool
HttpRequestSucceeded(nsIStreamLoader *loader)
{
nsCOMPtr<nsIRequest> request;
loader->GetRequest(getter_AddRefs(request));
bool result = true; // default to assuming success
nsCOMPtr<nsIHttpChannel> httpChannel = do_QueryInterface(request);
- if (httpChannel)
- httpChannel->GetRequestSucceeded(&result);
+ if (httpChannel) {
+ // failsafe
+ Unused << httpChannel->GetRequestSucceeded(&result);
+ }
return result;
}
//-----------------------------------------------------------------------------
// The ExecuteCallback runnable is triggered by
// nsPACManCallback::OnQueryComplete on the Main thread when its completion is
--- a/netwerk/protocol/http/AlternateServices.cpp
+++ b/netwerk/protocol/http/AlternateServices.cpp
@@ -616,19 +616,19 @@ public:
if (accepted) {
MOZ_ASSERT(!mMapping->HTTPS()); // https:// does not use .wk
nsresult rv = uu->Verify(mTransactionAlternate->mWKResponse, mOrigin, mAlternatePort);
if (NS_SUCCEEDED(rv)) {
bool validWK = false;
bool mixedScheme = false;
int32_t lifetime = 0;
- uu->GetValid(&validWK);
- uu->GetLifetime(&lifetime);
- uu->GetMixed(&mixedScheme);
+ Unused << uu->GetValid(&validWK);
+ Unused << uu->GetLifetime(&lifetime);
+ Unused << uu->GetMixed(&mixedScheme);
if (!validWK) {
LOG(("WellKnownChecker::Done %p json parser declares invalid\n%s\n", this, mTransactionAlternate->mWKResponse.get()));
accepted = false;
}
if (accepted && (lifetime > 0)) {
if (mMapping->TTL() > lifetime) {
LOG(("WellKnownChecker::Done %p atl-svc lifetime reduced by .wk\n", this));
mMapping->SetExpiresAt(NowInSeconds() + lifetime);
@@ -898,17 +898,22 @@ AltSvcCache::UpdateAltServiceMapping(Alt
if (map->HTTPS()) {
LOG(("AltSvcCache::UpdateAltServiceMapping %p validation via "
"speculative connect started\n", this));
// for https resources we only establish a connection
nsCOMPtr<nsIInterfaceRequestor> callbacks = new AltSvcOverride(aCallbacks);
RefPtr<AltSvcTransaction> nullTransaction =
new AltSvcTransaction(map, ci, aCallbacks, caps);
- gHttpHandler->ConnMgr()->SpeculativeConnect(ci, callbacks, caps, nullTransaction);
+ nsresult rv = gHttpHandler->ConnMgr()->SpeculativeConnect(ci, callbacks, caps, nullTransaction);
+ if (NS_FAILED(rv)) {
+ LOG(("AltSvcCache::UpdateAltServiceMapping %p "
+ "speculative connect failed with code %08x\n", this,
+ static_cast<uint32_t>(rv)));
+ }
} else {
// for http:// resources we fetch .well-known too
nsAutoCString origin (NS_LITERAL_CSTRING("http://") + map->OriginHost());
if (map->OriginPort() != NS_HTTP_DEFAULT_PORT) {
origin.Append(':');
origin.AppendInt(map->OriginPort());
}
--- a/netwerk/protocol/http/ConnectionDiagnostics.cpp
+++ b/netwerk/protocol/http/ConnectionDiagnostics.cpp
@@ -20,17 +20,21 @@
#include "mozilla/SizePrintfMacros.h"
namespace mozilla {
namespace net {
void
nsHttpConnectionMgr::PrintDiagnostics()
{
- PostEvent(&nsHttpConnectionMgr::OnMsgPrintDiagnostics, 0, nullptr);
+ nsresult rv = PostEvent(&nsHttpConnectionMgr::OnMsgPrintDiagnostics, 0, nullptr);
+ if (NS_FAILED(rv)) {
+ LOG(("nsHttpConnectionMgr::PrintDiagnostics\n"
+ " failed to post OnMsgPrintDiagnostics event"));
+ }
}
void
nsHttpConnectionMgr::OnMsgPrintDiagnostics(int32_t, ARefBase *)
{
MOZ_ASSERT(PR_GetCurrentThread() == gSocketThread);
nsCOMPtr<nsIConsoleService> consoleService =
--- a/netwerk/protocol/http/Http2Session.cpp
+++ b/netwerk/protocol/http/Http2Session.cpp
@@ -288,17 +288,17 @@ Http2Session::ReadTimeoutTick(PRInterval
LOG3(("Http2Session::ReadTimeoutTick %p generating ping\n", this));
mPingSentEpoch = PR_IntervalNow();
if (!mPingSentEpoch) {
mPingSentEpoch = 1; // avoid the 0 sentinel value
}
GeneratePing(false);
- ResumeRecv(); // read the ping reply
+ Unused << ResumeRecv(); // read the ping reply
// Check for orphaned push streams. This looks expensive, but generally the
// list is empty.
Http2PushedStream *deleteMe;
TimeStamp timestampNow;
do {
deleteMe = nullptr;
@@ -384,17 +384,22 @@ Http2Session::AddStream(nsAHttpTransacti
}
if (mClosed || mShouldGoAway) {
nsHttpTransaction *trans = aHttpTransaction->QueryHttpTransaction();
if (trans && !trans->GetPushedStream()) {
LOG3(("Http2Session::AddStream %p atrans=%p trans=%p session unusable - resched.\n",
this, aHttpTransaction, trans));
aHttpTransaction->SetConnection(nullptr);
- gHttpHandler->InitiateTransaction(trans, trans->Priority());
+ nsresult rv = gHttpHandler->InitiateTransaction(trans, trans->Priority());
+ if (NS_FAILED(rv)) {
+ LOG3(("Http2Session::AddStream %p atrans=%p trans=%p failed to initiate "
+ "transaction (%08x).\n", this, aHttpTransaction, trans,
+ static_cast<uint32_t>(rv)));
+ }
return true;
}
}
aHttpTransaction->SetConnection(this);
if (aUseTunnel) {
LOG3(("Http2Session::AddStream session=%p trans=%p OnTunnel",
@@ -413,17 +418,17 @@ Http2Session::AddStream(nsAHttpTransacti
mReadyForWrite.Push(stream);
SetWriteCallbacks();
// Kick off the SYN transmit without waiting for the poll loop
// This won't work for the first stream because there is no segment reader
// yet.
if (mSegmentReader) {
uint32_t countRead;
- ReadSegments(nullptr, kDefaultBufferSize, &countRead);
+ Unused << ReadSegments(nullptr, kDefaultBufferSize, &countRead);
}
if (!(aHttpTransaction->Caps() & NS_HTTP_ALLOW_KEEPALIVE) &&
!aHttpTransaction->IsNullTransaction()) {
LOG3(("Http2Session::AddStream %p transaction %p forces keep-alive off.\n",
this, aHttpTransaction));
DontReuse();
}
@@ -488,18 +493,19 @@ Http2Session::NetworkRead(nsAHttpSegment
if (NS_SUCCEEDED(rv) && *countWritten > 0)
mLastReadEpoch = PR_IntervalNow();
return rv;
}
void
Http2Session::SetWriteCallbacks()
{
- if (mConnection && (GetWriteQueueSize() || mOutputQueueUsed))
- mConnection->ResumeSend();
+ if (mConnection && (GetWriteQueueSize() || mOutputQueueUsed)) {
+ Unused << mConnection->ResumeSend();
+ }
}
void
Http2Session::RealignOutputQueue()
{
if (mAttemptingEarlyData) {
// We can't realign right now, because we may need what's in there if early
// data fails.
@@ -1372,19 +1378,23 @@ Http2Session::ResponseHeadersComplete()
mFlatHTTPResponseHeadersOut = 0;
rv = mInputFrameDataStream->ConvertResponseHeaders(&mDecompressor,
mDecompressBuffer,
mFlatHTTPResponseHeaders,
httpResponseCode);
if (rv == NS_ERROR_ABORT) {
LOG(("Http2Session::ResponseHeadersComplete ConvertResponseHeaders aborted\n"));
if (mInputFrameDataStream->IsTunnel()) {
- gHttpHandler->ConnMgr()->CancelTransactions(
+ rv = gHttpHandler->ConnMgr()->CancelTransactions(
mInputFrameDataStream->Transaction()->ConnectionInfo(),
NS_ERROR_CONNECTION_REFUSED);
+ if (NS_FAILED(rv)) {
+ LOG(("Http2Session::ResponseHeadersComplete "
+ "CancelTransactions failed: %08x\n", static_cast<uint32_t>(rv)));
+ }
}
CleanupStream(mInputFrameDataStream, rv, CANCEL_ERROR);
ResetDownstreamState();
return NS_OK;
} else if (NS_FAILED(rv)) {
return rv;
}
@@ -1768,17 +1778,17 @@ Http2Session::RecvPushPromise(Http2Sessi
}
if (promisedID > self->mOutgoingGoAwayID)
self->mOutgoingGoAwayID = promisedID;
// Fake the request side of the pushed HTTP transaction. Sets up hash
// key and origin
uint32_t notUsed;
- pushedStream->ReadSegments(nullptr, 1, ¬Used);
+ Unused << pushedStream->ReadSegments(nullptr, 1, ¬Used);
nsAutoCString key;
if (!pushedStream->GetHashKey(key)) {
LOG3(("Http2Session::RecvPushPromise one of :authority :scheme :path missing from push\n"));
self->CleanupStream(pushedStream, NS_ERROR_FAILURE, PROTOCOL_ERROR);
self->ResetDownstreamState();
return NS_OK;
}
@@ -2415,17 +2425,17 @@ Http2Session::ReadSegmentsAgain(nsAHttpS
// Not every permutation of stream->ReadSegents produces data (and therefore
// tries to flush the output queue) - SENDING_FIN_STREAM can be an example
// of that. But we might still have old data buffered that would be good
// to flush.
FlushOutputQueue();
// Allow new server reads - that might be data or control information
// (e.g. window updates or http replies) that are responses to these writes
- ResumeRecv();
+ Unused << ResumeRecv();
if (stream->RequestBlockedOnRead()) {
// We are blocked waiting for input - either more http headers or
// any request body data. When more data from the request stream
// becomes available the httptransaction will call conn->ResumeSend().
LOG3(("Http2Session::ReadSegments %p dealing with block on read", this));
@@ -2832,17 +2842,20 @@ Http2Session::WriteSegmentsAgain(nsAHttp
LOG3(("Http2Session::WriteSegments session=%p id 0x%X "
"needscleanup=%p. cleanup stream based on "
"stream->writeSegments returning code %" PRIx32 "\n",
this, streamID, mNeedsCleanup, static_cast<uint32_t>(rv)));
MOZ_ASSERT(!mNeedsCleanup || mNeedsCleanup->StreamID() == streamID);
CleanupStream(streamID, NS_OK, CANCEL_ERROR);
mNeedsCleanup = nullptr;
*again = false;
- ResumeRecv();
+ rv = ResumeRecv();
+ if (NS_FAILED(rv)) {
+ LOG3(("ResumeRecv returned code %x", static_cast<uint32_t>(rv)));
+ }
return NS_OK;
}
if (mNeedsCleanup) {
LOG3(("Http2Session::WriteSegments session=%p stream=%p 0x%X "
"cleanup stream based on mNeedsCleanup.\n",
this, mNeedsCleanup, mNeedsCleanup ? mNeedsCleanup->StreamID() : 0));
CleanupStream(mNeedsCleanup, NS_OK, CANCEL_ERROR);
@@ -2865,17 +2878,17 @@ Http2Session::WriteSegmentsAgain(nsAHttp
char trash[4096];
uint32_t discardCount = std::min(mInputFrameDataSize - mInputFrameDataRead,
4096U);
LOG3(("Http2Session::WriteSegments %p trying to discard %d bytes of data",
this, discardCount));
if (!discardCount) {
ResetDownstreamState();
- ResumeRecv();
+ Unused << ResumeRecv();
return NS_BASE_STREAM_WOULD_BLOCK;
}
rv = NetworkRead(writer, trash, discardCount, countWritten);
if (NS_FAILED(rv)) {
LOG3(("Http2Session %p discard frame read failure %" PRIx32 "\n", this,
static_cast<uint32_t>(rv)));
@@ -2999,17 +3012,17 @@ Http2Session::Finish0RTT(bool aRestart,
} else {
// This is the easy case - early data failed, but we're speaking h2, so
// we just need to rewind to the beginning of the preamble and try again.
mOutputQueueSent = 0;
}
} else {
// 0RTT succeeded
// Make sure we look for any incoming data in repsonse to our early data.
- ResumeRecv();
+ Unused << ResumeRecv();
}
mAttemptingEarlyData = false;
m0RTTStreams.Clear();
RealignOutputQueue();
return NS_OK;
}
@@ -3038,17 +3051,17 @@ Http2Session::ProcessConnectedPush(Http2
rv = NS_OK;
}
// if we return OK to nsHttpConnection it will use mSocketInCondition
// to determine whether to schedule more reads, incorrectly
// assuming that nsHttpConnection::OnSocketWrite() was called.
if (NS_SUCCEEDED(rv) || rv == NS_BASE_STREAM_WOULD_BLOCK) {
rv = NS_BASE_STREAM_WOULD_BLOCK;
- ResumeRecv();
+ Unused << ResumeRecv();
}
return rv;
}
nsresult
Http2Session::ProcessSlowConsumer(Http2Stream *slowConsumer,
nsAHttpSegmentWriter * writer,
uint32_t count, uint32_t *countWritten)
@@ -3254,17 +3267,22 @@ Http2Session::CloseTransaction(nsAHttpTr
LOG3(("Http2Session::CloseTransaction %p %p %" PRIx32 " - not found.",
this, aTransaction, static_cast<uint32_t>(aResult)));
return;
}
LOG3(("Http2Session::CloseTransaction probably a cancel. "
"this=%p, trans=%p, result=%" PRIx32 ", streamID=0x%X stream=%p",
this, aTransaction, static_cast<uint32_t>(aResult), stream->StreamID(), stream));
CleanupStream(stream, aResult, CANCEL_ERROR);
- ResumeRecv();
+ nsresult rv = ResumeRecv();
+ if (NS_FAILED(rv)) {
+ LOG3(("Http2Session::CloseTransaction %p %p %x ResumeRecv returned %x",
+ this, aTransaction, static_cast<uint32_t>(aResult),
+ static_cast<uint32_t>(rv)));
+ }
}
//-----------------------------------------------------------------------------
// nsAHttpSegmentReader
//-----------------------------------------------------------------------------
nsresult
Http2Session::OnReadSegment(const char *buf,
@@ -3475,26 +3493,26 @@ Http2Session::SetNeedsCleanup()
mNeedsCleanup = mInputFrameDataStream;
ResetDownstreamState();
}
void
Http2Session::ConnectPushedStream(Http2Stream *stream)
{
mPushesReadyForRead.Push(stream);
- ForceRecv();
+ Unused << ForceRecv();
}
void
Http2Session::ConnectSlowConsumer(Http2Stream *stream)
{
LOG3(("Http2Session::ConnectSlowConsumer %p 0x%X\n",
this, stream->StreamID()));
mSlowConsumersReadyForRead.Push(stream);
- ForceRecv();
+ Unused << ForceRecv();
}
uint32_t
Http2Session::FindTunnelCount(nsHttpConnectionInfo *aConnInfo)
{
MOZ_ASSERT(PR_GetCurrentThread() == gSocketThread);
uint32_t rv = 0;
mTunnelHash.Get(aConnInfo->HashKey(), &rv);
@@ -3570,17 +3588,21 @@ Http2Session::DispatchOnTunnel(nsAHttpTr
CreateTunnel(trans, ci, aCallbacks);
} else {
// requeue it. The connection manager is responsible for actually putting
// this on the tunnel connection with the specific ci. If that can't
// happen the cmgr checks with us via MaybeReTunnel() to see if it should
// make a new tunnel or just wait longer.
LOG3(("Http2Session::DispatchOnTunnel %p trans=%p queue in connection manager",
this, trans));
- gHttpHandler->InitiateTransaction(trans, trans->Priority());
+ nsresult rv = gHttpHandler->InitiateTransaction(trans, trans->Priority());
+ if (NS_FAILED(rv)) {
+ LOG3(("Http2Session::DispatchOnTunnel %p trans=%p failed to initiate "
+ "transaction (%08x)", this, trans, static_cast<uint32_t>(rv)));
+ }
}
}
// From ASpdySession
bool
Http2Session::MaybeReTunnel(nsAHttpTransaction *aHttpTransaction)
{
MOZ_ASSERT(PR_GetCurrentThread() == gSocketThread);
@@ -3589,17 +3611,21 @@ Http2Session::MaybeReTunnel(nsAHttpTrans
if (!trans || trans->TunnelProvider() != this) {
// this isn't really one of our transactions.
return false;
}
if (mClosed || mShouldGoAway) {
LOG(("Http2Session::MaybeReTunnel %p %p session closed - requeue\n", this, trans));
trans->SetTunnelProvider(nullptr);
- gHttpHandler->InitiateTransaction(trans, trans->Priority());
+ nsresult rv = gHttpHandler->InitiateTransaction(trans, trans->Priority());
+ if (NS_FAILED(rv)) {
+ LOG3(("Http2Session::MaybeReTunnel %p trans=%p failed to initiate "
+ "transaction (%08x)", this, trans, static_cast<uint32_t>(rv)));
+ }
return true;
}
nsHttpConnectionInfo *ci = aHttpTransaction->ConnectionInfo();
LOG(("Http2Session:MaybeReTunnel %p %p count=%d limit %d\n",
this, trans, FindTunnelCount(ci), gHttpHandler->MaxConnectionsPerOrigin()));
if (FindTunnelCount(ci) >= gHttpHandler->MaxConnectionsPerOrigin()) {
// patience - a tunnel will open up.
@@ -3749,17 +3775,17 @@ Http2Session::TransactionHasDataToWrite(
} else {
LOG3(("Http2Session::TransactionHasDataToWrite %p closed so not setting Ready4Write\n",
this));
}
// NSPR poll will not poll the network if there are non system PR_FileDesc's
// that are ready - so we can get into a deadlock waiting for the system IO
// to come back here if we don't force the send loop manually.
- ForceSend();
+ Unused << ForceSend();
}
void
Http2Session::TransactionHasDataToRecv(nsAHttpTransaction *caller)
{
MOZ_ASSERT(PR_GetCurrentThread() == gSocketThread);
LOG3(("Http2Session::TransactionHasDataToRecv %p trans=%p", this, caller));
@@ -3780,17 +3806,17 @@ void
Http2Session::TransactionHasDataToWrite(Http2Stream *stream)
{
MOZ_ASSERT(PR_GetCurrentThread() == gSocketThread);
LOG3(("Http2Session::TransactionHasDataToWrite %p stream=%p ID=0x%x",
this, stream, stream->StreamID()));
mReadyForWrite.Push(stream);
SetWriteCallbacks();
- ForceSend();
+ Unused << ForceSend();
}
bool
Http2Session::IsPersistent()
{
return true;
}
@@ -3958,13 +3984,13 @@ Http2Session::SendPing()
}
if (!mPingThreshold ||
(mPingThreshold > gHttpHandler->NetworkChangedTimeout())) {
mPreviousPingThreshold = mPingThreshold;
mPreviousUsed = true;
mPingThreshold = gHttpHandler->NetworkChangedTimeout();
}
GeneratePing(false);
- ResumeRecv();
+ Unused << ResumeRecv();
}
} // namespace net
} // namespace mozilla
--- a/netwerk/protocol/http/Http2Stream.cpp
+++ b/netwerk/protocol/http/Http2Stream.cpp
@@ -173,17 +173,17 @@ Http2Stream::ReadSegments(nsAHttpSegment
// A transaction that had already generated its headers before it was
// queued at the session level (due to concurrency concerns) may not call
// onReadSegment off the ReadSegments() stack above.
if (mUpstreamState == GENERATING_HEADERS && NS_SUCCEEDED(rv)) {
LOG3(("Http2Stream %p ReadSegments forcing OnReadSegment call\n", this));
uint32_t wasted = 0;
mSegmentReader = reader;
- OnReadSegment("", 0, &wasted);
+ Unused << OnReadSegment("", 0, &wasted);
mSegmentReader = nullptr;
}
// If the sending flow control window is open (!mBlockedOnRwin) then
// continue sending the request
if (!mBlockedOnRwin && mOpenGenerated &&
!mTxInlineFrameUsed && NS_SUCCEEDED(rv) && (!*countRead)) {
MOZ_ASSERT(!mQueued);
@@ -1446,17 +1446,22 @@ Http2Stream::OnWriteSegment(char *buf,
void
Http2Stream::ClearTransactionsBlockedOnTunnel()
{
MOZ_ASSERT(PR_GetCurrentThread() == gSocketThread);
if (!mIsTunnel) {
return;
}
- gHttpHandler->ConnMgr()->ProcessPendingQ(mTransaction->ConnectionInfo());
+ nsresult rv = gHttpHandler->ConnMgr()->ProcessPendingQ(mTransaction->ConnectionInfo());
+ if (NS_FAILED(rv)) {
+ LOG3(("Http2Stream::ClearTransactionsBlockedOnTunnel %p\n"
+ " ProcessPendingQ failed: %08x\n",
+ this, static_cast<uint32_t>(rv)));
+ }
}
void
Http2Stream::MapStreamToPlainText()
{
RefPtr<SpdyConnectTransaction> qiTrans(mTransaction->QuerySpdyConnectTransaction());
MOZ_ASSERT(qiTrans);
mPlainTextTunnel = true;
--- a/netwerk/protocol/http/HttpBaseChannel.cpp
+++ b/netwerk/protocol/http/HttpBaseChannel.cpp
@@ -1161,17 +1161,17 @@ NS_IMETHODIMP
HttpBaseChannel::GetContentEncodings(nsIUTF8StringEnumerator** aEncodings)
{
if (!mResponseHead) {
*aEncodings = nullptr;
return NS_OK;
}
nsAutoCString encoding;
- mResponseHead->GetHeader(nsHttp::Content_Encoding, encoding);
+ Unused << mResponseHead->GetHeader(nsHttp::Content_Encoding, encoding);
if (encoding.IsEmpty()) {
*aEncodings = nullptr;
return NS_OK;
}
nsContentEncodings* enumerator = new nsContentEncodings(this,
encoding.get());
NS_ADDREF(*aEncodings = enumerator);
return NS_OK;
@@ -2258,20 +2258,20 @@ HttpBaseChannel::SetCookie(const char *a
// empty header isn't an error
if (!(aCookieHeader && *aCookieHeader))
return NS_OK;
nsICookieService *cs = gHttpHandler->GetCookieService();
NS_ENSURE_TRUE(cs, NS_ERROR_FAILURE);
nsAutoCString date;
- mResponseHead->GetHeader(nsHttp::Date, date);
- nsresult rv =
- cs->SetCookieStringFromHttp(mURI, nullptr, nullptr, aCookieHeader,
- date.get(), this);
+ // empty date is not an error
+ Unused << mResponseHead->GetHeader(nsHttp::Date, date);
+ nsresult rv = cs->SetCookieStringFromHttp(mURI, nullptr, nullptr,
+ aCookieHeader, date.get(), this);
if (NS_SUCCEEDED(rv)) {
NotifySetCookie(aCookieHeader);
}
return rv;
}
NS_IMETHODIMP
HttpBaseChannel::GetThirdPartyFlags(uint32_t *aFlags)
@@ -2761,25 +2761,25 @@ HttpBaseChannel::GetEntityID(nsACString&
uint64_t size = UINT64_MAX;
nsAutoCString etag, lastmod;
if (mResponseHead) {
// Don't return an entity if the server sent the following header:
// Accept-Ranges: none
// Not sending the Accept-Ranges header means we can still try
// sending range requests.
nsAutoCString acceptRanges;
- mResponseHead->GetHeader(nsHttp::Accept_Ranges, acceptRanges);
+ Unused << mResponseHead->GetHeader(nsHttp::Accept_Ranges, acceptRanges);
if (!acceptRanges.IsEmpty() &&
!nsHttp::FindToken(acceptRanges.get(), "bytes", HTTP_HEADER_VALUE_SEPS)) {
return NS_ERROR_NOT_RESUMABLE;
}
size = mResponseHead->TotalEntitySize();
- mResponseHead->GetHeader(nsHttp::Last_Modified, lastmod);
- mResponseHead->GetHeader(nsHttp::ETag, etag);
+ Unused << mResponseHead->GetHeader(nsHttp::Last_Modified, lastmod);
+ Unused << mResponseHead->GetHeader(nsHttp::ETag, etag);
}
nsCString entityID;
NS_EscapeURL(etag.BeginReading(), etag.Length(), esc_AlwaysCopy |
esc_FileBaseName | esc_Forced, entityID);
entityID.Append('/');
entityID.AppendInt(int64_t(size));
entityID.Append('/');
entityID.Append(lastmod);
@@ -3185,17 +3185,17 @@ HttpBaseChannel::SetupReplacementChannel
// it. But we want to end up with a void string, not an empty string,
// because ExplicitSetUploadStream treats the former as "no header" and
// the latter as "header with empty string value".
nsresult ctypeOK = mRequestHead.GetHeader(nsHttp::Content_Type, ctype);
if (NS_FAILED(ctypeOK)) {
ctype.SetIsVoid(true);
}
nsAutoCString clen;
- mRequestHead.GetHeader(nsHttp::Content_Length, clen);
+ Unused << mRequestHead.GetHeader(nsHttp::Content_Length, clen);
nsAutoCString method;
mRequestHead.Method(method);
int64_t len = clen.IsEmpty() ? -1 : nsCRT::atoll(clen.get());
uploadChannel2->ExplicitSetUploadStream(
mUploadStream, ctype, len,
method,
mUploadStreamHasHeaders);
} else {
--- a/netwerk/protocol/http/HttpChannelChild.cpp
+++ b/netwerk/protocol/http/HttpChannelChild.cpp
@@ -2004,17 +2004,17 @@ HttpChannelChild::AsyncOpen(nsIStreamLis
// add ourselves to the load group.
if (mLoadGroup)
mLoadGroup->AddRequest(this, nullptr);
if (mCanceled) {
// We may have been canceled already, either by on-modify-request
// listeners or by load group observers; in that case, don't create IPDL
// connection. See nsHttpChannel::AsyncOpen().
- AsyncAbort(mStatus);
+ Unused << AsyncAbort(mStatus);
return NS_OK;
}
// Set user agent override from docshell
HttpBaseChannel::SetDocshellUserAgentOverride();
MOZ_ASSERT_IF(mPostRedirectChannelShouldUpgrade,
mPostRedirectChannelShouldIntercept);
@@ -2841,17 +2841,17 @@ HttpChannelChild::ResetInterception()
// The chance to intercept any further requests associated with this channel
// (such as redirects) has passed.
mLoadFlags |= LOAD_BYPASS_SERVICE_WORKER;
// Continue with the original cross-process request
nsresult rv = ContinueAsyncOpen();
if (NS_WARN_IF(NS_FAILED(rv))) {
- AsyncAbort(rv);
+ Unused << AsyncAbort(rv);
}
}
NS_IMETHODIMP
HttpChannelChild::GetResponseSynthesized(bool* aSynthesized)
{
NS_ENSURE_ARG_POINTER(aSynthesized);
*aSynthesized = mSynthesizedResponse;
--- a/netwerk/protocol/http/HttpChannelParent.cpp
+++ b/netwerk/protocol/http/HttpChannelParent.cpp
@@ -1648,18 +1648,18 @@ HttpChannelParent::StartDiversion()
}
mDivertedOnStartRequest = true;
// After OnStartRequest has been called, setup content decoders if needed.
//
// Create a content conversion chain based on mDivertListener and update
// mDivertListener.
nsCOMPtr<nsIStreamListener> converterListener;
- mChannel->DoApplyContentConversions(mDivertListener,
- getter_AddRefs(converterListener));
+ Unused << mChannel->DoApplyContentConversions(mDivertListener,
+ getter_AddRefs(converterListener));
if (converterListener) {
mDivertListener = converterListener.forget();
}
// Now mParentListener can be diverted to mDivertListener.
DebugOnly<nsresult> rvdbg = mParentListener->DivertTo(mDivertListener);
MOZ_ASSERT(NS_SUCCEEDED(rvdbg));
mDivertListener = nullptr;
--- a/netwerk/protocol/http/NullHttpChannel.cpp
+++ b/netwerk/protocol/http/NullHttpChannel.cpp
@@ -21,18 +21,18 @@ NullHttpChannel::NullHttpChannel()
mAsyncOpenTime = TimeStamp::Now();
}
NullHttpChannel::NullHttpChannel(nsIHttpChannel * chan)
{
nsIScriptSecurityManager* ssm = nsContentUtils::GetSecurityManager();
ssm->GetChannelURIPrincipal(chan, getter_AddRefs(mResourcePrincipal));
- chan->GetResponseHeader(NS_LITERAL_CSTRING("Timing-Allow-Origin"),
- mTimingAllowOriginHeader);
+ Unused << chan->GetResponseHeader(NS_LITERAL_CSTRING("Timing-Allow-Origin"),
+ mTimingAllowOriginHeader);
chan->GetURI(getter_AddRefs(mURI));
chan->GetOriginalURI(getter_AddRefs(mOriginalURI));
mChannelCreationTime = PR_Now();
mChannelCreationTimestamp = TimeStamp::Now();
mAsyncOpenTime = TimeStamp::Now();
nsCOMPtr<nsITimedChannel> timedChanel(do_QueryInterface(chan));
--- a/netwerk/protocol/http/TunnelUtils.cpp
+++ b/netwerk/protocol/http/TunnelUtils.cpp
@@ -327,17 +327,17 @@ TLSFilterTransaction::ReadSegments(nsAHt
mSegmentReader = aReader;
nsresult rv = mTransaction->ReadSegments(this, aCount, outCountRead);
LOG(("TLSFilterTransaction %p called trans->ReadSegments rv=%" PRIx32 " %d\n",
this, static_cast<uint32_t>(rv), *outCountRead));
if (NS_SUCCEEDED(rv) && mReadSegmentBlocked) {
rv = NS_BASE_STREAM_WOULD_BLOCK;
LOG(("TLSFilterTransaction %p read segment blocked found rv=%" PRIx32 "\n",
this, static_cast<uint32_t>(rv)));
- Connection()->ForceSend();
+ Unused << Connection()->ForceSend();
}
return rv;
}
nsresult
TLSFilterTransaction::WriteSegments(nsAHttpSegmentWriter *aWriter,
uint32_t aCount, uint32_t *outCountWritten)
@@ -350,17 +350,17 @@ TLSFilterTransaction::WriteSegments(nsAH
}
mSegmentWriter = aWriter;
nsresult rv = mTransaction->WriteSegments(this, aCount, outCountWritten);
if (NS_SUCCEEDED(rv) && NS_FAILED(mFilterReadCode) && !(*outCountWritten)) {
// nsPipe turns failures into silent OK.. undo that!
rv = mFilterReadCode;
if (Connection() && (mFilterReadCode == NS_BASE_STREAM_WOULD_BLOCK)) {
- Connection()->ResumeRecv();
+ Unused << Connection()->ResumeRecv();
}
}
LOG(("TLSFilterTransaction %p called trans->WriteSegments rv=%" PRIx32 " %d\n",
this, static_cast<uint32_t>(rv), *outCountWritten));
return rv;
}
nsresult
@@ -389,17 +389,17 @@ TLSFilterTransaction::NudgeTunnel(NudgeT
uint32_t notUsed;
int32_t written = PR_Write(mFD, "", 0);
if ((written < 0) && (PR_GetError() != PR_WOULD_BLOCK_ERROR)) {
// fatal handshake failure
LOG(("TLSFilterTransaction %p Fatal Handshake Failure: %d\n", this, PR_GetError()));
return NS_ERROR_FAILURE;
}
- OnReadSegment("", 0, ¬Used);
+ Unused << OnReadSegment("", 0, ¬Used);
// The SSL Layer does some unusual things with PR_Poll that makes it a bad
// match for multiplexed SSL sessions. We work around this by manually polling for
// the moment during the brief handshake phase or otherwise blocked on write.
// Thankfully this is a pretty unusual state. NSPR doesn't help us here -
// asserting when polling without the NSPR IO layer on the bottom of
// the stack. As a follow-on we can do some NSPR and maybe libssl changes
// to make this more event driven, but this is acceptable for getting started.
@@ -968,18 +968,18 @@ SpdyConnectTransaction::SpdyConnectTrans
}
SpdyConnectTransaction::~SpdyConnectTransaction()
{
LOG(("SpdyConnectTransaction dtor %p\n", this));
if (mDrivingTransaction) {
// requeue it I guess. This should be gone.
- gHttpHandler->InitiateTransaction(mDrivingTransaction,
- mDrivingTransaction->Priority());
+ Unused << gHttpHandler->InitiateTransaction(mDrivingTransaction,
+ mDrivingTransaction->Priority());
}
}
void
SpdyConnectTransaction::ForcePlainText()
{
MOZ_ASSERT(PR_GetCurrentThread() == gSocketThread);
MOZ_ASSERT(!mInputDataUsed && !mInputDataSize && !mInputDataOffset);
@@ -1026,17 +1026,17 @@ SpdyConnectTransaction::MapStreamToHttpC
// make the originating transaction stick to the tunneled conn
RefPtr<nsAHttpConnection> wrappedConn =
gHttpHandler->ConnMgr()->MakeConnectionHandle(mTunneledConn);
mDrivingTransaction->SetConnection(wrappedConn);
mDrivingTransaction->MakeSticky();
// jump the priority and start the dispatcher
- gHttpHandler->InitiateTransaction(
+ Unused << gHttpHandler->InitiateTransaction(
mDrivingTransaction, nsISupportsPriority::PRIORITY_HIGHEST - 60);
mDrivingTransaction = nullptr;
}
nsresult
SpdyConnectTransaction::Flush(uint32_t count, uint32_t *countRead)
{
MOZ_ASSERT(PR_GetCurrentThread() == gSocketThread);
@@ -1121,17 +1121,17 @@ SpdyConnectTransaction::ReadSegments(nsA
"due to synthetic reply\n", this, mOutputDataUsed - mOutputDataOffset));
*countRead = mOutputDataUsed - mOutputDataOffset;
mOutputDataOffset = mOutputDataUsed = 0;
mTunneledConn->DontReuse();
return NS_OK;
}
*countRead = 0;
- Flush(count, countRead);
+ Unused << Flush(count, countRead);
if (!mTunnelStreamOut->mCallback) {
return NS_BASE_STREAM_WOULD_BLOCK;
}
nsresult rv =
mTunnelStreamOut->mCallback->OnOutputStreamReady(mTunnelStreamOut);
if (NS_FAILED(rv)) {
return rv;
--- a/netwerk/protocol/http/nsCORSListenerProxy.cpp
+++ b/netwerk/protocol/http/nsCORSListenerProxy.cpp
@@ -1007,17 +1007,17 @@ nsCORSListenerProxy::CheckPreflightNeede
return NS_OK;
}
bool doPreflight = loadInfo->GetForcePreflight();
nsCOMPtr<nsIHttpChannel> http = do_QueryInterface(aChannel);
NS_ENSURE_TRUE(http, NS_ERROR_DOM_BAD_URI);
nsAutoCString method;
- http->GetRequestMethod(method);
+ Unused << http->GetRequestMethod(method);
if (!method.LowerCaseEqualsLiteral("get") &&
!method.LowerCaseEqualsLiteral("post") &&
!method.LowerCaseEqualsLiteral("head")) {
doPreflight = true;
}
// Avoid copying the array here
const nsTArray<nsCString>& loadInfoHeaders = loadInfo->CorsUnsafeHeaders();
@@ -1114,18 +1114,18 @@ NS_IMPL_ISUPPORTS(nsCORSPreflightListene
void
nsCORSPreflightListener::AddResultToCache(nsIRequest *aRequest)
{
nsCOMPtr<nsIHttpChannel> http = do_QueryInterface(aRequest);
NS_ASSERTION(http, "Request was not http");
// The "Access-Control-Max-Age" header should return an age in seconds.
nsAutoCString headerVal;
- http->GetResponseHeader(NS_LITERAL_CSTRING("Access-Control-Max-Age"),
- headerVal);
+ Unused << http->GetResponseHeader(NS_LITERAL_CSTRING("Access-Control-Max-Age"),
+ headerVal);
if (headerVal.IsEmpty()) {
return;
}
// Sanitize the string. We only allow 'delta-seconds' as specified by
// http://dev.w3.org/2006/waf/access-control (digits 0-9 with no leading or
// trailing non-whitespace characters).
uint32_t age = 0;
@@ -1160,18 +1160,19 @@ nsCORSPreflightListener::AddResultToCach
sPreflightCache->GetEntry(uri, mReferrerPrincipal, mWithCredentials,
true);
if (!entry) {
return;
}
// The "Access-Control-Allow-Methods" header contains a comma separated
// list of method names.
- http->GetResponseHeader(NS_LITERAL_CSTRING("Access-Control-Allow-Methods"),
- headerVal);
+ Unused <<
+ http->GetResponseHeader(NS_LITERAL_CSTRING("Access-Control-Allow-Methods"),
+ headerVal);
nsCCharSeparatedTokenizer methods(headerVal, ',');
while(methods.hasMoreTokens()) {
const nsDependentCSubstring& method = methods.nextToken();
if (method.IsEmpty()) {
continue;
}
uint32_t i;
@@ -1190,18 +1191,19 @@ nsCORSPreflightListener::AddResultToCach
newMethod->token = method;
newMethod->expirationTime = expirationTime;
}
}
// The "Access-Control-Allow-Headers" header contains a comma separated
// list of method names.
- http->GetResponseHeader(NS_LITERAL_CSTRING("Access-Control-Allow-Headers"),
- headerVal);
+ Unused <<
+ http->GetResponseHeader(NS_LITERAL_CSTRING("Access-Control-Allow-Headers"),
+ headerVal);
nsCCharSeparatedTokenizer headers(headerVal, ',');
while(headers.hasMoreTokens()) {
const nsDependentCSubstring& header = headers.nextToken();
if (header.IsEmpty()) {
continue;
}
uint32_t i;
@@ -1311,18 +1313,18 @@ nsCORSPreflightListener::CheckPreflightR
if (NS_FAILED(rv) || !succeedded) {
LogBlockedRequest(aRequest, "CORSPreflightDidNotSucceed", nullptr);
return NS_ERROR_DOM_BAD_URI;
}
nsAutoCString headerVal;
// The "Access-Control-Allow-Methods" header contains a comma separated
// list of method names.
- http->GetResponseHeader(NS_LITERAL_CSTRING("Access-Control-Allow-Methods"),
- headerVal);
+ Unused << http->GetResponseHeader(NS_LITERAL_CSTRING("Access-Control-Allow-Methods"),
+ headerVal);
bool foundMethod = mPreflightMethod.EqualsLiteral("GET") ||
mPreflightMethod.EqualsLiteral("HEAD") ||
mPreflightMethod.EqualsLiteral("POST");
nsCCharSeparatedTokenizer methodTokens(headerVal, ',');
while(methodTokens.hasMoreTokens()) {
const nsDependentCSubstring& method = methodTokens.nextToken();
if (method.IsEmpty()) {
continue;
@@ -1336,18 +1338,18 @@ nsCORSPreflightListener::CheckPreflightR
}
if (!foundMethod) {
LogBlockedRequest(aRequest, "CORSMethodNotFound", nullptr);
return NS_ERROR_DOM_BAD_URI;
}
// The "Access-Control-Allow-Headers" header contains a comma separated
// list of header names.
- http->GetResponseHeader(NS_LITERAL_CSTRING("Access-Control-Allow-Headers"),
- headerVal);
+ Unused << http->GetResponseHeader(NS_LITERAL_CSTRING("Access-Control-Allow-Headers"),
+ headerVal);
nsTArray<nsCString> headers;
nsCCharSeparatedTokenizer headerTokens(headerVal, ',');
while(headerTokens.hasMoreTokens()) {
const nsDependentCSubstring& header = headerTokens.nextToken();
if (header.IsEmpty()) {
continue;
}
if (!NS_IsValidHTTPToken(header)) {
@@ -1402,17 +1404,17 @@ nsCORSListenerProxy::StartCORSPreflight(
if (gDisableCORS) {
LogBlockedRequest(aRequestChannel, "CORSDisabled", nullptr);
return NS_ERROR_DOM_BAD_URI;
}
nsAutoCString method;
nsCOMPtr<nsIHttpChannel> httpChannel(do_QueryInterface(aRequestChannel));
NS_ENSURE_TRUE(httpChannel, NS_ERROR_UNEXPECTED);
- httpChannel->GetRequestMethod(method);
+ Unused << httpChannel->GetRequestMethod(method);
nsCOMPtr<nsIURI> uri;
nsresult rv = NS_GetFinalChannelURI(aRequestChannel, getter_AddRefs(uri));
NS_ENSURE_SUCCESS(rv, rv);
nsCOMPtr<nsILoadInfo> originalLoadInfo = aRequestChannel->GetLoadInfo();
MOZ_ASSERT(originalLoadInfo, "can not perform CORS preflight without a loadInfo");
if (!originalLoadInfo) {
--- a/netwerk/protocol/http/nsHttpActivityDistributor.cpp
+++ b/netwerk/protocol/http/nsHttpActivityDistributor.cpp
@@ -34,20 +34,23 @@ public:
, mExtraSizeData(aExtraSizeData)
, mExtraStringData(aExtraStringData)
, mObservers(*aObservers)
{
}
NS_IMETHOD Run() override
{
- for (size_t i = 0 ; i < mObservers.Length() ; i++)
- mObservers[i]->ObserveActivity(mHttpChannel, mActivityType,
- mActivitySubtype, mTimestamp,
- mExtraSizeData, mExtraStringData);
+ for (size_t i = 0 ; i < mObservers.Length() ; i++) {
+ Unused <<
+ mObservers[i]->ObserveActivity(mHttpChannel, mActivityType,
+ mActivitySubtype, mTimestamp,
+ mExtraSizeData,
+ mExtraStringData);
+ }
return NS_OK;
}
private:
virtual ~nsHttpActivityEvent()
{
}
--- a/netwerk/protocol/http/nsHttpChannel.cpp
+++ b/netwerk/protocol/http/nsHttpChannel.cpp
@@ -525,20 +525,26 @@ nsHttpChannel::ContinueConnect()
"CORS preflight must have been finished by the time we "
"do the rest of ContinueConnect");
// we may or may not have a cache entry at this point
if (mCacheEntry) {
// read straight from the cache if possible...
if (mCachedContentIsValid) {
nsRunnableMethod<nsHttpChannel> *event = nullptr;
+ nsresult rv;
if (!mCachedContentIsPartial) {
- AsyncCall(&nsHttpChannel::AsyncOnExamineCachedResponse, &event);
+ rv = AsyncCall(&nsHttpChannel::AsyncOnExamineCachedResponse,
+ &event);
+ if (NS_FAILED(rv)) {
+ LOG((" AsyncCall failed (%08x)",
+ static_cast<uint32_t>(rv)));
+ }
}
- nsresult rv = ReadFromCache(true);
+ rv = ReadFromCache(true);
if (NS_FAILED(rv) && event) {
event->Revoke();
}
// Don't accumulate the cache hit telemetry for intercepted channels.
if (mInterceptCache != INTERCEPTED) {
AccumulateCacheHitTelemetry(kCacheHit);
}
@@ -612,17 +618,17 @@ nsHttpChannel::SpeculativeConnect()
}
nsCOMPtr<nsIInterfaceRequestor> callbacks;
NS_NewNotificationCallbacksAggregation(mCallbacks, mLoadGroup,
getter_AddRefs(callbacks));
if (!callbacks)
return;
- gHttpHandler->SpeculativeConnect(
+ Unused << gHttpHandler->SpeculativeConnect(
mConnectionInfo, callbacks, mCaps & NS_HTTP_DISALLOW_SPDY);
}
void
nsHttpChannel::DoNotifyListenerCleanup()
{
// We don't need this info anymore
CleanRedirectCacheChainIfNecessary();
@@ -1035,17 +1041,18 @@ ProcessXCTO(nsIURI* aURI, nsHttpResponse
{
if (!aURI || !aResponseHead || !aLoadInfo) {
// if there is no uri, no response head or no loadInfo, then there is nothing to do
return NS_OK;
}
// 1) Query the XCTO header and check if 'nosniff' is the first value.
nsAutoCString contentTypeOptionsHeader;
- aResponseHead->GetHeader(nsHttp::X_Content_Type_Options, contentTypeOptionsHeader);
+ Unused << aResponseHead->GetHeader(nsHttp::X_Content_Type_Options,
+ contentTypeOptionsHeader);
if (contentTypeOptionsHeader.IsEmpty()) {
// if there is no XCTO header, then there is nothing to do.
return NS_OK;
}
// XCTO header might contain multiple values which are comma separated, so:
// a) let's skip all subsequent values
// e.g. " NoSniFF , foo " will be " NoSniFF "
int32_t idx = contentTypeOptionsHeader.Find(",");
@@ -1481,17 +1488,23 @@ nsHttpChannel::ProcessFailedProxyConnect
// Confused proxy server or malicious response
default:
rv = NS_ERROR_PROXY_CONNECTION_REFUSED;
break;
}
LOG(("Cancelling failed proxy CONNECT [this=%p httpStatus=%u]\n",
this, httpStatus));
Cancel(rv);
- CallOnStartRequest();
+ {
+ nsresult rv = CallOnStartRequest();
+ if (NS_FAILED(rv)) {
+ LOG(("CallOnStartRequest failed [this=%p httpStatus=%u rv=%08x]\n",
+ this, httpStatus, static_cast<uint32_t>(rv)));
+ }
+ }
return rv;
}
static void
GetSTSConsoleErrorTag(uint32_t failureResult, nsAString& consoleErrorTag)
{
switch (failureResult) {
case nsISiteSecurityService::ERROR_UNTRUSTWORTHY_CONNECTION:
@@ -1617,17 +1630,17 @@ nsHttpChannel::ProcessSingleSecurityHead
break;
case nsISiteSecurityService::HEADER_HPKP:
GetPKPConsoleErrorTag(failureResult, consoleErrorTag);
consoleErrorCategory = NS_LITERAL_STRING("Invalid HPKP Headers");
break;
default:
return NS_ERROR_FAILURE;
}
- AddSecurityMessage(consoleErrorTag, consoleErrorCategory);
+ Unused << AddSecurityMessage(consoleErrorTag, consoleErrorCategory);
LOG(("nsHttpChannel: Failed to parse %s header, continuing load.\n",
atom.get()));
}
} else {
if (rv != NS_ERROR_NOT_AVAILABLE) {
// All other errors are fatal
NS_ENSURE_SUCCESS(rv, rv);
}
@@ -1830,17 +1843,17 @@ nsHttpChannel::ProcessSSLInformation()
uint32_t state;
if (securityInfo &&
NS_SUCCEEDED(securityInfo->GetSecurityState(&state)) &&
(state & nsIWebProgressListener::STATE_IS_BROKEN)) {
// Send weak crypto warnings to the web console
if (state & nsIWebProgressListener::STATE_USES_WEAK_CRYPTO) {
nsString consoleErrorTag = NS_LITERAL_STRING("WeakCipherSuiteWarning");
nsString consoleErrorCategory = NS_LITERAL_STRING("SSL");
- AddSecurityMessage(consoleErrorTag, consoleErrorCategory);
+ Unused << AddSecurityMessage(consoleErrorTag, consoleErrorCategory);
}
}
// Send (SHA-1) signature algorithm errors to the web console
nsCOMPtr<nsIX509Cert> cert;
sslstat->GetServerCert(getter_AddRefs(cert));
if (cert) {
UniqueCERTCertificate nssCert(cert->GetCert());
@@ -1852,17 +1865,17 @@ nsHttpChannel::ProcessSSLInformation()
// from http://tools.ietf.org/html/rfc2437#section-8 since I
// can't see reference to it outside this spec
if (tag == SEC_OID_PKCS1_SHA1_WITH_RSA_ENCRYPTION ||
tag == SEC_OID_ANSIX9_DSA_SIGNATURE_WITH_SHA1_DIGEST ||
tag == SEC_OID_ANSIX962_ECDSA_SHA1_SIGNATURE) {
nsString consoleErrorTag = NS_LITERAL_STRING("SHA1Sig");
nsString consoleErrorMessage
= NS_LITERAL_STRING("SHA-1 Signature");
- AddSecurityMessage(consoleErrorTag, consoleErrorMessage);
+ Unused << AddSecurityMessage(consoleErrorTag, consoleErrorMessage);
}
}
}
}
void
nsHttpChannel::ProcessAltService()
{
@@ -1884,17 +1897,17 @@ nsHttpChannel::ProcessAltService()
nsAutoCString scheme;
mURI->GetScheme(scheme);
bool isHttp = scheme.Equals(NS_LITERAL_CSTRING("http"));
if (!isHttp && !scheme.Equals(NS_LITERAL_CSTRING("https"))) {
return;
}
nsAutoCString altSvc;
- mResponseHead->GetHeader(nsHttp::Alternate_Service, altSvc);
+ Unused << mResponseHead->GetHeader(nsHttp::Alternate_Service, altSvc);
if (altSvc.IsEmpty()) {
return;
}
if (!nsHttp::IsReasonableHeaderValue(altSvc)) {
LOG(("Alt-Svc Response Header seems unreasonable - skipping\n"));
return;
}
@@ -1939,17 +1952,17 @@ nsHttpChannel::ProcessResponse()
mConnectionInfo->EndToEndSSL());
if (mLoadFlags & LOAD_INITIAL_DOCUMENT_URI) {
Telemetry::Accumulate(Telemetry::HTTP_PAGELOAD_IS_SSL,
mConnectionInfo->EndToEndSSL());
}
// how often do we see something like Alt-Svc: "443:quic,p=1"
nsAutoCString alt_service;
- mResponseHead->GetHeader(nsHttp::Alternate_Service, alt_service);
+ Unused << mResponseHead->GetHeader(nsHttp::Alternate_Service, alt_service);
bool saw_quic = (!alt_service.IsEmpty() &&
PL_strstr(alt_service.get(), "quic")) ? 1 : 0;
Telemetry::Accumulate(Telemetry::HTTP_SAW_QUIC_ALT_PROTOCOL, saw_quic);
// Gather data on how many URLS get redirected
switch (httpStatus) {
case 200:
Telemetry::Accumulate(Telemetry::HTTP_RESPONSE_STATUS_CODE, 0);
@@ -2076,24 +2089,32 @@ nsHttpChannel::ContinueProcessResponse1(
if (mConcurrentCacheAccess && mCachedContentIsPartial && httpStatus != 206) {
LOG((" only expecting 206 when doing partial request during "
"interrupted cache concurrent read"));
return NS_ERROR_CORRUPTED_CONTENT;
}
// handle unused username and password in url (see bug 232567)
if (httpStatus != 401 && httpStatus != 407) {
- if (!mAuthRetryPending)
- mAuthProvider->CheckForSuperfluousAuth();
+ if (!mAuthRetryPending) {
+ rv = mAuthProvider->CheckForSuperfluousAuth();
+ if (NS_FAILED(rv)) {
+ LOG((" CheckForSuperfluousAuth failed (%08x)",
+ static_cast<uint32_t>(rv)));
+ }
+ }
if (mCanceled)
return CallOnStartRequest();
// reset the authentication's current continuation state because our
// last authentication attempt has been completed successfully
- mAuthProvider->Disconnect(NS_ERROR_ABORT);
+ rv = mAuthProvider->Disconnect(NS_ERROR_ABORT);
+ if (NS_FAILED(rv)) {
+ LOG((" Disconnect failed (%08x)", static_cast<uint32_t>(rv)));
+ }
mAuthProvider = nullptr;
LOG((" continuation state has been reset"));
}
if (mAPIRedirectToURI && !mCanceled) {
MOZ_ASSERT(!mOnStartRequestCalled);
nsCOMPtr<nsIURI> redirectTo;
mAPIRedirectToURI.swap(redirectTo);
@@ -2250,18 +2271,23 @@ nsHttpChannel::ContinueProcessResponse2(
LOG(("Suspending the transaction, asynchronously prompting for credentials"));
mTransactionPump->Suspend();
rv = NS_OK;
} else if (NS_FAILED(rv)) {
LOG(("ProcessAuthentication failed [rv=%" PRIx32 "]\n",
static_cast<uint32_t>(rv)));
if (mTransaction->ProxyConnectFailed())
return ProcessFailedProxyConnect(httpStatus);
- if (!mAuthRetryPending)
- mAuthProvider->CheckForSuperfluousAuth();
+ if (!mAuthRetryPending) {
+ rv = mAuthProvider->CheckForSuperfluousAuth();
+ if (NS_FAILED(rv)) {
+ LOG(("CheckForSuperfluousAuth failed [rv=%x]\n",
+ static_cast<uint32_t>(rv)));
+ }
+ }
rv = ProcessNormal();
} else {
mAuthRetryPending = true; // see DoAuthRetry
}
break;
default:
rv = ProcessNormal();
MaybeInvalidateCacheEntryForSubsequentGet();
@@ -2325,17 +2351,22 @@ nsHttpChannel::ContinueProcessResponse3(
Cancel(rv);
DoNotifyListener();
return rv;
}
if (NS_SUCCEEDED(rv)) {
UpdateInhibitPersistentCachingFlag();
- InitCacheEntry();
+ rv = InitCacheEntry();
+ if (NS_FAILED(rv)) {
+ LOG(("ContinueProcessResponse3 "
+ "failed to init cache entry [rv=%x]\n",
+ static_cast<uint32_t>(rv)));
+ }
CloseCacheEntry(false);
if (mApplicationCacheForWrite) {
// Store response in the offline cache
InitOfflineCacheEntry();
CloseOfflineCacheEntry();
}
return NS_OK;
@@ -2356,17 +2387,17 @@ nsHttpChannel::ProcessNormal()
LOG(("nsHttpChannel::ProcessNormal [this=%p]\n", this));
bool succeeded;
rv = GetRequestSucceeded(&succeeded);
if (NS_SUCCEEDED(rv) && !succeeded) {
PushRedirectAsyncFunc(&nsHttpChannel::ContinueProcessNormal);
bool waitingForRedirectCallback;
- (void)ProcessFallback(&waitingForRedirectCallback);
+ Unused << ProcessFallback(&waitingForRedirectCallback);
if (waitingForRedirectCallback) {
// The transaction has been suspended by ProcessFallback.
return NS_OK;
}
PopRedirectAsyncFunc(&nsHttpChannel::ContinueProcessNormal);
}
return ContinueProcessNormal(NS_OK);
@@ -2512,18 +2543,23 @@ nsHttpChannel::HandleAsyncRedirectChanne
if (mSuspendCount) {
LOG(("Waiting until resume to do async redirect to https [this=%p]\n", this));
mCallOnResume = &nsHttpChannel::HandleAsyncRedirectChannelToHttps;
return;
}
nsresult rv = StartRedirectChannelToHttps();
- if (NS_FAILED(rv))
- ContinueAsyncRedirectChannelToURI(rv);
+ if (NS_FAILED(rv)) {
+ rv = ContinueAsyncRedirectChannelToURI(rv);
+ if (NS_FAILED(rv)) {
+ LOG(("ContinueAsyncRedirectChannelToURI failed (%08x) [this=%p]\n",
+ static_cast<uint32_t>(rv), this));
+ }
+ }
}
nsresult
nsHttpChannel::StartRedirectChannelToHttps()
{
LOG(("nsHttpChannel::HandleAsyncRedirectChannelToHttps() [STS]\n"));
nsCOMPtr<nsIURI> upgradedURI;
@@ -2544,18 +2580,23 @@ nsHttpChannel::HandleAsyncAPIRedirect()
if (mSuspendCount) {
LOG(("Waiting until resume to do async API redirect [this=%p]\n", this));
mCallOnResume = &nsHttpChannel::HandleAsyncAPIRedirect;
return;
}
nsresult rv = StartRedirectChannelToURI(mAPIRedirectToURI,
nsIChannelEventSink::REDIRECT_PERMANENT);
- if (NS_FAILED(rv))
- ContinueAsyncRedirectChannelToURI(rv);
+ if (NS_FAILED(rv)) {
+ rv = ContinueAsyncRedirectChannelToURI(rv);
+ if (NS_FAILED(rv)) {
+ LOG(("ContinueAsyncRedirectChannelToURI failed (%08x) [this=%p]\n",
+ static_cast<uint32_t>(rv), this));
+ }
+ }
return;
}
nsresult
nsHttpChannel::StartRedirectChannelToURI(nsIURI *upgradedURI, uint32_t flags)
{
nsresult rv = NS_OK;
@@ -2781,17 +2822,17 @@ nsHttpChannel::ResolveProxy()
return rv;
}
bool
nsHttpChannel::ResponseWouldVary(nsICacheEntry* entry)
{
nsresult rv;
nsAutoCString buf, metaKey;
- mCachedResponseHead->GetHeader(nsHttp::Vary, buf);
+ Unused << mCachedResponseHead->GetHeader(nsHttp::Vary, buf);
if (!buf.IsEmpty()) {
NS_NAMED_LITERAL_CSTRING(prefix, "request-");
// enumerate the elements of the Vary header...
char *val = buf.BeginWriting(); // going to munge buf
char *token = nsCRT::strtok(val, NS_HTTP_HEADER_SEPS, &val);
while (token) {
LOG(("nsHttpChannel::ResponseWouldVary [channel=%p] " \
@@ -2884,17 +2925,17 @@ nsHttpChannel::HandleAsyncAbort()
bool
nsHttpChannel::IsResumable(int64_t partialLen, int64_t contentLength,
bool ignoreMissingPartialLen) const
{
bool hasContentEncoding =
mCachedResponseHead->HasHeader(nsHttp::Content_Encoding);
nsAutoCString etag;
- mCachedResponseHead->GetHeader(nsHttp::ETag, etag);
+ Unused << mCachedResponseHead->GetHeader(nsHttp::ETag, etag);
bool hasWeakEtag = !etag.IsEmpty() &&
StringBeginsWith(etag, NS_LITERAL_CSTRING("W/"));
return (partialLen < contentLength) &&
(partialLen > 0 || ignoreMissingPartialLen) &&
!hasContentEncoding && !hasWeakEtag &&
mCachedResponseHead->IsResumable() &&
!mCustomConditionalRequest &&
@@ -2925,19 +2966,19 @@ nsHttpChannel::MaybeSetupByteRangeReques
nsresult
nsHttpChannel::SetupByteRangeRequest(int64_t partialLen)
{
// cached content has been found to be partial, add necessary request
// headers to complete cache entry.
// use strongest validator available...
nsAutoCString val;
- mCachedResponseHead->GetHeader(nsHttp::ETag, val);
+ Unused << mCachedResponseHead->GetHeader(nsHttp::ETag, val);
if (val.IsEmpty())
- mCachedResponseHead->GetHeader(nsHttp::Last_Modified, val);
+ Unused << mCachedResponseHead->GetHeader(nsHttp::Last_Modified, val);
if (val.IsEmpty()) {
// if we hit this code it means mCachedResponseHead->IsResumable() is
// either broken or not being called.
NS_NOTREACHED("no cache validator");
mIsPartialRequest = false;
return NS_ERROR_FAILURE;
}
@@ -2972,32 +3013,33 @@ nsHttpChannel::ProcessPartialContent()
NS_ENSURE_TRUE(mCacheEntry, NS_ERROR_NOT_INITIALIZED);
// Make sure to clear bogus content-encodings before looking at the header
ClearBogusContentEncodingIfNeeded();
// Check if the content-encoding we now got is different from the one we
// got before
nsAutoCString contentEncoding, cachedContentEncoding;
- mResponseHead->GetHeader(nsHttp::Content_Encoding, contentEncoding);
- mCachedResponseHead->GetHeader(nsHttp::Content_Encoding,
- cachedContentEncoding);
+ // It is possible that there is not such headers
+ Unused << mResponseHead->GetHeader(nsHttp::Content_Encoding, contentEncoding);
+ Unused << mCachedResponseHead->GetHeader(nsHttp::Content_Encoding,
+ cachedContentEncoding);
if (PL_strcasecmp(contentEncoding.get(), cachedContentEncoding.get())
!= 0) {
Cancel(NS_ERROR_INVALID_CONTENT_ENCODING);
return CallOnStartRequest();
}
nsresult rv;
int64_t cachedContentLength = mCachedResponseHead->ContentLength();
int64_t entitySize = mResponseHead->TotalEntitySize();
nsAutoCString contentRange;
- mResponseHead->GetHeader(nsHttp::Content_Range, contentRange);
+ Unused << mResponseHead->GetHeader(nsHttp::Content_Range, contentRange);
LOG(("nsHttpChannel::ProcessPartialContent [this=%p trans=%p] "
"original content-length %" PRId64
", entity-size %" PRId64 ", content-range %s\n",
this, mTransaction.get(), cachedContentLength, entitySize,
contentRange.get()));
if ((entitySize >= 0) && (cachedContentLength >= 0) &&
(entitySize != cachedContentLength)) {
@@ -3440,17 +3482,17 @@ nsHttpChannel::OpenCacheEntry(bool isHtt
if (!info) {
return NS_ERROR_FAILURE;
}
uint32_t cacheEntryOpenFlags;
bool offline = gIOService->IsOffline();
nsAutoCString cacheControlRequestHeader;
- mRequestHead.GetHeader(nsHttp::Cache_Control, cacheControlRequestHeader);
+ Unused << mRequestHead.GetHeader(nsHttp::Cache_Control, cacheControlRequestHeader);
CacheControlParser cacheControlRequest(cacheControlRequestHeader);
if (cacheControlRequest.NoStore() && !PossiblyIntercepted()) {
goto bypassCacheEntryOpen;
}
if (offline || (mLoadFlags & INHIBIT_CACHING)) {
if (BYPASS_LOCAL_CACHE(mLoadFlags) && !offline && !PossiblyIntercepted()) {
goto bypassCacheEntryOpen;
@@ -3647,17 +3689,17 @@ nsHttpChannel::OnCacheEntryCheck(nsICach
if (mRacingNetAndCache && mFirstResponseSource == RESPONSE_FROM_NETWORK) {
LOG(("Not using cached response because we've already got one from the network\n"));
*aResult = ENTRY_NOT_WANTED;
return NS_OK;
}
nsAutoCString cacheControlRequestHeader;
- mRequestHead.GetHeader(nsHttp::Cache_Control, cacheControlRequestHeader);
+ Unused << mRequestHead.GetHeader(nsHttp::Cache_Control, cacheControlRequestHeader);
CacheControlParser cacheControlRequest(cacheControlRequestHeader);
if (cacheControlRequest.NoStore()) {
LOG(("Not using cached response based on no-store request cache directive\n"));
*aResult = ENTRY_NOT_WANTED;
return NS_OK;
}
@@ -3697,17 +3739,20 @@ nsHttpChannel::OnCacheEntryCheck(nsICach
mCachedResponseHead = new nsHttpResponseHead();
// A "original-response-headers" metadata element holds network original headers,
// i.e. the headers in the form as they arrieved from the network.
// We need to get the network original headers first, because we need to keep them
// in order.
rv = entry->GetMetaDataElement("original-response-headers", getter_Copies(buf));
if (NS_SUCCEEDED(rv)) {
- mCachedResponseHead->ParseCachedOriginalHeaders((char *) buf.get());
+ rv = mCachedResponseHead->ParseCachedOriginalHeaders((char *) buf.get());
+ if (NS_FAILED(rv)) {
+ LOG((" failed to parse original-response-headers\n"));
+ }
}
buf.Adopt(0);
// A "response-head" metadata element holds response head, e.g. response status
// line and headers in the form Firefox uses them internally (no dupicate
// headers, etc.).
rv = entry->GetMetaDataElement("response-head", getter_Copies(buf));
NS_ENSURE_SUCCESS(rv, rv);
@@ -3954,17 +3999,17 @@ nsHttpChannel::OnCacheEntryCheck(nsICach
doValidation = true;
}
nsAutoCString requestedETag;
if (!doValidation &&
NS_SUCCEEDED(mRequestHead.GetHeader(nsHttp::If_Match, requestedETag)) &&
(methodWasGet || methodWasHead)) {
nsAutoCString cachedETag;
- mCachedResponseHead->GetHeader(nsHttp::ETag, cachedETag);
+ Unused << mCachedResponseHead->GetHeader(nsHttp::ETag, cachedETag);
if (!cachedETag.IsEmpty() &&
(StringBeginsWith(cachedETag, NS_LITERAL_CSTRING("W/")) ||
!requestedETag.Equals(cachedETag))) {
// User has defined If-Match header, if the cached entry is not
// matching the provided header value or the cached ETag is weak,
// force validation.
doValidation = true;
}
@@ -4053,22 +4098,22 @@ nsHttpChannel::OnCacheEntryCheck(nsICach
// This will cause that OnCacheEntryCheck is called again with the same
// entry after the writer is done.
wantCompleteEntry = true;
} else {
nsAutoCString val;
// Add If-Modified-Since header if a Last-Modified was given
// and we are allowed to do this (see bugs 510359 and 269303)
if (canAddImsHeader) {
- mCachedResponseHead->GetHeader(nsHttp::Last_Modified, val);
+ Unused << mCachedResponseHead->GetHeader(nsHttp::Last_Modified, val);
if (!val.IsEmpty())
mRequestHead.SetHeader(nsHttp::If_Modified_Since, val);
}
// Add If-None-Match header if an ETag was given in the response
- mCachedResponseHead->GetHeader(nsHttp::ETag, val);
+ Unused << mCachedResponseHead->GetHeader(nsHttp::ETag, val);
if (!val.IsEmpty())
mRequestHead.SetHeader(nsHttp::If_None_Match, val);
mDidReval = true;
}
}
}
if (mCachedContentIsValid || mDidReval) {
@@ -4122,17 +4167,17 @@ nsHttpChannel::OnCacheEntryAvailable(nsI
if (!mIsPending) {
mCacheInputStream.CloseAndRelease();
return NS_OK;
}
rv = OnCacheEntryAvailableInternal(entry, aNew, aAppCache, status);
if (NS_FAILED(rv)) {
CloseCacheEntry(false);
- AsyncAbort(rv);
+ Unused << AsyncAbort(rv);
}
return NS_OK;
}
nsresult
nsHttpChannel::OnCacheEntryAvailableInternal(nsICacheEntry *entry,
bool aNew,
@@ -4177,17 +4222,17 @@ nsHttpChannel::OnCacheEntryAvailableInte
}
// We may be waiting for more callbacks...
if (AwaitingCacheCallbacks()) {
return NS_OK;
}
if (mCachedContentIsValid && mNetworkTriggered) {
- ReadFromCache(true);
+ Unused << ReadFromCache(true);
}
return TriggerNetwork(0);
}
nsresult
nsHttpChannel::OnNormalCacheEntryAvailable(nsICacheEntry *aEntry,
bool aNew,
@@ -4943,17 +4988,17 @@ DoAddCacheEntryHeaders(nsHttpChannel *se
// large (bug 468426). We take care of "Vary: cookie" in ResponseWouldVary.
//
// NOTE: if "Vary: accept, cookie", then we will store the "accept" header
// in the cache. we could try to avoid needlessly storing the "accept"
// header in this case, but it doesn't seem worth the extra code to perform
// the check.
{
nsAutoCString buf, metaKey;
- responseHead->GetHeader(nsHttp::Vary, buf);
+ Unused << responseHead->GetHeader(nsHttp::Vary, buf);
if (!buf.IsEmpty()) {
NS_NAMED_LITERAL_CSTRING(prefix, "request-");
char *bufData = buf.BeginWriting(); // going to munge buf
char *token = nsCRT::strtok(bufData, NS_HTTP_HEADER_SEPS, &bufData);
while (token) {
LOG(("nsHttpChannel::AddCacheEntryHeaders [this=%p] " \
"processing %s", self, token));
@@ -5075,17 +5120,17 @@ nsHttpChannel::InstallCacheListener(int6
LOG(("Preparing to write data into the cache [uri=%s]\n", mSpec.get()));
MOZ_ASSERT(mCacheEntry);
MOZ_ASSERT(mCacheEntryIsWriteOnly || mCachedContentIsPartial);
MOZ_ASSERT(mListener);
nsAutoCString contentEncoding, contentType;
- mResponseHead->GetHeader(nsHttp::Content_Encoding, contentEncoding);
+ Unused << mResponseHead->GetHeader(nsHttp::Content_Encoding, contentEncoding);
mResponseHead->ContentType(contentType);
// If the content is compressible and the server has not compressed it,
// mark the cache entry for compression.
if (contentEncoding.IsEmpty() &&
(contentType.EqualsLiteral(TEXT_HTML) ||
contentType.EqualsLiteral(TEXT_PLAIN) ||
contentType.EqualsLiteral(TEXT_CSS) ||
contentType.EqualsLiteral(TEXT_JAVASCRIPT) ||
@@ -5313,17 +5358,17 @@ nsHttpChannel::AsyncProcessRedirection(u
if (mApplicationCache) {
// if we are redirected to a different origin check if there is a fallback
// cache entry to fall back to. we don't care about file strict
// checking, at least mURI is not a file URI.
if (!NS_SecurityCompareURIs(mURI, mRedirectURI, false)) {
PushRedirectAsyncFunc(&nsHttpChannel::ContinueProcessRedirectionAfterFallback);
bool waitingForRedirectCallback;
- (void)ProcessFallback(&waitingForRedirectCallback);
+ Unused << ProcessFallback(&waitingForRedirectCallback);
if (waitingForRedirectCallback)
return NS_OK;
PopRedirectAsyncFunc(&nsHttpChannel::ContinueProcessRedirectionAfterFallback);
}
}
return ContinueProcessRedirectionAfterFallback(NS_OK);
}
@@ -5628,18 +5673,22 @@ nsHttpChannel::Cancel(nsresult status)
if (mPreflightChannel)
mPreflightChannel->Cancel(status);
return NS_OK;
}
void
nsHttpChannel::CancelNetworkRequest(nsresult aStatus)
{
- if (mTransaction)
- gHttpHandler->CancelTransaction(mTransaction, aStatus);
+ if (mTransaction) {
+ nsresult rv = gHttpHandler->CancelTransaction(mTransaction, aStatus);
+ if (NS_FAILED(rv)) {
+ LOG(("failed to cancel the transaction\n"));
+ }
+ }
if (mTransactionPump)
mTransactionPump->Cancel(aStatus);
}
NS_IMETHODIMP
nsHttpChannel::Suspend()
{
nsresult rv = SuspendInternal();
@@ -5787,17 +5836,17 @@ nsHttpChannel::AsyncOpen(nsIStreamListen
// proxying a non-http protocol like ftp.
if (!mProxyInfo && NS_SUCCEEDED(ResolveProxy())) {
return NS_OK;
}
rv = BeginConnect();
if (NS_FAILED(rv)) {
CloseCacheEntry(false);
- AsyncAbort(rv);
+ Unused << AsyncAbort(rv);
}
return NS_OK;
}
NS_IMETHODIMP
nsHttpChannel::AsyncOpen2(nsIStreamListener *aListener)
{
@@ -5930,17 +5979,21 @@ nsHttpChannel::BeginConnect()
if (NS_SUCCEEDED(rv))
rv = mAuthProvider->Init(this);
if (NS_FAILED(rv)) {
return rv;
}
// check to see if authorization headers should be included
// mCustomAuthHeader is set in AsyncOpen if we find Authorization header
- mAuthProvider->AddAuthorizationHeaders(mCustomAuthHeader);
+ rv = mAuthProvider->AddAuthorizationHeaders(mCustomAuthHeader);
+ if (NS_FAILED(rv)) {
+ LOG(("nsHttpChannel %p AddAuthorizationHeaders failed (%08x)",
+ this, static_cast<uint32_t>(rv)));
+ }
// notify "http-on-modify-request" observers
CallOnModifyRequestObservers();
SetLoadGroupUserAgentOverride();
// Check to see if we should redirect this channel elsewhere by
// nsIHttpChannel.redirectTo API request
@@ -5985,17 +6038,17 @@ nsHttpChannel::BeginConnect()
}
// If mTimingEnabled flag is not set after OnModifyRequest() then
// clear the already recorded AsyncOpen value for consistency.
if (!mTimingEnabled)
mAsyncOpenTime = TimeStamp();
// if this somehow fails we can go on without it
- gHttpHandler->AddConnectionHeader(&mRequestHead, mCaps);
+ Unused << gHttpHandler->AddConnectionHeader(&mRequestHead, mCaps);
if (mLoadFlags & VALIDATE_ALWAYS || BYPASS_LOCAL_CACHE(mLoadFlags))
mCaps |= NS_HTTP_REFRESH_DNS;
if (!mLocalBlocklist && !mConnectionInfo->UsingHttpProxy() &&
!(mLoadFlags & (LOAD_NO_NETWORK_IO | LOAD_ONLY_FROM_CACHE))) {
// Start a DNS lookup very early in case the real open is queued the DNS can
// happen in parallel. Do not do so in the presence of an HTTP proxy as
@@ -6031,17 +6084,22 @@ nsHttpChannel::BeginConnect()
}
}
// Force-Reload should reset the persistent connection pool for this host
if (mLoadFlags & LOAD_FRESH_CONNECTION) {
// just the initial document resets the whole pool
if (mLoadFlags & LOAD_INITIAL_DOCUMENT_URI) {
gHttpHandler->ConnMgr()->ClearAltServiceMappings();
- gHttpHandler->ConnMgr()->DoShiftReloadConnectionCleanup(mConnectionInfo);
+ rv = gHttpHandler->ConnMgr()->DoShiftReloadConnectionCleanup(mConnectionInfo);
+ if (NS_FAILED(rv)) {
+ LOG(("nsHttpChannel::BeginConnect "
+ "DoShiftReloadConnectionCleanup failed: %08x [this=%p]",
+ static_cast<uint32_t>(rv), this));
+ }
}
}
// We may have been cancelled already, either by on-modify-request
// listeners or load group observers; in that case, we should not send the
// request to the server
if (mCanceled) {
return mStatus;
@@ -6138,18 +6196,24 @@ nsHttpChannel::ForceIntercepted(uint64_t
NS_IMETHODIMP
nsHttpChannel::SetPriority(int32_t value)
{
int16_t newValue = clamped<int32_t>(value, INT16_MIN, INT16_MAX);
if (mPriority == newValue)
return NS_OK;
mPriority = newValue;
- if (mTransaction)
- gHttpHandler->RescheduleTransaction(mTransaction, mPriority);
+ if (mTransaction) {
+ nsresult rv = gHttpHandler->RescheduleTransaction(mTransaction, mPriority);
+ if (NS_FAILED(rv)) {
+ LOG(("nsHttpChannel::SetPriority [this=%p] "
+ "RescheduleTransaction failed (%08x)", this,
+ static_cast<uint32_t>(rv)));
+ }
+ }
// If this channel is the real channel for an e10s channel, notify the
// child side about the priority change as well.
nsCOMPtr<nsIParentChannel> parentChannel;
NS_QueryNotificationCallbacks(this, parentChannel);
RefPtr<HttpChannelParent> httpParent = do_QueryObject(parentChannel);
if (httpParent) {
httpParent->DoSendSetPriority(newValue);
@@ -6185,17 +6249,17 @@ nsHttpChannel::ContinueBeginConnectWithR
}
void
nsHttpChannel::ContinueBeginConnect()
{
nsresult rv = ContinueBeginConnectWithResult();
if (NS_FAILED(rv)) {
CloseCacheEntry(false);
- AsyncAbort(rv);
+ Unused << AsyncAbort(rv);
}
}
//-----------------------------------------------------------------------------
// HttpChannel::nsIClassOfService
//-----------------------------------------------------------------------------
NS_IMETHODIMP
nsHttpChannel::SetClassFlags(uint32_t inFlags)
@@ -6247,17 +6311,17 @@ nsHttpChannel::OnProxyAvailable(nsICance
rv = NS_ERROR_NOT_AVAILABLE;
}
else {
rv = BeginConnect();
}
if (NS_FAILED(rv)) {
CloseCacheEntry(false);
- AsyncAbort(rv);
+ Unused << AsyncAbort(rv);
}
return rv;
}
//-----------------------------------------------------------------------------
// nsHttpChannel::nsIProxiedChannel
//-----------------------------------------------------------------------------
@@ -6580,17 +6644,17 @@ nsHttpChannel::ContinueOnStartRequest2(n
// that called this function.
return NS_OK;
}
// on other request errors, try to fall back
if (NS_FAILED(mStatus)) {
PushRedirectAsyncFunc(&nsHttpChannel::ContinueOnStartRequest3);
bool waitingForRedirectCallback;
- ProcessFallback(&waitingForRedirectCallback);
+ Unused << ProcessFallback(&waitingForRedirectCallback);
if (waitingForRedirectCallback)
return NS_OK;
PopRedirectAsyncFunc(&nsHttpChannel::ContinueOnStartRequest3);
}
return ContinueOnStartRequest3(NS_OK);
}
@@ -6662,18 +6726,23 @@ nsHttpChannel::OnStopRequest(nsIRequest
}
else if (request == mTransactionPump) {
MOZ_ASSERT(mConcurrentCacheAccess);
}
else
NS_NOTREACHED("unexpected request");
}
// Do not to leave the transaction in a suspended state in error cases.
- if (NS_FAILED(status) && mTransaction)
- gHttpHandler->CancelTransaction(mTransaction, status);
+ if (NS_FAILED(status) && mTransaction) {
+ nsresult rv = gHttpHandler->CancelTransaction(mTransaction, status);
+ if (NS_FAILED(rv)) {
+ LOG((" CancelTransaction failed (%08x)",
+ static_cast<uint32_t>(rv)));
+ }
+ }
}
nsCOMPtr<nsICompressConvStats> conv = do_QueryInterface(mCompressListener);
if (conv) {
conv->GetDecodedDataLength(&mDecodedBodySize);
}
if (mTransaction) {
@@ -6784,18 +6853,23 @@ nsHttpChannel::OnStopRequest(nsIRequest
LOG(("Transaction replaced\n"));
// This was just the network check for a 304 response.
mFirstResponseSource = RESPONSE_PENDING;
return NS_OK;
}
if (mUpgradeProtocolCallback && stickyConn &&
mResponseHead && mResponseHead->Status() == 101) {
- gHttpHandler->ConnMgr()->CompleteUpgrade(stickyConn,
- mUpgradeProtocolCallback);
+ nsresult rv =
+ gHttpHandler->ConnMgr()->CompleteUpgrade(stickyConn,
+ mUpgradeProtocolCallback);
+ if (NS_FAILED(rv)) {
+ LOG((" CompleteUpgrade failed with %08x",
+ static_cast<uint32_t>(rv)));
+ }
}
}
// HTTP_CHANNEL_DISPOSITION TELEMETRY
enum ChannelDisposition
{
kHttpCanceled = 0,
kHttpDisk = 1,
@@ -6878,17 +6952,21 @@ nsHttpChannel::OnStopRequest(nsIRequest
// perform any final cache operations before we close the cache entry.
if (mCacheEntry && mRequestTimeInitialized) {
bool writeAccess;
// New implementation just returns value of the !mCacheEntryIsReadOnly flag passed in.
// Old implementation checks on nsICache::ACCESS_WRITE flag.
mCacheEntry->HasWriteAccess(!mCacheEntryIsReadOnly, &writeAccess);
if (writeAccess) {
- FinalizeCacheEntry();
+ nsresult rv = FinalizeCacheEntry();
+ if (NS_FAILED(rv)) {
+ LOG(("FinalizeCacheEntry failed (%08x)",
+ static_cast<uint32_t>(rv)));
+ }
}
}
// Register entry to the Performance resource timing
mozilla::dom::Performance* documentPerformance = GetPerformance();
if (documentPerformance) {
documentPerformance->AddEntry(this, this);
}
@@ -7836,24 +7914,24 @@ nsHttpChannel::MaybeInvalidateCacheEntry
LOG(("MaybeInvalidateCacheEntryForSubsequentGet [this=%p uri=%s]\n",
this, key.get()));
}
DoInvalidateCacheEntry(mURI);
// Invalidate Location-header if set
nsAutoCString location;
- mResponseHead->GetHeader(nsHttp::Location, location);
+ Unused << mResponseHead->GetHeader(nsHttp::Location, location);
if (!location.IsEmpty()) {
LOG((" Location-header=%s\n", location.get()));
InvalidateCacheEntryForLocation(location.get());
}
// Invalidate Content-Location-header if set
- mResponseHead->GetHeader(nsHttp::Content_Location, location);
+ Unused << mResponseHead->GetHeader(nsHttp::Content_Location, location);
if (!location.IsEmpty()) {
LOG((" Content-Location-header=%s\n", location.get()));
InvalidateCacheEntryForLocation(location.get());
}
}
void
nsHttpChannel::InvalidateCacheEntryForLocation(const char *location)
@@ -8078,17 +8156,17 @@ nsHttpChannel::OnPreflightSucceeded()
NS_IMETHODIMP
nsHttpChannel::OnPreflightFailed(nsresult aError)
{
MOZ_ASSERT(mRequireCORSPreflight, "Why did a preflight happen?");
mIsCorsPreflightDone = 1;
mPreflightChannel = nullptr;
CloseCacheEntry(false);
- AsyncAbort(aError);
+ Unused << AsyncAbort(aError);
return NS_OK;
}
//-----------------------------------------------------------------------------
// nsIHstsPrimingCallback functions
//-----------------------------------------------------------------------------
/*
--- a/netwerk/protocol/http/nsHttpChannelAuthProvider.cpp
+++ b/netwerk/protocol/http/nsHttpChannelAuthProvider.cpp
@@ -765,18 +765,18 @@ nsHttpChannelAuthProvider::GetCredential
//
// if we already tried some credentials for this transaction, then
// we need to possibly clear them from the cache, unless the credentials
// in the cache have changed, in which case we'd want to give them a
// try instead.
//
nsHttpAuthEntry *entry = nullptr;
- authCache->GetAuthEntryForDomain(scheme.get(), host, port,
- realm.get(), suffix, &entry);
+ Unused << authCache->GetAuthEntryForDomain(scheme.get(), host, port,
+ realm.get(), suffix, &entry);
// hold reference to the auth session state (in case we clear our
// reference to the entry).
nsCOMPtr<nsISupports> sessionStateGrip;
if (entry)
sessionStateGrip = entry->mMetaData;
// for digest auth, maybe our cached nonce value simply timed out...
@@ -970,17 +970,17 @@ nsHttpChannelAuthProvider::BlockPrompt()
}
if (loadInfo->GetExternalContentPolicyType() ==
nsIContentPolicy::TYPE_XMLHTTPREQUEST) {
xhr = true;
}
if (!topDoc && !xhr) {
nsCOMPtr<nsIURI> topURI;
- chanInternal->GetTopWindowURI(getter_AddRefs(topURI));
+ Unused << chanInternal->GetTopWindowURI(getter_AddRefs(topURI));
if (!topURI) {
// If we do not have topURI try the loadingPrincipal.
nsCOMPtr<nsIPrincipal> loadingPrinc = loadInfo->LoadingPrincipal();
if (loadingPrinc) {
loadingPrinc->GetURI(getter_AddRefs(topURI));
}
}
@@ -1287,19 +1287,19 @@ NS_IMETHODIMP nsHttpChannelAuthProvider:
ParseRealm(mCurrentChallenge.get(), realm);
nsCOMPtr<nsIChannel> chan = do_QueryInterface(mAuthChannel);
nsAutoCString suffix;
GetOriginAttributesSuffix(chan, suffix);
nsHttpAuthCache *authCache = gHttpHandler->AuthCache(mIsPrivate);
nsHttpAuthEntry *entry = nullptr;
- authCache->GetAuthEntryForDomain(scheme.get(), host, port,
- realm.get(), suffix,
- &entry);
+ Unused << authCache->GetAuthEntryForDomain(scheme.get(), host, port,
+ realm.get(), suffix,
+ &entry);
nsCOMPtr<nsISupports> sessionStateGrip;
if (entry)
sessionStateGrip = entry->mMetaData;
nsAuthInformationHolder* holder =
static_cast<nsAuthInformationHolder*>(aAuthInfo);
ident->Set(holder->Domain().get(),
--- a/netwerk/protocol/http/nsHttpChunkedDecoder.cpp
+++ b/netwerk/protocol/http/nsHttpChunkedDecoder.cpp
@@ -112,17 +112,17 @@ nsHttpChunkedDecoder::ParseChunkRemainin
if (mWaitEOF) {
if (*buf) {
LOG(("got trailer: %s\n", buf));
// allocate a header array for the trailers on demand
if (!mTrailers) {
mTrailers = new nsHttpHeaderArray();
}
- mTrailers->ParseHeaderLine(nsDependentCSubstring(buf, count));
+ Unused << mTrailers->ParseHeaderLine(nsDependentCSubstring(buf, count));
}
else {
mWaitEOF = false;
mReachedEOF = true;
LOG(("reached end of chunked-body\n"));
}
}
else if (*buf) {
--- a/netwerk/protocol/http/nsHttpConnection.cpp
+++ b/netwerk/protocol/http/nsHttpConnection.cpp
@@ -320,17 +320,21 @@ nsHttpConnection::StartSpdy(uint8_t spdy
"rv[0x%" PRIx32 "]", this, static_cast<uint32_t>(rv)));
}
mIdleTimeout = gHttpHandler->SpdyTimeout();
if (!mTLSFilter) {
mTransaction = mSpdySession;
} else {
- mTLSFilter->SetProxiedTransaction(mSpdySession);
+ rv = mTLSFilter->SetProxiedTransaction(mSpdySession);
+ if (NS_FAILED(rv)) {
+ LOG(("nsHttpConnection::StartSpdy [%p] SetProxiedTransaction failed"
+ " rv[0x%x]", this, static_cast<uint32_t>(rv)));
+ }
}
if (mDontReuse) {
mSpdySession->DontReuse();
}
}
bool
nsHttpConnection::EnsureNPNComplete(nsresult &aOut0RTTWriteHandshakeValue,
@@ -550,17 +554,17 @@ void
nsHttpConnection::OnTunnelNudged(TLSFilterTransaction *trans)
{
MOZ_ASSERT(PR_GetCurrentThread() == gSocketThread);
LOG(("nsHttpConnection::OnTunnelNudged %p\n", this));
if (trans != mTLSFilter) {
return;
}
LOG(("nsHttpConnection::OnTunnelNudged %p Calling OnSocketWritable\n", this));
- OnSocketWritable();
+ Unused << OnSocketWritable();
}
// called on the socket thread
nsresult
nsHttpConnection::Activate(nsAHttpTransaction *trans, uint32_t caps, int32_t pri)
{
MOZ_ASSERT(PR_GetCurrentThread() == gSocketThread);
LOG(("nsHttpConnection::Activate [this=%p trans=%p caps=%x]\n",
@@ -756,17 +760,17 @@ nsHttpConnection::AddTransaction(nsAHttp
if (!mSpdySession->AddStream(httpTransaction, priority,
needTunnel, mCallbacks)) {
MOZ_ASSERT(false); // this cannot happen!
httpTransaction->Close(NS_ERROR_ABORT);
return NS_ERROR_FAILURE;
}
- ResumeSend();
+ Unused << ResumeSend();
return NS_OK;
}
void
nsHttpConnection::Close(nsresult reason, bool aIsShutdown)
{
LOG(("nsHttpConnection::Close [this=%p reason=%" PRIx32 "]\n",
this, static_cast<uint32_t>(reason)));
@@ -1047,17 +1051,17 @@ nsHttpConnection::OnHeadersAvailable(nsA
// reused as well as the maximum amount of time the connection can be idle
// before the server will close it. we ignore the max reuse count, because
// a "keep-alive" connection is by definition capable of being reused, and
// we only care about being able to reuse it once. if a timeout is not
// specified then we use our advertized timeout value.
bool foundKeepAliveMax = false;
if (mKeepAlive) {
nsAutoCString keepAlive;
- responseHead->GetHeader(nsHttp::Keep_Alive, keepAlive);
+ Unused << responseHead->GetHeader(nsHttp::Keep_Alive, keepAlive);
if (!mUsingSpdyVersion) {
const char *cp = PL_strcasestr(keepAlive.get(), "timeout=");
if (cp)
mIdleTimeout = PR_SecondsToInterval((uint32_t) atoi(cp + 8));
else
mIdleTimeout = gHttpHandler->IdleTimeout();
@@ -1749,17 +1753,17 @@ nsHttpConnection::OnSocketReadable()
// Reset mResponseTimeoutEnabled to stop response timeout checks.
mResponseTimeoutEnabled = false;
if (mKeepAliveMask && (delta >= mMaxHangTime)) {
LOG(("max hang time exceeded!\n"));
// give the handler a chance to create a new persistent connection to
// this host if we've been busy for too long.
mKeepAliveMask = false;
- gHttpHandler->ProcessPendingQ(mConnInfo);
+ Unused << gHttpHandler->ProcessPendingQ(mConnInfo);
}
// Reduce the estimate of the time since last read by up to 1 RTT to
// accommodate exhausted sender TCP congestion windows or minor I/O delays.
mLastReadTime = now;
nsresult rv;
uint32_t n;
@@ -2079,17 +2083,17 @@ nsHttpConnection::OnInputStreamReady(nsI
// The only read event that is protocol compliant for an idle connection
// is an EOF, which we check for with CanReuse(). If the data is
// something else then just ignore it and suspend checking for EOF -
// our normal timers or protocol stack are the place to deal with
// any exception logic.
if (!CanReuse()) {
LOG(("Server initiated close of idle conn %p\n", this));
- gHttpHandler->ConnMgr()->CloseIdleConnection(this);
+ Unused << gHttpHandler->ConnMgr()->CloseIdleConnection(this);
return NS_OK;
}
LOG(("Input data on idle conn %p, but not closing yet\n", this));
return NS_OK;
}
// if the transaction was dropped...
--- a/netwerk/protocol/http/nsHttpConnectionMgr.cpp
+++ b/netwerk/protocol/http/nsHttpConnectionMgr.cpp
@@ -213,17 +213,17 @@ private:
int32_t mIParam;
RefPtr<ARefBase> mVParam;
};
nsresult
nsHttpConnectionMgr::PostEvent(nsConnEventHandler handler,
int32_t iparam, ARefBase *vparam)
{
- EnsureSocketThreadTarget();
+ Unused << EnsureSocketThreadTarget();
ReentrantMonitorAutoEnter mon(mReentrantMonitor);
nsresult rv;
if (!mSocketThreadTarget) {
NS_WARNING("cannot post event if not initialized");
rv = NS_ERROR_NOT_INITIALIZED;
}
@@ -297,22 +297,22 @@ nsHttpConnectionMgr::Observe(nsISupports
const char *topic,
const char16_t *data)
{
LOG(("nsHttpConnectionMgr::Observe [topic=\"%s\"]\n", topic));
if (0 == strcmp(topic, NS_TIMER_CALLBACK_TOPIC)) {
nsCOMPtr<nsITimer> timer = do_QueryInterface(subject);
if (timer == mTimer) {
- PruneDeadConnections();
+ Unused << PruneDeadConnections();
}
else if (timer == mTimeoutTick) {
TimeoutTick();
} else if (timer == mTrafficTimer) {
- PruneNoTraffic();
+ Unused << PruneNoTraffic();
}
else {
MOZ_ASSERT(false, "unexpected timer-callback");
LOG(("Unexpected timer object\n"));
return NS_ERROR_UNEXPECTED;
}
}
@@ -447,17 +447,17 @@ nsHttpConnectionMgr::SpeculativeConnect(
}
return PostEvent(&nsHttpConnectionMgr::OnMsgSpeculativeConnect, 0, args);
}
nsresult
nsHttpConnectionMgr::GetSocketThreadTarget(nsIEventTarget **target)
{
- EnsureSocketThreadTarget();
+ Unused << EnsureSocketThreadTarget();
ReentrantMonitorAutoEnter mon(mReentrantMonitor);
nsCOMPtr<nsIEventTarget> temp(mSocketThreadTarget);
temp.forget(target);
return NS_OK;
}
nsresult
@@ -746,18 +746,28 @@ nsHttpConnectionMgr::ReportSpdyConnectio
LOG(("ReportSpdyConnection shutting down connection (%p) because new "
"spdy connection (%p) takes precedence\n", otherConn, conn));
otherConn->DontReuse();
}
}
}
}
- ProcessPendingQ(ent->mConnInfo);
- PostEvent(&nsHttpConnectionMgr::OnMsgProcessAllSpdyPendingQ);
+ nsresult rv = ProcessPendingQ(ent->mConnInfo);
+ if (NS_FAILED(rv)) {
+ LOG(("ReportSpdyConnection conn=%p ent=%p "
+ "failed to process pending queue (%08x)\n", conn, ent,
+ static_cast<uint32_t>(rv)));
+ }
+ rv = PostEvent(&nsHttpConnectionMgr::OnMsgProcessAllSpdyPendingQ);
+ if (NS_FAILED(rv)) {
+ LOG(("ReportSpdyConnection conn=%p ent=%p "
+ "failed to post event (%08x)\n", conn, ent,
+ static_cast<uint32_t>(rv)));
+ }
}
nsHttpConnectionMgr::nsConnectionEntry *
nsHttpConnectionMgr::GetSpdyPreferredEnt(nsConnectionEntry *aOriginalEntry)
{
if (!gHttpHandler->IsSpdyEnabled() ||
!gHttpHandler->CoalesceSpdy() ||
aOriginalEntry->mConnInfo->GetNoSpdy() ||
@@ -928,17 +938,16 @@ nsHttpConnectionMgr::ProcessPendingQForE
MOZ_ASSERT(PR_GetCurrentThread() == gSocketThread);
nsConnectionEntry *ent = mCT.Get(ci->HashKey());
if (ent)
return ProcessPendingQForEntry(ent, false);
return false;
}
-
// we're at the active connection limit if any one of the following conditions is true:
// (1) at max-connections
// (2) keep-alive enabled and at max-persistent-connections-per-server/proxy
// (3) keep-alive disabled and at max-connections-per-server
bool
nsHttpConnectionMgr::AtActiveConnectionLimit(nsConnectionEntry *ent, uint32_t caps)
{
nsHttpConnectionInfo *ci = ent->mConnInfo;
@@ -1452,17 +1461,21 @@ nsAHttpConnection *
nsHttpConnectionMgr::MakeConnectionHandle(nsHttpConnection *aWrapped)
{
return new ConnectionHandle(aWrapped);
}
ConnectionHandle::~ConnectionHandle()
{
if (mConn) {
- gHttpHandler->ReclaimConnection(mConn);
+ nsresult rv = gHttpHandler->ReclaimConnection(mConn);
+ if (NS_FAILED(rv)) {
+ LOG(("ConnectionHandle::~ConnectionHandle\n"
+ " failed to reclaim connection\n"));
+ }
}
}
NS_IMPL_ISUPPORTS0(ConnectionHandle)
// Use this method for dispatching nsAHttpTransction's. It can only safely be
// used upon first use of a connection when NPN has not negotiated SPDY vs
// HTTP/1 yet as multiplexing onto an existing SPDY session requires a
@@ -1988,17 +2001,17 @@ nsHttpConnectionMgr::OnMsgProcessPending
{
MOZ_ASSERT(PR_GetCurrentThread() == gSocketThread);
nsHttpConnectionInfo *ci = static_cast<nsHttpConnectionInfo *>(param);
if (!ci) {
LOG(("nsHttpConnectionMgr::OnMsgProcessPendingQ [ci=nullptr]\n"));
// Try and dispatch everything
for (auto iter = mCT.Iter(); !iter.Done(); iter.Next()) {
- ProcessPendingQForEntry(iter.Data(), true);
+ Unused << ProcessPendingQForEntry(iter.Data(), true);
}
return;
}
LOG(("nsHttpConnectionMgr::OnMsgProcessPendingQ [ci=%s]\n",
ci->HashKey().get()));
// start by processing the queue identified by the given connection info.
@@ -2328,20 +2341,26 @@ nsHttpConnectionMgr::OnMsgCompleteUpgrad
nsCOMPtr<nsIAsyncInputStream> socketIn;
nsCOMPtr<nsIAsyncOutputStream> socketOut;
nsresult rv;
rv = data->mConn->TakeTransport(getter_AddRefs(socketTransport),
getter_AddRefs(socketIn),
getter_AddRefs(socketOut));
- if (NS_SUCCEEDED(rv))
- data->mUpgradeListener->OnTransportAvailable(socketTransport,
- socketIn,
- socketOut);
+ if (NS_SUCCEEDED(rv)) {
+ rv = data->mUpgradeListener->OnTransportAvailable(socketTransport,
+ socketIn,
+ socketOut);
+ if (NS_FAILED(rv)) {
+ LOG(("nsHttpConnectionMgr::OnMsgCompleteUpgrade "
+ "this=%p conn=%p listener=%p\n", this, data->mConn.get(),
+ data->mUpgradeListener.get()));
+ }
+ }
}
void
nsHttpConnectionMgr::OnMsgUpdateParam(int32_t inParam, ARefBase *)
{
uint32_t param = static_cast<uint32_t>(inParam);
uint16_t name = ((param) & 0xFFFF0000) >> 16;
uint16_t value = param & 0x0000FFFF;
@@ -3305,21 +3324,26 @@ nsConnectionEntry::RemoveHalfOpen(nsHalf
}
MOZ_ASSERT(gHttpHandler->ConnMgr()->mNumHalfOpenConns);
if (gHttpHandler->ConnMgr()->mNumHalfOpenConns) { // just in case
gHttpHandler->ConnMgr()->mNumHalfOpenConns--;
}
}
- if (!UnconnectedHalfOpens())
+ if (!UnconnectedHalfOpens()) {
// perhaps this reverted RestrictConnections()
// use the PostEvent version of processpendingq to avoid
// altering the pending q vector from an arbitrary stack
- gHttpHandler->ConnMgr()->ProcessPendingQ(mConnInfo);
+ nsresult rv = gHttpHandler->ConnMgr()->ProcessPendingQ(mConnInfo);
+ if (NS_FAILED(rv)) {
+ LOG(("nsHttpConnectionMgr::nsConnectionEntry::RemoveHalfOpen\n"
+ " failed to process pending queue\n"));
+ }
+ }
}
void
nsHttpConnectionMgr::
nsConnectionEntry::RecordIPFamilyPreference(uint16_t family)
{
if (family == PR_AF_INET && !mPreferIPv6)
mPreferIPv4 = true;
--- a/netwerk/protocol/http/nsHttpDigestAuth.cpp
+++ b/netwerk/protocol/http/nsHttpDigestAuth.cpp
@@ -199,17 +199,17 @@ nsHttpDigestAuth::GenerateCredentials(ns
bool isDigestAuth = !PL_strncasecmp(challenge, "digest ", 7);
NS_ENSURE_TRUE(isDigestAuth, NS_ERROR_UNEXPECTED);
// IIS implementation requires extra quotes
bool requireExtraQuotes = false;
{
nsAutoCString serverVal;
- authChannel->GetServerResponseHeader(serverVal);
+ Unused << authChannel->GetServerResponseHeader(serverVal);
if (!serverVal.IsEmpty()) {
requireExtraQuotes = !PL_strncasecmp(serverVal.get(), "Microsoft-IIS", 13);
}
}
nsresult rv;
nsAutoCString httpMethod;
nsAutoCString path;
--- a/netwerk/protocol/http/nsHttpHandler.cpp
+++ b/netwerk/protocol/http/nsHttpHandler.cpp
@@ -245,17 +245,22 @@ nsHttpHandler::nsHttpHandler()
}
nsHttpHandler::~nsHttpHandler()
{
LOG(("Deleting nsHttpHandler [this=%p]\n", this));
// make sure the connection manager is shutdown
if (mConnMgr) {
- mConnMgr->Shutdown();
+ nsresult rv = mConnMgr->Shutdown();
+ if (NS_FAILED(rv)) {
+ LOG(("nsHttpHandler [this=%p] "
+ "failed to shutdown connection manager (%08x)\n",
+ this, static_cast<uint32_t>(rv)));
+ }
mConnMgr = nullptr;
}
// Note: don't call NeckoChild::DestroyNeckoChild() here, as it's too late
// and it'll segfault. NeckoChild will get cleaned up by process exit.
nsHttp::DestroyAtomTable();
gHttpHandler = nullptr;
@@ -404,17 +409,21 @@ nsHttpHandler::MakeNewRequestTokenBucket
{
LOG(("nsHttpHandler::MakeNewRequestTokenBucket this=%p child=%d\n",
this, IsNeckoChild()));
if (!mConnMgr || IsNeckoChild()) {
return;
}
RefPtr<EventTokenBucket> tokenBucket =
new EventTokenBucket(RequestTokenBucketHz(), RequestTokenBucketBurst());
- mConnMgr->UpdateRequestTokenBucket(tokenBucket);
+ // NOTE The thread or socket may be gone already.
+ nsresult rv = mConnMgr->UpdateRequestTokenBucket(tokenBucket);
+ if (NS_FAILED(rv)) {
+ LOG((" failed to update request token bucket\n"));
+ }
}
nsresult
nsHttpHandler::InitConnectionMgr()
{
// Init ConnectionManager only on parent!
if (IsNeckoChild()) {
return NS_OK;
@@ -950,18 +959,26 @@ nsHttpHandler::PrefsChanged(nsIPrefBranc
#define PREF_CHANGED(p) ((pref == nullptr) || !PL_strcmp(pref, p))
#define MULTI_PREF_CHANGED(p) \
((pref == nullptr) || !PL_strncmp(pref, p, sizeof(p) - 1))
// If a security pref changed, lets clear our connection pool reuse
if (MULTI_PREF_CHANGED(SECURITY_PREFIX)) {
LOG(("nsHttpHandler::PrefsChanged Security Pref Changed %s\n", pref));
if (mConnMgr) {
- mConnMgr->DoShiftReloadConnectionCleanup(nullptr);
- mConnMgr->PruneDeadConnections();
+ rv = mConnMgr->DoShiftReloadConnectionCleanup(nullptr);
+ if (NS_FAILED(rv)) {
+ LOG(("nsHttpHandler::PrefsChanged "
+ "DoShiftReloadConnectionCleanup failed (%08x)\n", static_cast<uint32_t>(rv)));
+ }
+ rv = mConnMgr->PruneDeadConnections();
+ if (NS_FAILED(rv)) {
+ LOG(("nsHttpHandler::PrefsChanged "
+ "PruneDeadConnections failed (%08x)\n", static_cast<uint32_t>(rv)));
+ }
}
}
//
// UA components
//
bool cVar = false;
@@ -1006,19 +1023,24 @@ nsHttpHandler::PrefsChanged(nsIPrefBranc
if (NS_SUCCEEDED(rv))
mMaxRequestAttempts = (uint16_t) clamped(val, 1, 0xffff);
}
if (PREF_CHANGED(HTTP_PREF("request.max-start-delay"))) {
rv = prefs->GetIntPref(HTTP_PREF("request.max-start-delay"), &val);
if (NS_SUCCEEDED(rv)) {
mMaxRequestDelay = (uint16_t) clamped(val, 0, 0xffff);
- if (mConnMgr)
- mConnMgr->UpdateParam(nsHttpConnectionMgr::MAX_REQUEST_DELAY,
- mMaxRequestDelay);
+ if (mConnMgr) {
+ rv = mConnMgr->UpdateParam(nsHttpConnectionMgr::MAX_REQUEST_DELAY,
+ mMaxRequestDelay);
+ if (NS_FAILED(rv)) {
+ LOG(("nsHttpHandler::PrefsChanged (request.max-start-delay)"
+ "UpdateParam failed (%08x)\n", static_cast<uint32_t>(rv)));
+ }
+ }
}
}
if (PREF_CHANGED(HTTP_PREF("response.timeout"))) {
rv = prefs->GetIntPref(HTTP_PREF("response.timeout"), &val);
if (NS_SUCCEEDED(rv))
mResponseTimeout = PR_SecondsToInterval(clamped(val, 0, 0xffff));
}
@@ -1031,39 +1053,54 @@ nsHttpHandler::PrefsChanged(nsIPrefBranc
if (PREF_CHANGED(HTTP_PREF("max-connections"))) {
rv = prefs->GetIntPref(HTTP_PREF("max-connections"), &val);
if (NS_SUCCEEDED(rv)) {
mMaxConnections = (uint16_t) clamped((uint32_t)val,
(uint32_t)1, MaxSocketCount());
- if (mConnMgr)
- mConnMgr->UpdateParam(nsHttpConnectionMgr::MAX_CONNECTIONS,
- mMaxConnections);
+ if (mConnMgr) {
+ rv = mConnMgr->UpdateParam(nsHttpConnectionMgr::MAX_CONNECTIONS,
+ mMaxConnections);
+ if (NS_FAILED(rv)) {
+ LOG(("nsHttpHandler::PrefsChanged (max-connections)"
+ "UpdateParam failed (%08x)\n", static_cast<uint32_t>(rv)));
+ }
+ }
}
}
if (PREF_CHANGED(HTTP_PREF("max-persistent-connections-per-server"))) {
rv = prefs->GetIntPref(HTTP_PREF("max-persistent-connections-per-server"), &val);
if (NS_SUCCEEDED(rv)) {
mMaxPersistentConnectionsPerServer = (uint8_t) clamped(val, 1, 0xff);
- if (mConnMgr)
- mConnMgr->UpdateParam(nsHttpConnectionMgr::MAX_PERSISTENT_CONNECTIONS_PER_HOST,
- mMaxPersistentConnectionsPerServer);
+ if (mConnMgr) {
+ rv = mConnMgr->UpdateParam(nsHttpConnectionMgr::MAX_PERSISTENT_CONNECTIONS_PER_HOST,
+ mMaxPersistentConnectionsPerServer);
+ if (NS_FAILED(rv)) {
+ LOG(("nsHttpHandler::PrefsChanged (max-persistent-connections-per-server)"
+ "UpdateParam failed (%08x)\n", static_cast<uint32_t>(rv)));
+ }
+ }
}
}
if (PREF_CHANGED(HTTP_PREF("max-persistent-connections-per-proxy"))) {
rv = prefs->GetIntPref(HTTP_PREF("max-persistent-connections-per-proxy"), &val);
if (NS_SUCCEEDED(rv)) {
mMaxPersistentConnectionsPerProxy = (uint8_t) clamped(val, 1, 0xff);
- if (mConnMgr)
- mConnMgr->UpdateParam(nsHttpConnectionMgr::MAX_PERSISTENT_CONNECTIONS_PER_PROXY,
- mMaxPersistentConnectionsPerProxy);
+ if (mConnMgr) {
+ rv = mConnMgr->UpdateParam(nsHttpConnectionMgr::MAX_PERSISTENT_CONNECTIONS_PER_PROXY,
+ mMaxPersistentConnectionsPerProxy);
+ if (NS_FAILED(rv)) {
+ LOG(("nsHttpHandler::PrefsChanged (max-persistent-connections-per-proxy)"
+ "UpdateParam failed (%08x)\n", static_cast<uint32_t>(rv)));
+ }
+ }
}
}
if (PREF_CHANGED(HTTP_PREF("sendRefererHeader"))) {
rv = prefs->GetIntPref(HTTP_PREF("sendRefererHeader"), &val);
if (NS_SUCCEEDED(rv))
mReferrerLevel = (uint8_t) clamped(val, 0, 0xff);
}
@@ -1998,18 +2035,18 @@ nsHttpHandler::Observe(nsISupports *subj
if (prefBranch)
PrefsChanged(prefBranch, NS_ConvertUTF16toUTF8(data).get());
} else if (!strcmp(topic, "profile-change-net-teardown") ||
!strcmp(topic, NS_XPCOM_SHUTDOWN_OBSERVER_ID) ) {
mHandlerActive = false;
// clear cache of all authentication credentials.
- mAuthCache.ClearAll();
- mPrivateAuthCache.ClearAll();
+ Unused << mAuthCache.ClearAll();
+ Unused << mPrivateAuthCache.ClearAll();
if (mWifiTickler)
mWifiTickler->Cancel();
// Inform nsIOService that network is tearing down.
gIOService->SetHttpHandlerAlreadyShutingDown();
ShutdownConnectionManager();
@@ -2021,35 +2058,47 @@ nsHttpHandler::Observe(nsISupports *subj
Telemetry::Accumulate(Telemetry::DNT_USAGE, 2);
} else {
Telemetry::Accumulate(Telemetry::DNT_USAGE, 1);
}
} else if (!strcmp(topic, "profile-change-net-restore")) {
// initialize connection manager
InitConnectionMgr();
} else if (!strcmp(topic, "net:clear-active-logins")) {
- mAuthCache.ClearAll();
- mPrivateAuthCache.ClearAll();
+ Unused << mAuthCache.ClearAll();
+ Unused << mPrivateAuthCache.ClearAll();
} else if (!strcmp(topic, "net:prune-dead-connections")) {
if (mConnMgr) {
- mConnMgr->PruneDeadConnections();
+ rv = mConnMgr->PruneDeadConnections();
+ if (NS_FAILED(rv)) {
+ LOG((" PruneDeadConnections failed (%08x)\n",
+ static_cast<uint32_t>(rv)));
+ }
}
} else if (!strcmp(topic, "net:prune-all-connections")) {
if (mConnMgr) {
- mConnMgr->DoShiftReloadConnectionCleanup(nullptr);
- mConnMgr->PruneDeadConnections();
+ rv = mConnMgr->DoShiftReloadConnectionCleanup(nullptr);
+ if (NS_FAILED(rv)) {
+ LOG((" DoShiftReloadConnectionCleanup failed (%08x)\n",
+ static_cast<uint32_t>(rv)));
+ }
+ rv = mConnMgr->PruneDeadConnections();
+ if (NS_FAILED(rv)) {
+ LOG((" PruneDeadConnections failed (%08x)\n",
+ static_cast<uint32_t>(rv)));
+ }
}
#if 0
} else if (!strcmp(topic, "net:failed-to-process-uri-content")) {
// nop right now - we used to cancel h1 pipelines based on this,
// but those are no longer implemented
nsCOMPtr<nsIURI> uri = do_QueryInterface(subject);
#endif
} else if (!strcmp(topic, "last-pb-context-exited")) {
- mPrivateAuthCache.ClearAll();
+ Unused << mPrivateAuthCache.ClearAll();
if (mConnMgr) {
mConnMgr->ClearAltServiceMappings();
}
} else if (!strcmp(topic, "browser:purge-session-history")) {
if (mConnMgr) {
if (gSocketTransportService) {
nsCOMPtr<nsIRunnable> event =
NewRunnableMethod(mConnMgr,
@@ -2057,25 +2106,37 @@ nsHttpHandler::Observe(nsISupports *subj
gSocketTransportService->Dispatch(event, NS_DISPATCH_NORMAL);
}
mConnMgr->ClearAltServiceMappings();
}
} else if (!strcmp(topic, NS_NETWORK_LINK_TOPIC)) {
nsAutoCString converted = NS_ConvertUTF16toUTF8(data);
if (!strcmp(converted.get(), NS_NETWORK_LINK_DATA_CHANGED)) {
if (mConnMgr) {
- mConnMgr->PruneDeadConnections();
- mConnMgr->VerifyTraffic();
+ rv = mConnMgr->PruneDeadConnections();
+ if (NS_FAILED(rv)) {
+ LOG((" PruneDeadConnections failed (%08x)\n",
+ static_cast<uint32_t>(rv)));
+ }
+ rv = mConnMgr->VerifyTraffic();
+ if (NS_FAILED(rv)) {
+ LOG((" VerifyTraffic failed (%08x)\n",
+ static_cast<uint32_t>(rv)));
+ }
}
}
} else if (!strcmp(topic, "application-background")) {
// going to the background on android means we should close
// down idle connections for power conservation
if (mConnMgr) {
- mConnMgr->DoShiftReloadConnectionCleanup(nullptr);
+ rv = mConnMgr->DoShiftReloadConnectionCleanup(nullptr);
+ if (NS_FAILED(rv)) {
+ LOG((" DoShiftReloadConnectionCleanup failed (%08x)\n",
+ static_cast<uint32_t>(rv)));
+ }
}
}
return NS_OK;
}
// nsISpeculativeConnect
@@ -2338,17 +2399,21 @@ nsHttpsHandler::AllowPort(int32_t aPort,
return NS_OK;
}
void
nsHttpHandler::ShutdownConnectionManager()
{
// ensure connection manager is shutdown
if (mConnMgr) {
- mConnMgr->Shutdown();
+ nsresult rv = mConnMgr->Shutdown();
+ if (NS_FAILED(rv)) {
+ LOG(("nsHttpHandler::ShutdownConnectionManager\n"
+ " failed to shutdown connection manager\n"));
+ }
}
}
nsresult
nsHttpHandler::NewChannelId(nsID *channelId)
{
MOZ_ASSERT(NS_IsMainThread());
if (!mUUIDGen) {
--- a/netwerk/protocol/http/nsHttpNTLMAuth.cpp
+++ b/netwerk/protocol/http/nsHttpNTLMAuth.cpp
@@ -111,17 +111,17 @@ CanUseDefaultCredentials(nsIHttpAuthenti
if (NS_SUCCEEDED(prefs->GetBoolPref("browser.privatebrowsing.autostart",
&dontRememberHistory)) &&
!dontRememberHistory) {
return false;
}
}
nsCOMPtr<nsIURI> uri;
- channel->GetURI(getter_AddRefs(uri));
+ Unused << channel->GetURI(getter_AddRefs(uri));
bool allowNonFqdn;
if (NS_FAILED(prefs->GetBoolPref(kAllowNonFqdn, &allowNonFqdn)))
allowNonFqdn = false;
if (allowNonFqdn && uri && IsNonFqdn(uri)) {
LOG(("Host is non-fqdn, default credentials are allowed\n"));
return true;
}
--- a/netwerk/protocol/http/nsHttpResponseHead.cpp
+++ b/netwerk/protocol/http/nsHttpResponseHead.cpp
@@ -2,16 +2,17 @@
/* vim:set ts=4 sw=4 sts=4 et cin: */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
// HttpLog.h should generally be included first
#include "HttpLog.h"
+#include "mozilla/Unused.h"
#include "nsHttpResponseHead.h"
#include "nsIHttpHeaderVisitor.h"
#include "nsPrintfCString.h"
#include "prtime.h"
#include "plstr.h"
#include "nsURLHelper.h"
#include <algorithm>
@@ -289,17 +290,17 @@ nsHttpResponseHead::ParseCachedHead(cons
if (*block == 0)
break;
p = PL_strstr(block, "\r\n");
if (!p)
return NS_ERROR_UNEXPECTED;
- ParseHeaderLine_locked(nsDependentCSubstring(block, p - block), false);
+ Unused << ParseHeaderLine_locked(nsDependentCSubstring(block, p - block), false);
} while (1);
return NS_OK;
}
nsresult
nsHttpResponseHead::ParseCachedOriginalHeaders(char *block)
--- a/netwerk/protocol/http/nsHttpTransaction.cpp
+++ b/netwerk/protocol/http/nsHttpTransaction.cpp
@@ -277,23 +277,27 @@ nsHttpTransaction::Init(uint32_t caps,
}
// If the request body does not include headers or if there is no request
// body, then we must add the header/body separator manually.
if (!requestBodyHasHeaders || !requestBody)
mReqHeaderBuf.AppendLiteral("\r\n");
// report the request header
- if (mActivityDistributor)
- mActivityDistributor->ObserveActivity(
+ if (mActivityDistributor) {
+ rv = mActivityDistributor->ObserveActivity(
mChannel,
NS_HTTP_ACTIVITY_TYPE_HTTP_TRANSACTION,
NS_HTTP_ACTIVITY_SUBTYPE_REQUEST_HEADER,
PR_Now(), 0,
mReqHeaderBuf);
+ if (NS_FAILED(rv)) {
+ LOG3(("ObserveActivity failed (%08x)", static_cast<uint32_t>(rv)));
+ }
+ }
// Create a string stream for the request header buf (the stream holds
// a non-owning reference to the request header data, so we MUST keep
// mReqHeaderBuf around).
nsCOMPtr<nsIInputStream> headers;
rv = NS_NewByteInputStream(getter_AddRefs(headers),
mReqHeaderBuf.get(),
mReqHeaderBuf.Length());
@@ -571,31 +575,38 @@ nsHttpTransaction::OnTransportStatus(nsI
MOZ_ASSERT(PR_GetCurrentThread() == gSocketThread);
// Need to do this before the STATUS_RECEIVING_FROM check below, to make
// sure that the activity distributor gets told about all status events.
if (mActivityDistributor) {
// upon STATUS_WAITING_FOR; report request body sent
if ((mHasRequestBody) &&
- (status == NS_NET_STATUS_WAITING_FOR))
- mActivityDistributor->ObserveActivity(
+ (status == NS_NET_STATUS_WAITING_FOR)) {
+ nsresult rv = mActivityDistributor->ObserveActivity(
mChannel,
NS_HTTP_ACTIVITY_TYPE_HTTP_TRANSACTION,
NS_HTTP_ACTIVITY_SUBTYPE_REQUEST_BODY_SENT,
PR_Now(), 0, EmptyCString());
+ if (NS_FAILED(rv)) {
+ LOG3(("ObserveActivity failed (%08x)", static_cast<uint32_t>(rv)));
+ }
+ }
// report the status and progress
- mActivityDistributor->ObserveActivity(
+ nsresult rv = mActivityDistributor->ObserveActivity(
mChannel,
NS_HTTP_ACTIVITY_TYPE_SOCKET_TRANSPORT,
static_cast<uint32_t>(status),
PR_Now(),
progress,
EmptyCString());
+ if (NS_FAILED(rv)) {
+ LOG3(("ObserveActivity failed (%08x)", static_cast<uint32_t>(rv)));
+ }
}
// nsHttpChannel synthesizes progress events in OnDataAvailable
if (status == NS_NET_STATUS_RECEIVING_FROM)
return;
int64_t progressMax;
@@ -738,17 +749,17 @@ nsHttpTransaction::ReadSegments(nsAHttpS
// if read would block then we need to AsyncWait on the request stream.
// have callback occur on socket thread so we stay synchronized.
if (rv == NS_BASE_STREAM_WOULD_BLOCK) {
nsCOMPtr<nsIAsyncInputStream> asyncIn =
do_QueryInterface(mRequestStream);
if (asyncIn) {
nsCOMPtr<nsIEventTarget> target;
- gHttpHandler->GetSocketThreadTarget(getter_AddRefs(target));
+ Unused << gHttpHandler->GetSocketThreadTarget(getter_AddRefs(target));
if (target)
asyncIn->AsyncWait(this, 0, 0, target);
else {
NS_ERROR("no socket thread event target");
rv = NS_ERROR_UNEXPECTED;
}
}
}
@@ -846,17 +857,17 @@ nsHttpTransaction::WriteSegments(nsAHttp
}
mForceRestart = false;
}
// if pipe would block then we need to AsyncWait on it. have callback
// occur on socket thread so we stay synchronized.
if (rv == NS_BASE_STREAM_WOULD_BLOCK) {
nsCOMPtr<nsIEventTarget> target;
- gHttpHandler->GetSocketThreadTarget(getter_AddRefs(target));
+ Unused << gHttpHandler->GetSocketThreadTarget(getter_AddRefs(target));
if (target) {
mPipeOut->AsyncWait(this, 0, 0, target);
mWaitingOnPipeOut = true;
} else {
NS_ERROR("no socket thread event target");
rv = NS_ERROR_UNEXPECTED;
}
}
@@ -889,31 +900,38 @@ nsHttpTransaction::Close(nsresult reason
if (mTokenBucketCancel) {
mTokenBucketCancel->Cancel(reason);
mTokenBucketCancel = nullptr;
}
if (mActivityDistributor) {
// report the reponse is complete if not already reported
- if (!mResponseIsComplete)
- mActivityDistributor->ObserveActivity(
+ if (!mResponseIsComplete) {
+ nsresult rv = mActivityDistributor->ObserveActivity(
mChannel,
NS_HTTP_ACTIVITY_TYPE_HTTP_TRANSACTION,
NS_HTTP_ACTIVITY_SUBTYPE_RESPONSE_COMPLETE,
PR_Now(),
static_cast<uint64_t>(mContentRead),
EmptyCString());
+ if (NS_FAILED(rv)) {
+ LOG3(("ObserveActivity failed (%08x)", static_cast<uint32_t>(rv)));
+ }
+ }
// report that this transaction is closing
- mActivityDistributor->ObserveActivity(
+ nsresult rv = mActivityDistributor->ObserveActivity(
mChannel,
NS_HTTP_ACTIVITY_TYPE_HTTP_TRANSACTION,
NS_HTTP_ACTIVITY_SUBTYPE_TRANSACTION_CLOSE,
PR_Now(), 0, EmptyCString());
+ if (NS_FAILED(rv)) {
+ LOG3(("ObserveActivity failed (%08x)", static_cast<uint32_t>(rv)));
+ }
}
// we must no longer reference the connection! find out if the
// connection was being reused before letting it go.
bool connReused = false;
if (mConnection) {
connReused = mConnection->IsReused();
}
@@ -1022,17 +1040,17 @@ nsHttpTransaction::Close(nsresult reason
// the server has not sent the final \r\n terminating the header
// section, and there may still be a header line unparsed. let's make
// sure we parse the remaining header line, and then hopefully, the
// response will be usable (see bug 88792).
if (!mHaveAllHeaders) {
char data = '\n';
uint32_t unused;
- ParseHead(&data, 1, &unused);
+ Unused << ParseHead(&data, 1, &unused);
if (mResponseHead->Version() == NS_HTTP_VERSION_0_9) {
// Reject 0 byte HTTP/0.9 Responses - bug 423506
LOG(("nsHttpTransaction::Close %p 0 Byte 0.9 Response", this));
reason = NS_ERROR_NET_RESET;
}
}
@@ -1316,21 +1334,25 @@ nsHttpTransaction::ParseHead(char *buf,
if (!mResponseHead) {
mResponseHead = new nsHttpResponseHead();
if (!mResponseHead)
return NS_ERROR_OUT_OF_MEMORY;
// report that we have a least some of the response
if (mActivityDistributor && !mReportedStart) {
mReportedStart = true;
- mActivityDistributor->ObserveActivity(
+ rv = mActivityDistributor->ObserveActivity(
mChannel,
NS_HTTP_ACTIVITY_TYPE_HTTP_TRANSACTION,
NS_HTTP_ACTIVITY_SUBTYPE_RESPONSE_START,
PR_Now(), 0, EmptyCString());
+ if (NS_FAILED(rv)) {
+ LOG3(("ObserveActivity failed (%08x)",
+ static_cast<uint32_t>(rv)));
+ }
}
}
if (!mHttpResponseMatched) {
// Normally we insist on seeing HTTP/1.x in the first few bytes,
// but if we are on a persistent connection and the previous transaction
// was not supposed to have any content then we need to be prepared
// to skip over a response body that the server may have sent even
@@ -1601,24 +1623,29 @@ nsHttpTransaction::HandleContent(char *b
mResponseIsComplete = true;
ReleaseBlockingTransaction();
if (TimingEnabled()) {
SetResponseEnd(TimeStamp::Now());
}
// report the entire response has arrived
- if (mActivityDistributor)
- mActivityDistributor->ObserveActivity(
+ if (mActivityDistributor) {
+ rv = mActivityDistributor->ObserveActivity(
mChannel,
NS_HTTP_ACTIVITY_TYPE_HTTP_TRANSACTION,
NS_HTTP_ACTIVITY_SUBTYPE_RESPONSE_COMPLETE,
PR_Now(),
static_cast<uint64_t>(mContentRead),
EmptyCString());
+ if (NS_FAILED(rv)) {
+ LOG3(("ObserveActivity failed (%08x)",
+ static_cast<uint32_t>(rv)));
+ }
+ }
}
return NS_OK;
}
nsresult
nsHttpTransaction::ProcessData(char *buf, uint32_t count, uint32_t *countRead)
{
@@ -1658,22 +1685,26 @@ nsHttpTransaction::ProcessData(char *buf
// report the completed response header
if (mActivityDistributor && mResponseHead && mHaveAllHeaders &&
!mReportedResponseHeader) {
mReportedResponseHeader = true;
nsAutoCString completeResponseHeaders;
mResponseHead->Flatten(completeResponseHeaders, false);
completeResponseHeaders.AppendLiteral("\r\n");
- mActivityDistributor->ObserveActivity(
+ rv = mActivityDistributor->ObserveActivity(
mChannel,
NS_HTTP_ACTIVITY_TYPE_HTTP_TRANSACTION,
NS_HTTP_ACTIVITY_SUBTYPE_RESPONSE_HEADER,
PR_Now(), 0,
completeResponseHeaders);
+ if (NS_FAILED(rv)) {
+ LOG3(("ObserveActivity failed (%08x)",
+ static_cast<uint32_t>(rv)));
+ }
}
}
// even though count may be 0, we still want to call HandleContent
// so it can complete the transaction if this is a "no-content" response.
if (mHaveAllHeaders) {
uint32_t countRemaining = 0;
//
@@ -1749,17 +1780,21 @@ nsHttpTransaction::RemoveDispatchedAsBlo
LOG(("nsHttpTransaction removing blocking transaction %p from "
"request context %p. %d blockers remain.\n", this,
mRequestContext.get(), blockers));
if (NS_SUCCEEDED(rv) && !blockers) {
LOG(("nsHttpTransaction %p triggering release of blocked channels "
" with request context=%p\n", this, mRequestContext.get()));
- gHttpHandler->ConnMgr()->ProcessPendingQ();
+ rv = gHttpHandler->ConnMgr()->ProcessPendingQ();
+ if (NS_FAILED(rv)) {
+ LOG(("nsHttpTransaction::RemoveDispatchedAsBlocking\n"
+ " failed to process pending queue\n"));
+ }
}
mDispatchedAsBlocking = false;
}
void
nsHttpTransaction::ReleaseBlockingTransaction()
{
@@ -2001,29 +2036,34 @@ nsHttpTransaction::DeleteSelfOnConsumerT
bool
nsHttpTransaction::TryToRunPacedRequest()
{
if (mSubmittedRatePacing)
return mPassedRatePacing;
mSubmittedRatePacing = true;
mSynchronousRatePaceRequest = true;
- gHttpHandler->SubmitPacedRequest(this, getter_AddRefs(mTokenBucketCancel));
+ Unused << gHttpHandler->SubmitPacedRequest(this, getter_AddRefs(mTokenBucketCancel));
mSynchronousRatePaceRequest = false;
return mPassedRatePacing;
}
void
nsHttpTransaction::OnTokenBucketAdmitted()
{
mPassedRatePacing = true;
mTokenBucketCancel = nullptr;
- if (!mSynchronousRatePaceRequest)
- gHttpHandler->ConnMgr()->ProcessPendingQ(mConnInfo);
+ if (!mSynchronousRatePaceRequest) {
+ nsresult rv = gHttpHandler->ConnMgr()->ProcessPendingQ(mConnInfo);
+ if (NS_FAILED(rv)) {
+ LOG(("nsHttpTransaction::OnTokenBucketAdmitted\n"
+ " failed to process pending queue\n"));
+ }
+ }
}
void
nsHttpTransaction::CancelPacing(nsresult reason)
{
if (mTokenBucketCancel) {
mTokenBucketCancel->Cancel(reason);
mTokenBucketCancel = nullptr;
--- a/netwerk/streamconv/converters/nsUnknownDecoder.cpp
+++ b/netwerk/streamconv/converters/nsUnknownDecoder.cpp
@@ -788,18 +788,18 @@ nsBinaryDetector::DetermineContentType(n
{
nsCOMPtr<nsIHttpChannel> httpChannel = do_QueryInterface(aRequest);
if (!httpChannel) {
return;
}
// It's an HTTP channel. Check for the text/plain mess
nsAutoCString contentTypeHdr;
- httpChannel->GetResponseHeader(NS_LITERAL_CSTRING("Content-Type"),
- contentTypeHdr);
+ Unused << httpChannel->GetResponseHeader(NS_LITERAL_CSTRING("Content-Type"),
+ contentTypeHdr);
nsAutoCString contentType;
httpChannel->GetContentType(contentType);
// Make sure to do a case-sensitive exact match comparison here. Apache
// 1.x just sends text/plain for "unknown", while Apache 2.x sends
// text/plain with a ISO-8859-1 charset. Debian's Apache version, just to
// be different, sends text/plain with iso-8859-1 charset. For extra fun,
// FC7, RHEL4, and Ubuntu Feisty send charset=UTF-8. Don't do general
@@ -813,18 +813,18 @@ nsBinaryDetector::DetermineContentType(n
return;
}
// Check whether we have content-encoding. If we do, don't try to
// detect the type.
// XXXbz we could improve this by doing a local decompress if we
// wanted, I'm sure.
nsAutoCString contentEncoding;
- httpChannel->GetResponseHeader(NS_LITERAL_CSTRING("Content-Encoding"),
- contentEncoding);
+ Unused << httpChannel->GetResponseHeader(NS_LITERAL_CSTRING("Content-Encoding"),
+ contentEncoding);
if (!contentEncoding.IsEmpty()) {
return;
}
LastDitchSniff(aRequest);
if (mContentType.Equals(APPLICATION_OCTET_STREAM)) {
// We want to guess at it instead
mContentType = APPLICATION_GUESS_FROM_EXT;