Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches

◆ ApplyPlaintextFilterAsync()

async ValueTask< Stream > System.Net.Http.HttpConnectionPool.ApplyPlaintextFilterAsync ( bool async,
Stream stream,
Version httpVersion,
HttpRequestMessage request,
CancellationToken cancellationToken )
inlineprivate

Definition at line 1189 of file HttpConnectionPool.cs.

1190 {
1191 if (Settings._plaintextStreamFilter == null)
1192 {
1193 return stream;
1194 }
1196 try
1197 {
1198 ValueTask<Stream> valueTask = Settings._plaintextStreamFilter(new SocketsHttpPlaintextStreamFilterContext(stream, httpVersion, request), cancellationToken);
1199 if (!async && !valueTask.IsCompleted)
1200 {
1201 Trace("PlaintextStreamFilter completing asynchronously for a synchronous request.", "ApplyPlaintextFilterAsync");
1202 }
1204 }
1205 catch (OperationCanceledException ex) when (ex.CancellationToken == cancellationToken)
1206 {
1207 stream.Dispose();
1208 throw;
1209 }
1210 catch (Exception inner)
1211 {
1212 stream.Dispose();
1213 throw new HttpRequestException(System.SR.net_http_exception_during_plaintext_filter, inner);
1214 }
1215 if (stream2 == null)
1216 {
1217 stream.Dispose();
1218 throw new HttpRequestException(System.SR.net_http_null_from_plaintext_filter);
1219 }
1220 return stream2;
1221 }
void Trace(string message, [CallerMemberName] string memberName=null)
Func< SocketsHttpPlaintextStreamFilterContext, CancellationToken, ValueTask< Stream > > _plaintextStreamFilter
static string net_http_exception_during_plaintext_filter
Definition SR.cs:204
static string net_http_null_from_plaintext_filter
Definition SR.cs:208
Definition SR.cs:7

References System.Net.Http.HttpConnectionSettings._plaintextStreamFilter, System.cancellationToken, System.SR.net_http_exception_during_plaintext_filter, System.SR.net_http_null_from_plaintext_filter, System.Net.Http.HttpConnectionPool.Settings, System.stream, and System.Net.Http.HttpConnectionPool.Trace().

Referenced by System.Net.Http.HttpConnectionPool.ConstructHttp11ConnectionAsync(), and System.Net.Http.HttpConnectionPool.ConstructHttp2ConnectionAsync().