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

◆ SendAsync() [1/2]

override async ValueTask< HttpResponseMessage > System.Net.Http.DecompressionHandler.SendAsync ( HttpRequestMessage request,
bool async,
CancellationToken cancellationToken )
inlinepackage

Definition at line 381 of file DecompressionHandler.cs.

382 {
383 if (GZipEnabled && !EncodingExists(request.Headers.AcceptEncoding, "gzip"))
384 {
385 request.Headers.AcceptEncoding.Add(s_gzipHeaderValue);
386 }
387 if (DeflateEnabled && !EncodingExists(request.Headers.AcceptEncoding, "deflate"))
388 {
389 request.Headers.AcceptEncoding.Add(s_deflateHeaderValue);
390 }
391 if (BrotliEnabled && !EncodingExists(request.Headers.AcceptEncoding, "br"))
392 {
393 request.Headers.AcceptEncoding.Add(s_brotliHeaderValue);
394 }
396 ICollection<string> contentEncoding = httpResponseMessage.Content.Headers.ContentEncoding;
397 if (contentEncoding.Count > 0)
398 {
399 string text = null;
400 foreach (string item in contentEncoding)
401 {
402 text = item;
403 }
404 if (GZipEnabled && text == "gzip")
405 {
406 httpResponseMessage.Content = new GZipDecompressedContent(httpResponseMessage.Content);
407 }
408 else if (DeflateEnabled && text == "deflate")
409 {
410 httpResponseMessage.Content = new DeflateDecompressedContent(httpResponseMessage.Content);
411 }
412 else if (BrotliEnabled && text == "br")
413 {
414 httpResponseMessage.Content = new BrotliDecompressedContent(httpResponseMessage.Content);
415 }
416 }
417 return httpResponseMessage;
418 }
void Add(TKey key, TValue value)
static readonly StringWithQualityHeaderValue s_gzipHeaderValue
readonly HttpMessageHandlerStage _innerHandler
static readonly StringWithQualityHeaderValue s_brotliHeaderValue
static bool EncodingExists(HttpHeaderValueCollection< StringWithQualityHeaderValue > acceptEncodingHeader, string encoding)
static readonly StringWithQualityHeaderValue s_deflateHeaderValue
override Task< HttpResponseMessage > SendAsync(HttpRequestMessage request, CancellationToken cancellationToken)

References System.Net.Http.DecompressionHandler._innerHandler, System.Collections.Generic.Dictionary< TKey, TValue >.Add(), System.Net.Http.DecompressionHandler.BrotliEnabled, System.cancellationToken, System.Collections.Generic.Dictionary< TKey, TValue >.Count, System.Net.Http.DecompressionHandler.DeflateEnabled, System.Net.Http.DecompressionHandler.EncodingExists(), System.Net.Http.DecompressionHandler.GZipEnabled, System.item, System.Net.Http.DecompressionHandler.s_brotliHeaderValue, System.Net.Http.DecompressionHandler.s_deflateHeaderValue, System.Net.Http.DecompressionHandler.s_gzipHeaderValue, System.Net.Http.HttpMessageHandlerStage.SendAsync(), and System.text.