Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions src/libraries/System.Net.Http/src/Resources/Strings.resx
Original file line number Diff line number Diff line change
Expand Up @@ -417,6 +417,9 @@
<data name="net_http_http2_connection_not_established" xml:space="preserve">
<value>An HTTP/2 connection could not be established because the server did not complete the HTTP/2 handshake.</value>
</data>
<data name="net_http_http2_keepalive_ping_timeout" xml:space="preserve">
<value>The HTTP/2 connection keepalive ping did not respond within timeout {0}ms.</value>
</data>
<data name="net_http_http2_invalidinitialstreamwindowsize" xml:space="preserve">
<value>The initial HTTP/2 stream window size must be between {0} and {1}.</value>
</data>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2136,7 +2136,7 @@ private void VerifyKeepAlive()
break;
case KeepAliveState.PingSent:
if (now > _keepAlivePingTimeoutTimestamp)
ThrowProtocolError();
ThrowKeepAlivePingTimeoutError(_keepAlivePingTimeout);
break;
default:
Debug.Fail($"Unexpected keep alive state ({_keepAliveState})");
Expand Down Expand Up @@ -2175,5 +2175,9 @@ private static void ThrowProtocolError() =>
[DoesNotReturn]
private static void ThrowProtocolError(Http2ProtocolErrorCode errorCode, string? message = null) =>
throw HttpProtocolException.CreateHttp2ConnectionException(errorCode, message);

[DoesNotReturn]
private static void ThrowKeepAlivePingTimeoutError(long keepAlivePingTimeout) =>
ThrowProtocolError(Http2ProtocolErrorCode.ProtocolError, SR.Format(SR.net_http_http2_keepalive_ping_timeout, keepAlivePingTimeout));
}
}