System\Net\Http\HttpContent.cs (10)
146throw new InvalidOperationException(SR.net_http_content_invalid_charset, e);
225throw new HttpRequestException(SR.net_http_content_read_as_stream_has_task);
296throw new NotSupportedException(SR.Format(SR.net_http_missing_sync_implementation, GetType(), nameof(HttpContent), nameof(SerializeToStream)));
597SR.Format(CultureInfo.InvariantCulture,
598SR.net_http_content_buffersize_limit, HttpContent.MaxBufferSize));
670var e = new InvalidOperationException(SR.net_http_content_no_task_returned);
698return new HttpRequestException(error, SR.net_http_content_stream_copy_error, e);
770return new HttpRequestException(HttpRequestError.ConfigurationLimitExceeded, SR.Format(CultureInfo.InvariantCulture, SR.net_http_content_buffersize_exceeded, maxBufferSize));
System\Net\Http\SocketsHttpHandler\ChunkedEncodingReadStream.cs (10)
76throw new HttpIOException(HttpRequestError.ResponseEnded, SR.Format(SR.net_http_invalid_response_premature_eof_bytecount, _chunkBytesRemaining));
192throw new HttpIOException(HttpRequestError.ResponseEnded, SR.Format(SR.net_http_invalid_response_premature_eof_bytecount, _chunkBytesRemaining));
335throw new HttpIOException(HttpRequestError.InvalidResponse, SR.Format(SR.net_http_invalid_response_chunk_header_invalid, BitConverter.ToString(currentLine.ToArray())));
389throw new HttpIOException(HttpRequestError.InvalidResponse, SR.Format(SR.net_http_invalid_response_chunk_terminator_invalid, Encoding.ASCII.GetString(currentLine)));
452throw new HttpIOException(HttpRequestError.InvalidResponse, SR.Format(SR.net_http_invalid_response_chunk_extension_invalid, BitConverter.ToString(lineAfterChunkSize.ToArray())));
System\Net\Http\SocketsHttpHandler\ConnectionPool\HttpConnectionPool.cs (12)
455HttpRequestException exception = new(HttpRequestError.ExtendedConnectNotSupported, SR.net_unsupported_extended_connect);
522throw new HttpRequestException(HttpRequestError.VersionNegotiationError, SR.Format(SR.net_http_requested_version_server_refused, request.Version, request.VersionPolicy), e);
667stream = await streamTask.ConfigureAwait(false) ?? throw new HttpRequestException(SR.net_http_null_from_connect_callback);
754throw new HttpRequestException(SR.net_http_exception_during_plaintext_filter, e);
760throw new HttpRequestException(SR.net_http_null_from_plaintext_filter);
782throw new HttpRequestException(HttpRequestError.ProxyTunnelError, SR.Format(SR.net_http_proxy_tunnel_returned_failure_status_code, _proxyUri, (int)tunnelResponse.StatusCode), statusCode: tunnelResponse.StatusCode);
809throw new HttpRequestException(HttpRequestError.ProxyTunnelError, SR.net_http_proxy_tunnel_error, e);
845TimeoutException te = new TimeoutException(SR.net_http_connect_timedout, oce.InnerException);
856HttpRequestException ex = new(HttpRequestError.VersionNegotiationError, SR.Format(SR.net_http_requested_version_cannot_establish, request.Version, request.VersionPolicy, desiredVersion), inner);
System\Net\Http\SocketsHttpHandler\Http2Connection.cs (16)
258throw new IOException(SR.net_http_http2_connection_not_established, e);
423ThrowProtocolError(_goAwayErrorCode.Value, SR.net_http_http2_connection_close);
473throw new HttpIOException(HttpRequestError.ResponseEnded, SR.Format(SR.net_http_invalid_response_premature_eof_bytecount, requiredBytes - _incomingBuffer.ActiveLength));
476throw new HttpIOException(HttpRequestError.ResponseEnded, SR.net_http_invalid_response_missing_frame);
493ThrowProtocolError(errorCode, SR.net_http_http2_connection_close);
516InitialSettingsReceived.TrySetException(new HttpIOException(HttpRequestError.InvalidResponse, SR.net_http_http2_connection_not_established, e));
518throw new HttpIOException(HttpRequestError.InvalidResponse, SR.net_http_http2_connection_not_established, e);
1084Exception resetException = HttpProtocolException.CreateHttp2ConnectionException(errorCode, SR.net_http_http2_connection_close);
1583throw new HttpRequestException(SR.Format(SR.net_http_request_headers_exceeded_length, maxHeaderListSize));
1605ThrowRetry(SR.net_http_server_shutdown);
1612ThrowRetry(SR.net_http_request_aborted);
2071throw new HttpRequestException(HttpRequestError.Unknown, SR.net_http_client_execution_error, e);
2150ThrowProtocolError(Http2ProtocolErrorCode.ProtocolError, SR.net_ping_request_timed_out);
2176innerException as HttpIOException ?? new IOException(SR.net_http_request_aborted, innerException);
System\Net\Http\SocketsHttpHandler\Http2Stream.cs (21)
232throw new HttpRequestException(SR.Format(SR.net_http_request_content_length_mismatch, writeStream.BytesWritten, writeStream.ContentLength));
560throw new HttpRequestException(HttpRequestError.InvalidResponse, SR.net_http_invalid_response);
583throw new HttpRequestException(HttpRequestError.InvalidResponse, SR.net_http_invalid_response);
609throw new HttpRequestException(HttpRequestError.ConfigurationLimitExceeded, SR.Format(SR.net_http_response_headers_exceeded_length, _connection._pool.Settings.MaxResponseHeadersByteLength));
631throw new HttpRequestException(HttpRequestError.InvalidResponse, SR.net_http_invalid_response_multiple_status_codes);
638throw new HttpRequestException(HttpRequestError.InvalidResponse, SR.net_http_invalid_response_pseudo_header_in_trailer);
701throw new HttpRequestException(HttpRequestError.InvalidResponse, SR.net_http_invalid_response);
745throw new HttpRequestException(HttpRequestError.InvalidResponse, SR.net_http_invalid_response);
754throw new HttpRequestException(HttpRequestError.InvalidResponse, SR.Format(SR.net_http_invalid_response_header_name, Encoding.ASCII.GetString(name)));
1019ThrowRetry(SR.net_http_request_aborted, resetException);
1340ThrowRetry(SR.net_http_request_aborted, resetException);
1504public override void Write(ReadOnlySpan<byte> buffer) => throw new NotSupportedException(SR.net_http_content_readonly_stream);
1506public override ValueTask WriteAsync(ReadOnlyMemory<byte> destination, CancellationToken cancellationToken) => ValueTask.FromException(new NotSupportedException(SR.net_http_content_readonly_stream));
1523public override int Read(Span<byte> buffer) => throw new NotSupportedException(SR.net_http_content_writeonly_stream);
1525public override ValueTask<int> ReadAsync(Memory<byte> buffer, CancellationToken cancellationToken) => ValueTask.FromException<int>(new NotSupportedException(SR.net_http_content_writeonly_stream));
1527public override void CopyTo(Stream destination, int bufferSize) => throw new NotSupportedException(SR.net_http_content_writeonly_stream);
1529public override Task CopyToAsync(Stream destination, int bufferSize, CancellationToken cancellationToken) => Task.FromException(new NotSupportedException(SR.net_http_content_writeonly_stream));
1537return ValueTask.FromException(new HttpRequestException(SR.net_http_content_write_larger_than_content_length));
System\Net\Http\SocketsHttpHandler\Http3Connection.cs (6)
314throw new HttpRequestException(HttpRequestError.Unknown, SR.net_http_request_aborted, null, RequestRetryType.RetryOnConnectionFailure);
327throw new HttpRequestException(HttpRequestError.Unknown, SR.net_http_request_aborted, null, RequestRetryType.RetryOnConnectionFailure);
345throw new HttpRequestException(HttpRequestError.Unknown, SR.net_http_client_execution_error, _abortException, RequestRetryType.RetryOnConnectionFailure);
506Abort(HttpProtocolException.CreateHttp3ConnectionException(code, SR.net_http_http3_connection_close));
567Abort(HttpProtocolException.CreateHttp3ConnectionException(code, SR.net_http_http3_connection_close));
702Abort(HttpProtocolException.CreateHttp3ConnectionException(code, SR.net_http_http3_connection_close));
System\Net\Http\SocketsHttpHandler\Http3RequestStream.cs (33)
284throw new HttpRequestException(HttpRequestError.Unknown, SR.net_http_retry_on_older_version, ex, RequestRetryType.RetryOnLowerHttpVersion);
289throw new HttpRequestException(HttpRequestError.HttpProtocolError, SR.net_http_request_aborted, rejectedException, RequestRetryType.RetryOnConnectionFailure);
295throw new HttpRequestException(httpRequestError, SR.net_http_client_execution_error, innerException);
304Exception abortException = _connection.Abort(HttpProtocolException.CreateHttp3ConnectionException(code, SR.net_http_http3_connection_close));
305throw new HttpRequestException(HttpRequestError.HttpProtocolError, SR.net_http_client_execution_error, abortException);
320throw new HttpRequestException(httpRequestError, SR.net_http_client_execution_error, _connection.AbortException);
326throw new HttpRequestException(HttpRequestError.Unknown, SR.net_http_http3_connection_quic_error, ex);
340throw new HttpRequestException(HttpRequestError.Unknown, SR.net_http_request_aborted, ex, RequestRetryType.RetryOnConnectionFailure);
346throw new HttpRequestException(ex.HttpRequestError, SR.net_http_client_execution_error, ex);
351throw new HttpRequestException(HttpRequestError.InvalidResponse, SR.net_http_invalid_response, ex);
356throw new HttpRequestException(HttpRequestError.Unknown, SR.net_http_client_execution_error, ex);
368throw new HttpRequestException(HttpRequestError.Unknown, SR.net_http_client_execution_error, ex);
405throw new HttpIOException(HttpRequestError.InvalidResponse, SR.net_http_invalid_response);
468throw new HttpRequestException(SR.Format(SR.net_http_request_content_length_mismatch, sent, contentLength));
513throw new HttpRequestException(SR.net_http_content_write_larger_than_content_length);
589throw new HttpIOException(HttpRequestError.InvalidResponse, SR.net_http_invalid_response);
734throw new HttpRequestException(SR.Format(SR.net_http_request_headers_exceeded_length, maxHeaderListSize));
892throw new HttpIOException(HttpRequestError.ResponseEnded, SR.net_http_invalid_response_premature_eof);
936throw new HttpRequestException(HttpRequestError.ConfigurationLimitExceeded, SR.Format(SR.net_http_response_headers_exceeded_length, _connection.Pool.Settings.MaxResponseHeadersByteLength));
955throw new HttpIOException(HttpRequestError.ResponseEnded, SR.net_http_invalid_response_premature_eof);
977throw new HttpRequestException(HttpRequestError.InvalidResponse, SR.Format(SR.net_http_invalid_response_header_name, Encoding.ASCII.GetString(name)));
1215throw new HttpIOException(HttpRequestError.ResponseEnded, SR.Format(SR.net_http_invalid_response_premature_eof_bytecount, _responseDataPayloadRemaining));
1287throw new HttpIOException(HttpRequestError.ResponseEnded, SR.Format(SR.net_http_invalid_response_premature_eof_bytecount, _responseDataPayloadRemaining));
1327HttpProtocolException exception = HttpProtocolException.CreateHttp3ConnectionException((Http3ErrorCode)e.ApplicationErrorCode.Value, SR.net_http_http3_connection_close);
1336throw new HttpRequestException(httpRequestError, SR.net_http_client_execution_error, _connection.AbortException);
1355throw new HttpIOException(HttpRequestError.Unknown, SR.net_http_client_execution_error, new HttpRequestException(SR.net_http_client_execution_error, ex));
System\Net\Http\SocketsHttpHandler\HttpConnection.cs (27)
322throw new HttpRequestException(SR.net_http_request_no_host);
529throw new HttpRequestException(SR.net_http_request_invalid_char_encoding);
660throw new HttpIOException(HttpRequestError.ResponseEnded, SR.net_http_invalid_response_premature_eof);
926mappedException = new HttpRequestException(SR.net_http_client_execution_error, exception);
935mappedException = new HttpRequestException(error, SR.net_http_client_execution_error, ioe, _canRetry ? RequestRetryType.RetryOnConnectionFailure : RequestRetryType.NoRetry);
1067throw new HttpRequestException(HttpRequestError.InvalidResponse, SR.Format(SR.net_http_invalid_response_status_line, Encoding.ASCII.GetString(line)));
1088throw new HttpRequestException(HttpRequestError.InvalidResponse, SR.Format(SR.net_http_invalid_response_status_line, Encoding.ASCII.GetString(line)));
1096throw new HttpRequestException(HttpRequestError.InvalidResponse, SR.Format(SR.net_http_invalid_response_status_code, Encoding.ASCII.GetString(line.Slice(9, 3))));
1121throw new HttpRequestException(HttpRequestError.InvalidResponse, SR.Format(SR.net_http_invalid_response_status_reason, Encoding.ASCII.GetString(reasonBytes.ToArray())), formatEx);
1127throw new HttpRequestException(HttpRequestError.InvalidResponse, SR.Format(SR.net_http_invalid_response_status_line, Encoding.ASCII.GetString(line)));
1226throw new HttpRequestException(HttpRequestError.InvalidResponse, SR.Format(SR.net_http_invalid_response_header_line, Encoding.ASCII.GetString(buffer.Slice(0, newLineIndex))));
1325throw new HttpRequestException(HttpRequestError.InvalidResponse, SR.Format(SR.net_http_invalid_response_header_name, ""));
1328throw new HttpRequestException(HttpRequestError.InvalidResponse, SR.Format(SR.net_http_invalid_response_header_name, Encoding.ASCII.GetString(name)));
1332throw new HttpRequestException(HttpRequestError.ConfigurationLimitExceeded, SR.Format(SR.net_http_response_headers_exceeded_length, _pool.Settings.MaxResponseHeadersByteLength));
1620throw new HttpRequestException(SR.net_http_chunk_too_large);
1655throw new HttpIOException(HttpRequestError.ResponseEnded, SR.net_http_invalid_response_premature_eof);
2080throw new HttpRequestException(HttpRequestError.UserAuthenticationError, SR.net_http_authconnectionfailure);
2096throw new HttpRequestException(HttpRequestError.UserAuthenticationError, SR.net_http_authconnectionfailure);
System\Net\Http\SocketsHttpHandler\SocketsHttpHandler.cs (18)
35throw new InvalidOperationException(SR.net_http_operation_started);
288string message = SR.Format(
289SR.net_http_http2_invalidinitialstreamwindowsize,
317throw new ArgumentOutOfRangeException(nameof(value), value, SR.Format(SR.net_http_value_must_be_greater_than_or_equal, value, TimeSpan.FromSeconds(1)));
342throw new ArgumentOutOfRangeException(nameof(value), value, SR.Format(SR.net_http_value_must_be_greater_than_or_equal, value, TimeSpan.FromSeconds(1)));
577throw new NotSupportedException(SR.Format(SR.net_http_http2_sync_not_supported, GetType()));
583throw new NotSupportedException(SR.Format(SR.net_http_upgrade_not_enabled_sync, nameof(Send), request.VersionPolicy));
637return new NotSupportedException(SR.net_http_unsupported_version);
645return new HttpRequestException(SR.net_http_client_execution_error,
646new InvalidOperationException(SR.net_http_chunked_not_allowed_with_empty_content));
664return new NotSupportedException(SR.net_http_unsupported_chunking);
677return new InvalidOperationException(SR.net_http_client_invalid_requesturi);
682return new NotSupportedException(SR.Format(SR.net_http_unsupported_requesturi_scheme, requestUri.Scheme));