Merge branch 'merge/release/2.2-to-master' of github.com:dotnet-maestro-bot/AspNetCore into merge/release/2.2-to-master

This commit is contained in:
Ryan Brandenburg 2019-03-06 11:36:41 -08:00
commit 7573597577
4 changed files with 3927 additions and 2673 deletions

View File

@ -48,11 +48,21 @@ namespace Microsoft.AspNetCore.Identity.Test
private async Task<string> GetShaIntegrity(ScriptTag scriptTag)
{
var prefix = scriptTag.Integrity.Substring(0, 6);
var isSha256 = scriptTag.Integrity.StartsWith("sha256");
var prefix = isSha256 ? "sha256" : "sha384";
using (var respStream = await _httpClient.GetStreamAsync(scriptTag.Src))
using (HashAlgorithm alg = string.Equals(prefix, "sha256") ? (HashAlgorithm)SHA256.Create() : (HashAlgorithm)SHA384.Create())
using (var alg256 = SHA256.Create())
using (var alg384 = SHA384.Create())
{
var hash = alg.ComputeHash(respStream);
byte[] hash;
if(isSha256)
{
hash = alg256.ComputeHash(respStream);
}
else
{
hash = alg384.ComputeHash(respStream);
}
return $"{prefix}-" + Convert.ToBase64String(hash);
}
}

View File

@ -4,8 +4,10 @@
import { Buffer } from "buffer";
import * as msgpack5 from "msgpack5";
import { CancelInvocationMessage, CompletionMessage, HubMessage, IHubProtocol, ILogger, InvocationMessage,
LogLevel, MessageHeaders, MessageType, NullLogger, StreamInvocationMessage, StreamItemMessage, TransferFormat } from "@aspnet/signalr";
import {
CancelInvocationMessage, CompletionMessage, HubMessage, IHubProtocol, ILogger, InvocationMessage,
LogLevel, MessageHeaders, MessageType, NullLogger, StreamInvocationMessage, StreamItemMessage, TransferFormat,
} from "@aspnet/signalr";
import { BinaryMessageFormat } from "./BinaryMessageFormat";
import { isArrayBuffer } from "./Utils";

View File

@ -76,8 +76,8 @@ export function formatArrayBuffer(data: ArrayBuffer): string {
export function isArrayBuffer(val: any): val is ArrayBuffer {
return val && typeof ArrayBuffer !== "undefined" &&
(val instanceof ArrayBuffer ||
// Sometimes we get an ArrayBuffer that doesn't satisfy instanceof
(val.constructor && val.constructor.name === "ArrayBuffer"));
// Sometimes we get an ArrayBuffer that doesn't satisfy instanceof
(val.constructor && val.constructor.name === "ArrayBuffer"));
}
/** @private */