Skip to content
This repository was archived by the owner on Jun 14, 2020. It is now read-only.
Open
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
12 changes: 6 additions & 6 deletions src/SocksSharp/Extensions/HttpHeadersExtensions.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using System;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net.Http.Headers;
Expand All @@ -9,11 +9,9 @@ namespace SocksSharp.Extensions
{
internal static class HttpHeadersExtensions
{
private static readonly string separator = " ";

public static string GetHeaderString(this HttpHeaders headers, string key)
{
if(headers == null)
if (headers == null)
{
throw new ArgumentNullException(nameof(headers));
}
Expand All @@ -28,11 +26,13 @@ public static string GetHeaderString(this HttpHeaders headers, string key)

headers.TryGetValues(key, out values);

if(values != null && values.Count() > 1)
string separator = key.Equals("User-Agent") ? " " : ", ";

if (values != null && values.Count() > 1)
{
value = String.Join(separator, values.ToArray());
}

return value;
}
}
Expand Down