net: restart on NPN misprediction and add tests for Snap Start errors.
Restart an HTTP load when we mispredict the NPN protocol in a Snap Start connection.
Also, test the behaviour of the HTTP layer when SSL errors result
from the first Write() call. When we are doing Snap Start, we need to
merge the first application data record into the ClientHello. Thus the
SSL socket will report that it has connected immedately in order to get
a Write() call. This means that some errors, which would typically
result from the Connect(), are now returned on the first Write().
BUG=none
TEST=net_unittests
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@65837 0039d316-1c4b-4281-b951-d872f2087c98
diff --git a/net/http/http_network_transaction.cc b/net/http/http_network_transaction.cc
index 7cbbc9bf..c6717513 100644
--- a/net/http/http_network_transaction.cc
+++ b/net/http/http_network_transaction.cc
@@ -1014,6 +1014,16 @@
error = OK;
}
break;
+ case ERR_SSL_SNAP_START_NPN_MISPREDICTION:
+ // This means that we tried to Snap Start a connection, but we
+ // mispredicted the NPN result. This isn't a problem from the point of
+ // view of the SSL layer because the server will ignore the application
+ // data in the Snap Start extension. However, at the HTTP layer, we have
+ // already decided that it's a HTTP or SPDY connection and it's easier to
+ // abort and start again.
+ ResetConnectionAndRequestForResend();
+ error = OK;
+ break;
}
return error;
}