public async Task <object> HandleResponseAsync(HttpResponseMessage response) { if (!response.IsSuccessStatusCode) { throw new HttpResponseException(response); } blobSizeListener(response.Content.Headers.ContentLength ?? 0); using (Stream outputStream = new NotifyingOutputStream(destinationOutputStream, writtenByteCountListener, true)) { BlobDescriptor receivedBlobDescriptor; using (Stream contentStream = await response.Content.ReadAsStreamAsync().ConfigureAwait(false)) { receivedBlobDescriptor = await Digests.ComputeDigestAsync(contentStream, outputStream).ConfigureAwait(false); } if (!blobDigest.Equals(receivedBlobDescriptor.GetDigest())) { throw new UnexpectedBlobDigestException( "The pulled BLOB has digest '" + receivedBlobDescriptor.GetDigest() + "', but the request digest was '" + blobDigest + "'"); } } return(null); }
public override bool Equals(object other) { if (this == other) { return(true); } if (!(other is FibContainer otherContainer)) { return(false); } return(imageDigest.Equals(otherContainer.imageDigest) && imageId.Equals(otherContainer.imageId)); }
public override bool Equals(object other) { if (this == other) { return(true); } if (!(other is BuildResult otherBuildResult)) { return(false); } return(imageDigest.Equals(otherBuildResult.imageDigest) && imageId.Equals(otherBuildResult.imageId)); }
/** * Two {@link BlobDescriptor} objects are equal if their * * <ol> * <li>{@code digest}s are not null and equal, and * <li>{@code size}s are non-negative and equal * </ol> */ public override bool Equals(object obj) { if (obj == this) { return(true); } if (size < 0 || !(obj is BlobDescriptor other)) { return(false); } return(size == other.GetSize() && digest.Equals(other.GetDigest())); }