Bug 1528317 - Return NS_ERROR_NET_HTTP2_SENT_GOAWAY only when we have a protocol error. r=valentin
authorDragana Damjanovic <dd.mozilla@gmail.com>
Thu, 07 Mar 2019 21:03:27 +0000
changeset 520949 3e844ef9583bd261dfd8ddcab6c9e04cc1bc56ca
parent 520948 c4d22c2dae9c1e9578d7ffe08ad10f137d10bb18
child 520950 33f3f22ba0a7d374dcdb616b28eafa33ac81f5af
push id10862
push userffxbld-merge
push dateMon, 11 Mar 2019 13:01:11 +0000
treeherdermozilla-beta@a2e7f5c935da [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersvalentin
bugs1528317, 1050329
milestone67.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1528317 - Return NS_ERROR_NET_HTTP2_SENT_GOAWAY only when we have a protocol error. r=valentin In bug 1050329 we have introduced a new error and an error page to show that there is a h2 protocol error. The problem is that we show that error when we close a h2 connection for any reason, like a network timeout. Also Http2Session::SessionError does not return NS_ERROR_ILLEGAL_VALUE error but NS_ERROR_NET_HTTP2_SENT_GOAWAY. Differential Revision: https://phabricator.services.mozilla.com/D22525
netwerk/protocol/http/Http2Session.cpp
--- a/netwerk/protocol/http/Http2Session.cpp
+++ b/netwerk/protocol/http/Http2Session.cpp
@@ -163,17 +163,17 @@ void Http2Session::Shutdown() {
     // restarted.
     if (mCleanShutdown &&
         (stream->StreamID() > mGoAwayID || !stream->HasRegisteredID())) {
       CloseStream(stream, NS_ERROR_NET_RESET);  // can be restarted
     } else if (stream->RecvdData()) {
       CloseStream(stream, NS_ERROR_NET_PARTIAL_TRANSFER);
     } else if (mGoAwayReason == INADEQUATE_SECURITY) {
       CloseStream(stream, NS_ERROR_NET_INADEQUATE_SECURITY);
-    } else if (!mCleanShutdown) {
+    } else if (!mCleanShutdown && (mGoAwayReason != NO_HTTP_ERROR)) {
       CloseStream(stream, NS_ERROR_NET_HTTP2_SENT_GOAWAY);
     } else {
       CloseStream(stream, NS_ERROR_ABORT);
     }
   }
 }
 
 Http2Session::~Http2Session() {
@@ -3866,17 +3866,17 @@ void Http2Session::Close(nsresult aReaso
     mWaitingWebsocketCallbacks.Clear();
   }
 
   uint32_t goAwayReason;
   if (mGoAwayReason != NO_HTTP_ERROR) {
     goAwayReason = mGoAwayReason;
   } else if (NS_SUCCEEDED(aReason)) {
     goAwayReason = NO_HTTP_ERROR;
-  } else if (aReason == NS_ERROR_ILLEGAL_VALUE) {
+  } else if (aReason == NS_ERROR_NET_HTTP2_SENT_GOAWAY) {
     goAwayReason = PROTOCOL_ERROR;
   } else if (mCleanShutdown) {
     goAwayReason = NO_HTTP_ERROR;
   } else {
     goAwayReason = INTERNAL_ERROR;
   }
   if (!mAttemptingEarlyData) {
     GenerateGoAway(goAwayReason);