From bfea62cf4870f835176da9593c41544e22027220 Mon Sep 17 00:00:00 2001 From: Kershaw Chang Date: Thu, 12 Sep 2019 16:24:43 +0000 Subject: [PATCH] Bug 1576171 - Send ftp channel status via OnStartRequest r=valentin In FtpChannelParent, we didn't propagate the channel status to FtpChannelChild. This could make child start to do diversion on a failed channel. Like what we did in http channel, we should send the channel status to child via OnStartRequest message. Differential Revision: https://phabricator.services.mozilla.com/D45648 --HG-- extra : moz-landing-system : lando --- netwerk/protocol/ftp/FTPChannelParent.cpp | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/netwerk/protocol/ftp/FTPChannelParent.cpp b/netwerk/protocol/ftp/FTPChannelParent.cpp index 6eaa227a06b5..368a5b2337fe 100644 --- a/netwerk/protocol/ftp/FTPChannelParent.cpp +++ b/netwerk/protocol/ftp/FTPChannelParent.cpp @@ -408,6 +408,8 @@ FTPChannelParent::OnStartRequest(nsIRequest* aRequest) { chan->GetContentLength(&contentLength); nsCString contentType; chan->GetContentType(contentType); + nsresult channelStatus = NS_OK; + chan->GetStatus(&channelStatus); nsCString entityID; nsCOMPtr resChan = do_QueryInterface(aRequest); @@ -432,8 +434,9 @@ FTPChannelParent::OnStartRequest(nsIRequest* aRequest) { chan->GetURI(getter_AddRefs(uri)); SerializeURI(uri, uriparam); - if (mIPCClosed || !SendOnStartRequest(mStatus, contentLength, contentType, - lastModified, entityID, uriparam)) { + if (mIPCClosed || + !SendOnStartRequest(channelStatus, contentLength, contentType, + lastModified, entityID, uriparam)) { return NS_ERROR_UNEXPECTED; } @@ -479,7 +482,10 @@ FTPChannelParent::OnDataAvailable(nsIRequest* aRequest, nsresult rv = NS_ReadInputStreamToString(aInputStream, data, aCount); if (NS_FAILED(rv)) return rv; - if (mIPCClosed || !SendOnDataAvailable(mStatus, data, aOffset, aCount)) + nsresult channelStatus = NS_OK; + mChannel->GetStatus(&channelStatus); + + if (mIPCClosed || !SendOnDataAvailable(channelStatus, data, aOffset, aCount)) return NS_ERROR_UNEXPECTED; return NS_OK;