зеркало из https://github.com/mozilla/gecko-dev.git
Backed out 5 changesets (bug 1646358) for perma failures on nsTSubstring.h. CLOSED TREE
Backed out changeset 432a56d9e68e (bug 1646358) Backed out changeset f7ebad48e890 (bug 1646358) Backed out changeset aa32d2fc1762 (bug 1646358) Backed out changeset 91fce3e27eac (bug 1646358) Backed out changeset 059a823032d2 (bug 1646358)
This commit is contained in:
Родитель
fdf93b1ef5
Коммит
c71ba38690
|
@ -416,8 +416,7 @@ HttpTransactionChild::OnStartRequest(nsIRequest* aRequest) {
|
|||
Maybe<nsCString> optionalAltSvcUsed;
|
||||
nsCString altSvcUsed;
|
||||
if (NS_SUCCEEDED(mTransaction->RequestHead()->GetHeader(
|
||||
nsHttp::Alternate_Service_Used, altSvcUsed)) &&
|
||||
!altSvcUsed.IsEmpty()) {
|
||||
nsHttp::Alternate_Service_Used, altSvcUsed))) {
|
||||
optionalAltSvcUsed.emplace(altSvcUsed);
|
||||
}
|
||||
|
||||
|
@ -486,11 +485,14 @@ HttpTransactionChild::OnStopRequest(nsIRequest* aRequest, nsresult aStatus) {
|
|||
responseTrailers.emplace(*headerArray);
|
||||
}
|
||||
|
||||
Unused << SendOnStopRequest(
|
||||
aStatus, mTransaction->ResponseIsComplete(),
|
||||
mTransaction->GetTransferSize(),
|
||||
ToTimingStructArgs(mTransaction->Timings()), responseTrailers,
|
||||
mTransaction->HasStickyConnection(), mTransactionObserverResult);
|
||||
int64_t requestSize = mTransaction->GetRequestSize();
|
||||
|
||||
Unused << SendOnStopRequest(aStatus, mTransaction->ResponseIsComplete(),
|
||||
mTransaction->GetTransferSize(),
|
||||
ToTimingStructArgs(mTransaction->Timings()),
|
||||
responseTrailers,
|
||||
mTransaction->HasStickyConnection(),
|
||||
mTransactionObserverResult, requestSize);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
@ -511,7 +513,6 @@ HttpTransactionChild::OnTransportStatus(nsITransport* aTransport,
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
Maybe<NetworkAddressArg> arg;
|
||||
if (aStatus == NS_NET_STATUS_CONNECTED_TO ||
|
||||
aStatus == NS_NET_STATUS_WAITING_FOR) {
|
||||
NetAddr selfAddr;
|
||||
|
@ -528,10 +529,10 @@ HttpTransactionChild::OnTransportStatus(nsITransport* aTransport,
|
|||
socketTransport->ResolvedByTRR(&isTrr);
|
||||
}
|
||||
}
|
||||
arg.emplace(selfAddr, peerAddr, isTrr);
|
||||
Unused << SendOnNetAddrUpdate(selfAddr, peerAddr, isTrr);
|
||||
}
|
||||
|
||||
Unused << SendOnTransportStatus(aStatus, aProgress, aProgressMax, arg);
|
||||
Unused << SendOnTransportStatus(aStatus, aProgress, aProgressMax);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
|
|
@ -188,15 +188,6 @@ nsresult HttpTransactionParent::Init(
|
|||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
nsCString reqHeaderBuf = nsHttp::ConvertRequestHeadToString(
|
||||
*requestHead, !!requestBody, requestBodyHasHeaders,
|
||||
cinfo->UsingConnect());
|
||||
requestContentLength += reqHeaderBuf.Length();
|
||||
|
||||
mRequestSize = InScriptableRange(requestContentLength)
|
||||
? static_cast<int64_t>(requestContentLength)
|
||||
: -1;
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
@ -487,6 +478,9 @@ void HttpTransactionParent::DoOnStartRequest(
|
|||
Unused << httpChannel->SetRequestHeader(
|
||||
nsDependentCString(nsHttp::Alternate_Service_Used), aAltSvcUsed.ref(),
|
||||
false);
|
||||
} else {
|
||||
Unused << httpChannel->SetEmptyRequestHeader(
|
||||
nsDependentCString(nsHttp::Alternate_Service_Used));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -500,17 +494,23 @@ void HttpTransactionParent::DoOnStartRequest(
|
|||
|
||||
mozilla::ipc::IPCResult HttpTransactionParent::RecvOnTransportStatus(
|
||||
const nsresult& aStatus, const int64_t& aProgress,
|
||||
const int64_t& aProgressMax,
|
||||
Maybe<NetworkAddressArg>&& aNetworkAddressArg) {
|
||||
if (aNetworkAddressArg) {
|
||||
mSelfAddr = aNetworkAddressArg->selfAddr();
|
||||
mPeerAddr = aNetworkAddressArg->peerAddr();
|
||||
mResolvedByTRR = aNetworkAddressArg->resolvedByTRR();
|
||||
}
|
||||
mEventsink->OnTransportStatus(nullptr, aStatus, aProgress, aProgressMax);
|
||||
const int64_t& aProgressMax) {
|
||||
mEventQ->RunOrEnqueue(new NeckoTargetChannelFunctionEvent(
|
||||
this, [self = UnsafePtr<HttpTransactionParent>(this), aStatus, aProgress,
|
||||
aProgressMax]() {
|
||||
self->DoOnTransportStatus(aStatus, aProgress, aProgressMax);
|
||||
}));
|
||||
return IPC_OK();
|
||||
}
|
||||
|
||||
void HttpTransactionParent::DoOnTransportStatus(const nsresult& aStatus,
|
||||
const int64_t& aProgress,
|
||||
const int64_t& aProgressMax) {
|
||||
LOG(("HttpTransactionParent::DoOnTransportStatus [this=%p]\n", this));
|
||||
AutoEventEnqueuer ensureSerialDispatch(mEventQ);
|
||||
mEventsink->OnTransportStatus(nullptr, aStatus, aProgress, aProgressMax);
|
||||
}
|
||||
|
||||
mozilla::ipc::IPCResult HttpTransactionParent::RecvOnDataAvailable(
|
||||
const nsCString& aData, const uint64_t& aOffset, const uint32_t& aCount,
|
||||
const bool& aDataSentToChildProcess) {
|
||||
|
@ -518,11 +518,6 @@ mozilla::ipc::IPCResult HttpTransactionParent::RecvOnDataAvailable(
|
|||
" aCount=%" PRIu32,
|
||||
this, aOffset, aCount));
|
||||
|
||||
// The final transfer size is updated in OnStopRequest ipc message, but in the
|
||||
// case that the socket process is crashed or something went wrong, we might
|
||||
// not get the OnStopRequest. So, let's update the transfer size here.
|
||||
mTransferSize += aCount;
|
||||
|
||||
if (mCanceled) {
|
||||
return IPC_OK();
|
||||
}
|
||||
|
@ -590,7 +585,8 @@ mozilla::ipc::IPCResult HttpTransactionParent::RecvOnStopRequest(
|
|||
const int64_t& aTransferSize, const TimingStructArgs& aTimings,
|
||||
const Maybe<nsHttpHeaderArray>& aResponseTrailers,
|
||||
const bool& aHasStickyConn,
|
||||
Maybe<TransactionObserverResult>&& aTransactionObserverResult) {
|
||||
Maybe<TransactionObserverResult>&& aTransactionObserverResult,
|
||||
const int64_t& aRequestSize) {
|
||||
LOG(("HttpTransactionParent::RecvOnStopRequest [this=%p status=%" PRIx32
|
||||
"]\n",
|
||||
this, static_cast<uint32_t>(aStatus)));
|
||||
|
@ -601,11 +597,12 @@ mozilla::ipc::IPCResult HttpTransactionParent::RecvOnStopRequest(
|
|||
this, [self = UnsafePtr<HttpTransactionParent>(this), aStatus,
|
||||
aResponseIsComplete, aTransferSize, aTimings, aResponseTrailers,
|
||||
aHasStickyConn,
|
||||
aTransactionObserverResult{
|
||||
std::move(aTransactionObserverResult)}]() mutable {
|
||||
aTransactionObserverResult{std::move(aTransactionObserverResult)},
|
||||
aRequestSize]() mutable {
|
||||
self->DoOnStopRequest(aStatus, aResponseIsComplete, aTransferSize,
|
||||
aTimings, aResponseTrailers, aHasStickyConn,
|
||||
std::move(aTransactionObserverResult));
|
||||
std::move(aTransactionObserverResult),
|
||||
aRequestSize);
|
||||
}));
|
||||
return IPC_OK();
|
||||
}
|
||||
|
@ -615,7 +612,8 @@ void HttpTransactionParent::DoOnStopRequest(
|
|||
const int64_t& aTransferSize, const TimingStructArgs& aTimings,
|
||||
const Maybe<nsHttpHeaderArray>& aResponseTrailers,
|
||||
const bool& aHasStickyConn,
|
||||
Maybe<TransactionObserverResult>&& aTransactionObserverResult) {
|
||||
Maybe<TransactionObserverResult>&& aTransactionObserverResult,
|
||||
const int64_t& aRequestSize) {
|
||||
LOG(("HttpTransactionParent::DoOnStopRequest [this=%p]\n", this));
|
||||
if (mCanceled) {
|
||||
return;
|
||||
|
@ -629,7 +627,7 @@ void HttpTransactionParent::DoOnStopRequest(
|
|||
|
||||
mResponseIsComplete = aResponseIsComplete;
|
||||
mTransferSize = aTransferSize;
|
||||
|
||||
mRequestSize = aRequestSize;
|
||||
TimingStructArgsToTimingsStruct(aTimings, mTimings);
|
||||
|
||||
if (aResponseTrailers.isSome()) {
|
||||
|
@ -647,6 +645,15 @@ void HttpTransactionParent::DoOnStopRequest(
|
|||
mOnStopRequestCalled = true;
|
||||
}
|
||||
|
||||
mozilla::ipc::IPCResult HttpTransactionParent::RecvOnNetAddrUpdate(
|
||||
const NetAddr& aSelfAddr, const NetAddr& aPeerAddr,
|
||||
const bool& aResolvedByTRR) {
|
||||
mSelfAddr = aSelfAddr;
|
||||
mPeerAddr = aPeerAddr;
|
||||
mResolvedByTRR = aResolvedByTRR;
|
||||
return IPC_OK();
|
||||
}
|
||||
|
||||
mozilla::ipc::IPCResult HttpTransactionParent::RecvOnInitFailed(
|
||||
const nsresult& aStatus) {
|
||||
nsCOMPtr<nsIRequest> request = do_QueryInterface(mEventsink);
|
||||
|
|
|
@ -53,10 +53,9 @@ class HttpTransactionParent final : public PHttpTransactionParent,
|
|||
const bool& aProxyConnectFailed, const TimingStructArgs& aTimings,
|
||||
const int32_t& aProxyConnectResponseCode,
|
||||
nsTArray<uint8_t>&& aDataForSniffer, const Maybe<nsCString>& aAltSvcUsed);
|
||||
mozilla::ipc::IPCResult RecvOnTransportStatus(
|
||||
const nsresult& aStatus, const int64_t& aProgress,
|
||||
const int64_t& aProgressMax,
|
||||
Maybe<NetworkAddressArg>&& aNetworkAddressArg);
|
||||
mozilla::ipc::IPCResult RecvOnTransportStatus(const nsresult& aStatus,
|
||||
const int64_t& aProgress,
|
||||
const int64_t& aProgressMax);
|
||||
mozilla::ipc::IPCResult RecvOnDataAvailable(
|
||||
const nsCString& aData, const uint64_t& aOffset, const uint32_t& aCount,
|
||||
const bool& aDataSentToChildProcess);
|
||||
|
@ -65,7 +64,11 @@ class HttpTransactionParent final : public PHttpTransactionParent,
|
|||
const int64_t& aTransferSize, const TimingStructArgs& aTimings,
|
||||
const Maybe<nsHttpHeaderArray>& responseTrailers,
|
||||
const bool& aHasStickyConn,
|
||||
Maybe<TransactionObserverResult>&& aTransactionObserverResult);
|
||||
Maybe<TransactionObserverResult>&& aTransactionObserverResult,
|
||||
const int64_t& aRequestSize);
|
||||
mozilla::ipc::IPCResult RecvOnNetAddrUpdate(const NetAddr& aSelfAddr,
|
||||
const NetAddr& aPeerAddr,
|
||||
const bool& aResolvedByTRR);
|
||||
mozilla::ipc::IPCResult RecvOnInitFailed(const nsresult& aStatus);
|
||||
|
||||
mozilla::ipc::IPCResult RecvOnH2PushStream(const uint32_t& aPushedStreamId,
|
||||
|
@ -91,6 +94,8 @@ class HttpTransactionParent final : public PHttpTransactionParent,
|
|||
const int32_t& aProxyConnectResponseCode,
|
||||
nsTArray<uint8_t>&& aDataForSniffer,
|
||||
const Maybe<nsCString>& aAltSvcUsed);
|
||||
void DoOnTransportStatus(const nsresult& aStatus, const int64_t& aProgress,
|
||||
const int64_t& aProgressMax);
|
||||
void DoOnDataAvailable(const nsCString& aData, const uint64_t& aOffset,
|
||||
const uint32_t& aCount,
|
||||
const bool& aDataSentToChildProcess);
|
||||
|
@ -99,7 +104,8 @@ class HttpTransactionParent final : public PHttpTransactionParent,
|
|||
const int64_t& aTransferSize, const TimingStructArgs& aTimings,
|
||||
const Maybe<nsHttpHeaderArray>& responseTrailers,
|
||||
const bool& aHasStickyConn,
|
||||
Maybe<TransactionObserverResult>&& aTransactionObserverResult);
|
||||
Maybe<TransactionObserverResult>&& aTransactionObserverResult,
|
||||
const int64_t& aRequestSize);
|
||||
void DoNotifyListener();
|
||||
void ContinueDoNotifyListener();
|
||||
// Get event target for ODA.
|
||||
|
|
|
@ -26,12 +26,6 @@ struct H2PushedStreamArg {
|
|||
uint32_t pushedStreamId;
|
||||
};
|
||||
|
||||
struct NetworkAddressArg {
|
||||
NetAddr selfAddr;
|
||||
NetAddr peerAddr;
|
||||
bool resolvedByTRR;
|
||||
};
|
||||
|
||||
refcounted protocol PHttpTransaction
|
||||
{
|
||||
manager PSocketProcess;
|
||||
|
@ -47,8 +41,7 @@ parent:
|
|||
nsCString? altSvcUsed);
|
||||
async OnTransportStatus(nsresult status,
|
||||
int64_t progress,
|
||||
int64_t progressMax,
|
||||
NetworkAddressArg? networkAddressArg);
|
||||
int64_t progressMax);
|
||||
async OnDataAvailable(nsCString data,
|
||||
uint64_t offset,
|
||||
uint32_t count,
|
||||
|
@ -59,7 +52,9 @@ parent:
|
|||
TimingStructArgs timings,
|
||||
nsHttpHeaderArray? responseTrailers,
|
||||
bool hasStickyConn,
|
||||
TransactionObserverResult? transactionObserverResult);
|
||||
TransactionObserverResult? transactionObserverResult,
|
||||
int64_t requestSize);
|
||||
async OnNetAddrUpdate(NetAddr selfAddr, NetAddr peerAddr, bool resolvedByTRR);
|
||||
async OnInitFailed(nsresult status);
|
||||
async OnH2PushStream(uint32_t pushedStreamId,
|
||||
nsCString resourceUrl,
|
||||
|
|
|
@ -523,43 +523,6 @@ bool IsBeforeLastActiveTabLoadOptimization(TimeStamp const& when) {
|
|||
gHttpHandler->IsBeforeLastActiveTabLoadOptimization(when);
|
||||
}
|
||||
|
||||
nsCString ConvertRequestHeadToString(nsHttpRequestHead& aRequestHead,
|
||||
bool aHasRequestBody,
|
||||
bool aRequestBodyHasHeaders,
|
||||
bool aUsingConnect) {
|
||||
// Make sure that there is "Content-Length: 0" header in the requestHead
|
||||
// in case of POST and PUT methods when there is no requestBody and
|
||||
// requestHead doesn't contain "Transfer-Encoding" header.
|
||||
//
|
||||
// RFC1945 section 7.2.2:
|
||||
// HTTP/1.0 requests containing an entity body must include a valid
|
||||
// Content-Length header field.
|
||||
//
|
||||
// RFC2616 section 4.4:
|
||||
// For compatibility with HTTP/1.0 applications, HTTP/1.1 requests
|
||||
// containing a message-body MUST include a valid Content-Length header
|
||||
// field unless the server is known to be HTTP/1.1 compliant.
|
||||
if ((aRequestHead.IsPost() || aRequestHead.IsPut()) && !aHasRequestBody &&
|
||||
!aRequestHead.HasHeader(nsHttp::Transfer_Encoding)) {
|
||||
DebugOnly<nsresult> rv =
|
||||
aRequestHead.SetHeader(nsHttp::Content_Length, "0"_ns);
|
||||
MOZ_ASSERT(NS_SUCCEEDED(rv));
|
||||
}
|
||||
|
||||
nsCString reqHeaderBuf;
|
||||
reqHeaderBuf.Truncate();
|
||||
|
||||
// make sure we eliminate any proxy specific headers from
|
||||
// the request if we are using CONNECT
|
||||
aRequestHead.Flatten(reqHeaderBuf, aUsingConnect);
|
||||
|
||||
if (!aRequestBodyHasHeaders || !aHasRequestBody) {
|
||||
reqHeaderBuf.AppendLiteral("\r\n");
|
||||
}
|
||||
|
||||
return reqHeaderBuf;
|
||||
}
|
||||
|
||||
void NotifyActiveTabLoadOptimization() {
|
||||
if (gHttpHandler) {
|
||||
gHttpHandler->NotifyActiveTabLoadOptimization();
|
||||
|
|
|
@ -254,12 +254,6 @@ bool IsBeforeLastActiveTabLoadOptimization(TimeStamp const& when);
|
|||
#define HTTP_ATOM(_name, _value) extern nsHttpAtom _name;
|
||||
#include "nsHttpAtomList.h"
|
||||
#undef HTTP_ATOM
|
||||
|
||||
nsCString ConvertRequestHeadToString(nsHttpRequestHead& aRequestHead,
|
||||
bool aHasRequestBody,
|
||||
bool aRequestBodyHasHeaders,
|
||||
bool aUsingConnect);
|
||||
|
||||
} // namespace nsHttp
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
|
|
@ -110,13 +110,8 @@ nsHttpActivityDistributor::ObserveActivityWithArgs(
|
|||
}
|
||||
};
|
||||
|
||||
if (!NS_IsMainThread()) {
|
||||
return NS_DispatchToMainThread(NS_NewRunnableFunction(
|
||||
"net::nsHttpActivityDistributor::ObserveActivityWithArgs", task));
|
||||
}
|
||||
|
||||
task();
|
||||
return NS_OK;
|
||||
return NS_DispatchToMainThread(NS_NewRunnableFunction(
|
||||
"net::nsHttpActivityDistributor::ObserveActivityWithArgs", task));
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
|
|
|
@ -316,12 +316,33 @@ nsresult nsHttpTransaction::Init(
|
|||
mNoContent = true;
|
||||
}
|
||||
|
||||
// Make sure that there is "Content-Length: 0" header in the requestHead
|
||||
// in case of POST and PUT methods when there is no requestBody and
|
||||
// requestHead doesn't contain "Transfer-Encoding" header.
|
||||
//
|
||||
// RFC1945 section 7.2.2:
|
||||
// HTTP/1.0 requests containing an entity body must include a valid
|
||||
// Content-Length header field.
|
||||
//
|
||||
// RFC2616 section 4.4:
|
||||
// For compatibility with HTTP/1.0 applications, HTTP/1.1 requests
|
||||
// containing a message-body MUST include a valid Content-Length header
|
||||
// field unless the server is known to be HTTP/1.1 compliant.
|
||||
if ((requestHead->IsPost() || requestHead->IsPut()) && !requestBody &&
|
||||
!requestHead->HasHeader(nsHttp::Transfer_Encoding)) {
|
||||
rv = requestHead->SetHeader(nsHttp::Content_Length, "0"_ns);
|
||||
MOZ_ASSERT(NS_SUCCEEDED(rv));
|
||||
}
|
||||
|
||||
// grab a weak reference to the request head
|
||||
mRequestHead = requestHead;
|
||||
|
||||
mReqHeaderBuf = nsHttp::ConvertRequestHeadToString(
|
||||
*requestHead, !!requestBody, requestBodyHasHeaders,
|
||||
cinfo->UsingConnect());
|
||||
// make sure we eliminate any proxy specific headers from
|
||||
// the request if we are using CONNECT
|
||||
bool pruneProxyHeaders = cinfo->UsingConnect();
|
||||
|
||||
mReqHeaderBuf.Truncate();
|
||||
requestHead->Flatten(mReqHeaderBuf, pruneProxyHeaders);
|
||||
|
||||
if (LOG1_ENABLED()) {
|
||||
LOG1(("http request [\n"));
|
||||
|
@ -329,20 +350,19 @@ nsresult nsHttpTransaction::Init(
|
|||
LOG1(("]\n"));
|
||||
}
|
||||
|
||||
// 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) {
|
||||
RefPtr<nsHttpTransaction> self = this;
|
||||
NS_DispatchToMainThread(
|
||||
NS_NewRunnableFunction("ObserveActivityWithArgs", [self]() {
|
||||
nsresult rv = self->mActivityDistributor->ObserveActivityWithArgs(
|
||||
HttpActivityArgs(self->mChannelId),
|
||||
NS_HTTP_ACTIVITY_TYPE_HTTP_TRANSACTION,
|
||||
NS_HTTP_ACTIVITY_SUBTYPE_REQUEST_HEADER, PR_Now(), 0,
|
||||
self->mReqHeaderBuf);
|
||||
if (NS_FAILED(rv)) {
|
||||
LOG3(("ObserveActivity failed (%08x)", static_cast<uint32_t>(rv)));
|
||||
}
|
||||
}));
|
||||
rv = mActivityDistributor->ObserveActivityWithArgs(
|
||||
HttpActivityArgs(mChannelId), 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
|
||||
|
|
Загрузка…
Ссылка в новой задаче