Skip to content

Commit

Permalink
servercomparer update
Browse files Browse the repository at this point in the history
adds user agent
  • Loading branch information
wforums committed Oct 12, 2015
1 parent cf498f8 commit f616a54
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions CCExtractorTester/Comparers/ServerComparer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ public class ServerComparer : IFileComparable
/// </summary>
private string reportUrl;

private static string userAgent = "CCExctractor Automated Test Suite";

/// <summary>
/// Generates an new instance of this class.
/// </summary>
Expand All @@ -30,12 +32,15 @@ public ServerComparer(string reportUrl)
/// <param name="data">The data for this entry.</param>
public void CompareAndAddToResult(CompareData data)
{
string hash = Hasher.getFileHash(data.ProducedFile);

// Check for equality by hash
if (!Hasher.filesAreEqual(data.CorrectFile, data.ProducedFile))
{
// Upload result
using (var wb = new WebClient())
{
wb.Headers.Add("user-agent", userAgent);
// TODO: check if this works
var response = wb.UploadFile(reportUrl, data.ProducedFile);
}
Expand All @@ -45,6 +50,7 @@ public void CompareAndAddToResult(CompareData data)
// Post equality status
using (var wb = new WebClient())
{
wb.Headers.Add("user-agent", userAgent);
var d = new NameValueCollection();
d["equal"] = data.ProducedFile;
d["sample"] = data.SampleFile;
Expand Down

0 comments on commit f616a54

Please sign in to comment.