diff --git a/src/Stars.Data/Terradue.Stars.Data.csproj b/src/Stars.Data/Terradue.Stars.Data.csproj index 9e93f070..05d60445 100644 --- a/src/Stars.Data/Terradue.Stars.Data.csproj +++ b/src/Stars.Data/Terradue.Stars.Data.csproj @@ -51,12 +51,12 @@ all + - + + --> diff --git a/src/Stars.Services/Resources/DefaultResourceServiceProvider.cs b/src/Stars.Services/Resources/DefaultResourceServiceProvider.cs index 281cc849..66936e5b 100644 --- a/src/Stars.Services/Resources/DefaultResourceServiceProvider.cs +++ b/src/Stars.Services/Resources/DefaultResourceServiceProvider.cs @@ -88,9 +88,22 @@ public async Task CreateStreamResourceAsync(IResource resource, try { // First try head request - using (var headResponse = await client.SendAsync(new HttpRequestMessage(HttpMethod.Head, resource.Uri), ct)) + using (var hr = await client.SendAsync(new HttpRequestMessage(HttpMethod.Head, resource.Uri), ct)) { + HttpResponseMessage headResponse = hr; contentHeaders = new HttpCachedHeaders(headResponse); + // Handle response error, but retry with a one-byte range in case of "Method not allowed" status code + /*if (headResponse.StatusCode == System.Net.HttpStatusCode.MethodNotAllowed) + { + //"Range: bytes=0-0 + HttpRequestMessage message = new HttpRequestMessage(HttpMethod.Get, resource.Uri); + message.Headers.Range = new System.Net.Http.Headers.RangeHeaderValue(0, 0); + using (var hr2 = await client.SendAsync(message, ct)) + { + contentHeaders = new HttpCachedHeaders(headResponse); + headResponse = hr2; + } + }*/ headResponse.EnsureSuccessStatusCode(); } } diff --git a/src/Stars.Services/Supplier/Carrier/CarrierManager.cs b/src/Stars.Services/Supplier/Carrier/CarrierManager.cs index 619a3afe..a6c47943 100644 --- a/src/Stars.Services/Supplier/Carrier/CarrierManager.cs +++ b/src/Stars.Services/Supplier/Carrier/CarrierManager.cs @@ -91,7 +91,7 @@ public async Task GetAssetsDeliveryQuotationsAsync(IAssetsCo } catch (Exception e) { - logger.LogWarning("Cannot quote delivery for asset {0} with url {2} : {1}", asset.Key, e.Message, possibleAsset.Uri); + logger.LogWarning("Cannot quote delivery for asset {0} with url {1} : {2}", asset.Key, possibleAsset.Uri, e.Message); logger.LogDebug(e.StackTrace); assetsExceptions.Add(asset.Key, e); }