Skip to content

Commit

Permalink
Content length is required for signature building
Browse files Browse the repository at this point in the history
  • Loading branch information
karolz-ms authored Dec 10, 2018
1 parent 638ebbd commit 7a28056
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/Microsoft.Diagnostics.EventFlow.Outputs.Oms/OmsOutput.cs
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ public async Task SendEventsAsync(IReadOnlyCollection<EventData> events, long tr

string dateString = DateTime.UtcNow.ToString("r");
HttpContent content = new StringContent(jsonData, Encoding.UTF8, JsonContentId);
string signature = this.BuildSignature(content.Headers.ContentLength, dateString);
string signature = this.BuildSignature(content.Headers.ContentLength.Value, dateString);

content.Headers.ContentType = new MediaTypeHeaderValue(JsonContentId);
HttpRequestMessage request = new HttpRequestMessage(HttpMethod.Post, OmsDataUploadUrl);
Expand Down Expand Up @@ -153,7 +153,7 @@ public async Task SendEventsAsync(IReadOnlyCollection<EventData> events, long tr
}
}

private string BuildSignature(long? contentLength, string dateString)
private string BuildSignature(long contentLength, string dateString)
{
string dateHeader = $"{MsDateHeaderName}:{dateString}";
string signatureInput = $"POST\n{contentLength}\n{JsonContentId}\n{dateHeader}\n{OmsDataUploadResource}";
Expand Down

0 comments on commit 7a28056

Please sign in to comment.