<PackageReference Include="Azure.Storage.Blobs" Version="12.25.1" />

StorageServerTimeoutPolicy

using Azure.Core; using Azure.Core.Pipeline; using System; using System.Globalization; using System.Runtime.CompilerServices; namespace Azure.Storage { internal class StorageServerTimeoutPolicy : HttpPipelineSynchronousPolicy { private const string QueryParameterKeyWithEqualSign = "timeout="; public static StorageServerTimeoutPolicy Shared { get; } = new StorageServerTimeoutPolicy(); private StorageServerTimeoutPolicy() { } public override void OnSendingRequest(HttpMessage message) { if (message.TryGetProperty("Azure.Storage.StorageServerTimeoutPolicy.Timeout", out object value)) { if (!(value is TimeSpan)) { DefaultInterpolatedStringHandler defaultInterpolatedStringHandler = new DefaultInterpolatedStringHandler(50, 2); defaultInterpolatedStringHandler.AppendFormatted("Azure.Storage.StorageServerTimeoutPolicy.Timeout"); defaultInterpolatedStringHandler.AppendLiteral(" http message property must be a TimeSpan but was "); defaultInterpolatedStringHandler.AppendFormatted(value?.GetType()); throw new ArgumentException(defaultInterpolatedStringHandler.ToStringAndClear()); } TimeSpan timeSpan = (TimeSpan)value; string query = message.Request.Uri.Query; int num = Convert.ToInt32(timeSpan.TotalSeconds); if (string.IsNullOrEmpty(query)) { RequestUriBuilder uri = message.Request.Uri; uri.Query += string.Format(CultureInfo.InvariantCulture, "?{0}{1}", "timeout=", num); } else if (!query.Contains("timeout=")) { RequestUriBuilder uri2 = message.Request.Uri; uri2.Query += string.Format(CultureInfo.InvariantCulture, "&{0}{1}", "timeout=", num); } } } } }