Bug 31336

Summary: HttpClient adds comma in User-Agent
Product: [Mono] Class Libraries Reporter: Andrey Mironov <andrey.mir>
Component: System.Net.HttpAssignee: Marek Safar <masafa>
Status: RESOLVED FIXED    
Severity: normal CC: masafa, mono-bugs+mono
Priority: ---    
Version: 4.0.0   
Target Milestone: Untriaged   
Hardware: PC   
OS: Windows   
Tags: Is this bug a regression?: ---
Last known good build:

Description Andrey Mironov 2015-06-23 20:16:20 UTC
I compiled this program with Microsoft .NET 4.5.1 and it works fine with Microsoft .NET. However, when I run this program with Mono it works, but send incorrect User-Agent header. Instead of sending "MLK Android Phone 1.1.9" it sends "MLK,Android,Phone,1.1.9".

using System;
using System.Net.Http;

namespace ConsoleApplication1
{
    class Program
    {
        static void Main(string[] args)
        {
            using (var http = new HttpClient())
            {
                http.DefaultRequestHeaders.Add("User-Agent", "MLK Android Phone 1.1.9");

                http.GetAsync(new Uri("http://localhost:8888", UriKind.Absolute)).Wait();
            }
        }
    }
}

If it help, when I change the header name to User-Aaaaaagent then the spaces aren't replaced with commas in the header value.
Comment 1 Marek Safar 2015-06-25 16:20:58 UTC
Fixed in master and Mono 4.2