Bug 1578230 - do not process transactions blocked on tunnel before a final response, r=mayhemer,necko-reviewers

Depends on D80261

Differential Revision: https://phabricator.services.mozilla.com/D81620
This commit is contained in:
Junior Hsu 2020-06-30 18:37:28 +00:00
Родитель 65da3adae8
Коммит 426527907a
4 изменённых файлов: 15 добавлений и 8 удалений

Просмотреть файл

@ -1053,8 +1053,11 @@ nsresult Http2Stream::ConvertResponseHeaders(Http2Decompressor* decompressor,
if ((httpResponseCode / 100) > 2) {
MapStreamToPlainText();
}
MapStreamToHttpConnection(aHeadersOut, httpResponseCode);
ClearTransactionsBlockedOnTunnel();
if (MapStreamToHttpConnection(aHeadersOut, httpResponseCode)) {
// Process transactions only if we have a final response, i.e., response
// code >= 200.
ClearTransactionsBlockedOnTunnel();
}
} else if (mIsWebsocket) {
LOG3(("Http2Stream %p websocket response code %d", this, httpResponseCode));
if (httpResponseCode == 200) {
@ -1620,13 +1623,13 @@ void Http2Stream::MapStreamToPlainText() {
qiTrans->ForcePlainText();
}
void Http2Stream::MapStreamToHttpConnection(const nsACString& aFlat407Headers,
bool Http2Stream::MapStreamToHttpConnection(const nsACString& aFlat407Headers,
int32_t aHttpResponseCode) {
RefPtr<SpdyConnectTransaction> qiTrans(
mTransaction->QuerySpdyConnectTransaction());
MOZ_ASSERT(qiTrans);
qiTrans->MapStreamToHttpConnection(
return qiTrans->MapStreamToHttpConnection(
mSocketTransport, mTransaction->ConnectionInfo(), aFlat407Headers,
mIsTunnel ? aHttpResponseCode : -1);
}

Просмотреть файл

@ -374,7 +374,7 @@ class Http2Stream : public nsAHttpSegmentReader,
private:
void ClearTransactionsBlockedOnTunnel();
void MapStreamToPlainText();
void MapStreamToHttpConnection(const nsACString& aFlat407Headers,
bool MapStreamToHttpConnection(const nsACString& aFlat407Headers,
int32_t aHttpResponseCode = -1);
bool mIsTunnel;

Просмотреть файл

@ -1157,7 +1157,7 @@ void SpdyConnectTransaction::ForcePlainText() {
mForcePlainText = true;
}
void SpdyConnectTransaction::MapStreamToHttpConnection(
bool SpdyConnectTransaction::MapStreamToHttpConnection(
nsISocketTransport* aTransport, nsHttpConnectionInfo* aConnInfo,
const nsACString& aFlat407Headers, int32_t aHttpResponseCode) {
MOZ_ASSERT(OnSocketThread());
@ -1167,7 +1167,7 @@ void SpdyConnectTransaction::MapStreamToHttpConnection(
("SpdyConnectTransaction::MapStreamToHttpConnection %p skip "
"pre-response with response code %d",
this, aHttpResponseCode));
return;
return false;
}
mConnInfo = aConnInfo;
@ -1233,6 +1233,8 @@ void SpdyConnectTransaction::MapStreamToHttpConnection(
mDrivingTransaction, nsISupportsPriority::PRIORITY_HIGHEST - 60);
mDrivingTransaction = nullptr;
}
return true;
}
nsresult SpdyConnectTransaction::Flush(uint32_t count, uint32_t* countRead) {

Просмотреть файл

@ -221,7 +221,9 @@ class SpdyConnectTransaction final : public NullHttpTransaction {
// CONNECT tunnel but the setup fails. The plaintext only carries the CONNECT
// error.
void ForcePlainText();
void MapStreamToHttpConnection(nsISocketTransport* aTransport,
// True if we successfully map stream to a nsHttpConnection. Currently we skip
// 1xx response only.
bool MapStreamToHttpConnection(nsISocketTransport* aTransport,
nsHttpConnectionInfo* aConnInfo,
const nsACString& aFlat407Headers,
int32_t aHttpResponseCode);