Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Revert "Content Validation STG 97" #47164

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
<Compile Remove="$(AzureStorageSharedTestSources)\StorageTestBase.SasVersion.cs" />
<Compile Remove="$(AzureStorageSharedTestSources)\Sas\*.cs" />
<Compile Remove="$(AzureStorageSharedTestSources)\RepeatingStream.cs" />
<Compile Remove="$(AzureStorageSharedTestSources)\ObserveStructuredMessagePolicy.cs" />
<Compile Remove="$(AzureStorageSharedTestSources)\TransferValidationTestBase.cs" />
<None Include="$(AzureStorageSharedTestSources)\*.xml">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
<Compile Remove="$(AzureStorageSharedTestSources)\AzuriteNUnitFixture.cs" />
<Compile Remove="$(AzureStorageSharedTestSources)\TransferValidationTestBase.cs" />
<Compile Remove="$(AzureStorageSharedTestSources)\ClientSideEncryptionTestExtensions.cs" />
<Compile Remove="$(AzureStorageSharedTestSources)\ObserveStructuredMessagePolicy.cs" />
<None Include="$(AzureStorageSharedTestSources)\*.xml">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
Expand All @@ -43,4 +42,4 @@
<Compile Include="$(AzureStorageSharedSources)UriQueryParamsCollection.cs" LinkBase="Shared" />
<Compile Include="$(AzureStorageSharedSources)Argument.cs" LinkBase="Shared" />
</ItemGroup>
</Project>
</Project>
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<Project Sdk="Microsoft.NET.Sdk">
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>$(RequiredTargetFrameworks)</TargetFrameworks>
<AssemblyTitle>Microsoft Azure.Storage.Blobs.ChangeFeed client library samples</AssemblyTitle>
Expand All @@ -14,7 +14,6 @@
<Compile Remove="$(AzureStorageSharedTestSources)\AzuriteNUnitFixture.cs" />
<Compile Remove="$(AzureStorageSharedTestSources)\RepeatingStream.cs" />
<Compile Remove="$(AzureStorageSharedTestSources)\StorageTestBase.SasVersion.cs" />
<Compile Remove="$(AzureStorageSharedTestSources)\ObserveStructuredMessagePolicy.cs" />
<Compile Remove="$(AzureStorageSharedTestSources)\TransferValidationTestBase.cs" />
<Compile Remove="$(AzureStorageSharedTestSources)\ClientSideEncryptionTestExtensions.cs" />
<Compile Remove="$(AzureStorageSharedTestSources)\Sas\*.cs" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
<Compile Remove="$(AzureStorageSharedTestSources)\TransferValidationTestBase.cs" />
<Compile Remove="$(AzureStorageSharedTestSources)\ClientSideEncryptionTestExtensions.cs" />
<Compile Remove="$(AzureStorageSharedTestSources)\RepeatingStream.cs" />
<Compile Remove="$(AzureStorageSharedTestSources)\ObserveStructuredMessagePolicy.cs" />
<Compile Remove="$(AzureStorageSharedTestSources)\StorageTestBase.SasVersion.cs" />
<Compile Remove="$(AzureStorageSharedTestSources)\Sas\*.cs" />
<None Include="$(AzureStorageSharedTestSources)\*.xml">
Expand All @@ -29,4 +28,4 @@
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
</ItemGroup>
</Project>
</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -523,7 +523,6 @@ public BlobDownloadDetails() { }
public long BlobSequenceNumber { get { throw null; } }
public Azure.Storage.Blobs.Models.BlobType BlobType { get { throw null; } }
public string CacheControl { get { throw null; } }
public byte[] ContentCrc { get { throw null; } }
public string ContentDisposition { get { throw null; } }
public string ContentEncoding { get { throw null; } }
public byte[] ContentHash { get { throw null; } }
Expand Down Expand Up @@ -569,7 +568,6 @@ internal BlobDownloadInfo() { }
[System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)]
public string ContentType { get { throw null; } }
public Azure.Storage.Blobs.Models.BlobDownloadDetails Details { get { throw null; } }
public bool ExpectTrailingDetails { get { throw null; } }
public void Dispose() { }
}
public partial class BlobDownloadOptions
Expand All @@ -591,7 +589,6 @@ public partial class BlobDownloadStreamingResult : System.IDisposable
internal BlobDownloadStreamingResult() { }
public System.IO.Stream Content { get { throw null; } }
public Azure.Storage.Blobs.Models.BlobDownloadDetails Details { get { throw null; } }
public bool ExpectTrailingDetails { get { throw null; } }
public void Dispose() { }
}
public partial class BlobDownloadToOptions
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -523,7 +523,6 @@ public BlobDownloadDetails() { }
public long BlobSequenceNumber { get { throw null; } }
public Azure.Storage.Blobs.Models.BlobType BlobType { get { throw null; } }
public string CacheControl { get { throw null; } }
public byte[] ContentCrc { get { throw null; } }
public string ContentDisposition { get { throw null; } }
public string ContentEncoding { get { throw null; } }
public byte[] ContentHash { get { throw null; } }
Expand Down Expand Up @@ -569,7 +568,6 @@ internal BlobDownloadInfo() { }
[System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)]
public string ContentType { get { throw null; } }
public Azure.Storage.Blobs.Models.BlobDownloadDetails Details { get { throw null; } }
public bool ExpectTrailingDetails { get { throw null; } }
public void Dispose() { }
}
public partial class BlobDownloadOptions
Expand All @@ -591,7 +589,6 @@ public partial class BlobDownloadStreamingResult : System.IDisposable
internal BlobDownloadStreamingResult() { }
public System.IO.Stream Content { get { throw null; } }
public Azure.Storage.Blobs.Models.BlobDownloadDetails Details { get { throw null; } }
public bool ExpectTrailingDetails { get { throw null; } }
public void Dispose() { }
}
public partial class BlobDownloadToOptions
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -523,7 +523,6 @@ public BlobDownloadDetails() { }
public long BlobSequenceNumber { get { throw null; } }
public Azure.Storage.Blobs.Models.BlobType BlobType { get { throw null; } }
public string CacheControl { get { throw null; } }
public byte[] ContentCrc { get { throw null; } }
public string ContentDisposition { get { throw null; } }
public string ContentEncoding { get { throw null; } }
public byte[] ContentHash { get { throw null; } }
Expand Down Expand Up @@ -569,7 +568,6 @@ internal BlobDownloadInfo() { }
[System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)]
public string ContentType { get { throw null; } }
public Azure.Storage.Blobs.Models.BlobDownloadDetails Details { get { throw null; } }
public bool ExpectTrailingDetails { get { throw null; } }
public void Dispose() { }
}
public partial class BlobDownloadOptions
Expand All @@ -591,7 +589,6 @@ public partial class BlobDownloadStreamingResult : System.IDisposable
internal BlobDownloadStreamingResult() { }
public System.IO.Stream Content { get { throw null; } }
public Azure.Storage.Blobs.Models.BlobDownloadDetails Details { get { throw null; } }
public bool ExpectTrailingDetails { get { throw null; } }
public void Dispose() { }
}
public partial class BlobDownloadToOptions
Expand Down
2 changes: 1 addition & 1 deletion sdk/storage/Azure.Storage.Blobs/assets.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@
"AssetsRepo": "Azure/azure-sdk-assets",
"AssetsRepoPrefixPath": "net",
"TagPrefix": "net/storage/Azure.Storage.Blobs",
"Tag": "net/storage/Azure.Storage.Blobs_c5174c4663"
"Tag": "net/storage/Azure.Storage.Blobs_5c382dfb14"
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
<Compile Remove="$(AzureStorageSharedTestSources)\ClientSideEncryptionTestExtensions.cs" />
<Compile Remove="$(AzureStorageSharedTestSources)\RepeatingStream.cs" />
<Compile Remove="$(AzureStorageSharedTestSources)\StorageTestBase.SasVersion.cs" />
<Compile Remove="$(AzureStorageSharedTestSources)\ObserveStructuredMessagePolicy.cs" />
<Compile Remove="$(AzureStorageSharedTestSources)\Sas\*.cs" />
<Compile Remove="$(AzureStorageSharedTestSources)\TransferValidationTestBase.cs" />
<None Include="$(AzureStorageSharedTestSources)\*.xml">
Expand Down
45 changes: 8 additions & 37 deletions sdk/storage/Azure.Storage.Blobs/src/AppendBlobClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1242,39 +1242,14 @@ internal async Task<Response<BlobAppendInfo>> AppendBlockInternal(
BlobErrors.VerifyHttpsCustomerProvidedKey(Uri, ClientConfiguration.CustomerProvidedKey);
Errors.VerifyStreamPosition(content, nameof(content));

ContentHasher.GetHashResult hashResult = null;
long contentLength = (content?.Length - content?.Position) ?? 0;
long? structuredContentLength = default;
string structuredBodyType = null;
if (validationOptions != null &&
validationOptions.ChecksumAlgorithm.ResolveAuto() == StorageChecksumAlgorithm.StorageCrc64 &&
ClientSideEncryption == null) // don't allow feature combination
{
// report progress in terms of caller bytes, not encoded bytes
structuredContentLength = contentLength;
contentLength = (content?.Length - content?.Position) ?? 0;
structuredBodyType = Constants.StructuredMessage.CrcStructuredMessage;
content = content.WithNoDispose().WithProgress(progressHandler);
content = validationOptions.PrecalculatedChecksum.IsEmpty
? new StructuredMessageEncodingStream(
content,
Constants.StructuredMessage.DefaultSegmentContentLength,
StructuredMessage.Flags.StorageCrc64)
: new StructuredMessagePrecalculatedCrcWrapperStream(
content,
validationOptions.PrecalculatedChecksum.Span);
contentLength = (content?.Length - content?.Position) ?? 0;
}
else
{
// compute hash BEFORE attaching progress handler
hashResult = await ContentHasher.GetHashOrDefaultInternal(
content,
validationOptions,
async,
cancellationToken).ConfigureAwait(false);
content = content.WithNoDispose().WithProgress(progressHandler);
}
// compute hash BEFORE attaching progress handler
ContentHasher.GetHashResult hashResult = await ContentHasher.GetHashOrDefaultInternal(
content,
validationOptions,
async,
cancellationToken).ConfigureAwait(false);

content = content.WithNoDispose().WithProgress(progressHandler);

ResponseWithHeaders<AppendBlobAppendBlockHeaders> response;

Expand All @@ -1292,8 +1267,6 @@ internal async Task<Response<BlobAppendInfo>> AppendBlockInternal(
encryptionKeySha256: ClientConfiguration.CustomerProvidedKey?.EncryptionKeyHash,
encryptionAlgorithm: ClientConfiguration.CustomerProvidedKey?.EncryptionAlgorithm == null ? null : EncryptionAlgorithmTypeInternal.AES256,
encryptionScope: ClientConfiguration.EncryptionScope,
structuredBodyType: structuredBodyType,
structuredContentLength: structuredContentLength,
ifModifiedSince: conditions?.IfModifiedSince,
ifUnmodifiedSince: conditions?.IfUnmodifiedSince,
ifMatch: conditions?.IfMatch?.ToString(),
Expand All @@ -1316,8 +1289,6 @@ internal async Task<Response<BlobAppendInfo>> AppendBlockInternal(
encryptionKeySha256: ClientConfiguration.CustomerProvidedKey?.EncryptionKeyHash,
encryptionAlgorithm: ClientConfiguration.CustomerProvidedKey?.EncryptionAlgorithm == null ? null : EncryptionAlgorithmTypeInternal.AES256,
encryptionScope: ClientConfiguration.EncryptionScope,
structuredBodyType: structuredBodyType,
structuredContentLength: structuredContentLength,
ifModifiedSince: conditions?.IfModifiedSince,
ifUnmodifiedSince: conditions?.IfUnmodifiedSince,
ifMatch: conditions?.IfMatch?.ToString(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,6 @@
<Compile Include="$(AzureStorageSharedSources)BufferExtensions.cs" LinkBase="Shared" />
<Compile Include="$(AzureStorageSharedSources)ChecksumCalculatingStream.cs" LinkBase="Shared" />
<Compile Include="$(AzureStorageSharedSources)ContentRange.cs" LinkBase="Shared" />
<Compile Include="$(AzureStorageSharedSources)ContentRangeExtensions.cs" LinkBase="Shared" />
<Compile Include="$(AzureStorageSharedSources)ChecksumExtensions.cs" LinkBase="Shared" />
<Compile Include="$(AzureStorageSharedSources)Constants.cs" LinkBase="Shared" />
<Compile Include="$(AzureStorageSharedSources)CompatSwitches.cs" LinkBase="Shared" />
<Compile Include="$(AzureStorageSharedSources)ContentHasher.cs" LinkBase="Shared" />
Expand Down Expand Up @@ -95,11 +93,6 @@
<Compile Include="$(AzureStorageSharedSources)StorageServerTimeoutPolicy.cs" LinkBase="Shared" />
<Compile Include="$(AzureStorageSharedSources)StorageTelemetryPolicy.cs" LinkBase="Shared" />
<Compile Include="$(AzureStorageSharedSources)StorageVersionExtensions.cs" LinkBase="Shared" />
<Compile Include="$(AzureStorageSharedSources)StructuredMessage.cs" LinkBase="Shared" />
<Compile Include="$(AzureStorageSharedSources)StructuredMessageDecodingRetriableStream.cs" LinkBase="Shared" />
<Compile Include="$(AzureStorageSharedSources)StructuredMessageDecodingStream.cs" LinkBase="Shared" />
<Compile Include="$(AzureStorageSharedSources)StructuredMessageEncodingStream.cs" LinkBase="Shared" />
<Compile Include="$(AzureStorageSharedSources)StructuredMessagePrecalculatedCrcWrapperStream.cs" LinkBase="Shared" />
<Compile Include="$(AzureStorageSharedSources)UriExtensions.cs" LinkBase="Shared" />
<Compile Include="$(AzureStorageSharedSources)UriQueryParamsCollection.cs" LinkBase="Shared" />
<Compile Include="$(AzureStorageSharedSources)UserDelegationKeyProperties.cs" LinkBase="Shared" />
Expand Down
Loading