diff --git a/src/SocksSharp/Extensions/HttpHeadersExtensions.cs b/src/SocksSharp/Extensions/HttpHeadersExtensions.cs index 6a2232f..f7af1e9 100644 --- a/src/SocksSharp/Extensions/HttpHeadersExtensions.cs +++ b/src/SocksSharp/Extensions/HttpHeadersExtensions.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Collections.Generic; using System.Linq; using System.Net.Http.Headers; @@ -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)); } @@ -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; } }