Skip to content

Behavioral difference between Linux and Windows in httprequest with 302 reply and # #1246

@jdelrue

Description

@jdelrue

General

Operating system 1: Windows 10
Operating system 2: Ubuntu (16.04 or 17.04)

Execute:

using System;
using System.Net.Http;
using System.Threading.Tasks;

namespace redirtest
{
    class Program
    {
        static void Main(string[] args)
        {
            var res = Task.Run(async () => await method());
            res.Wait();
        }
        public static async Task method()
        {
            using (var client = new HttpClient(new HttpClientHandler
            {
                AllowAutoRedirect = true
            }))
            {
                var connect = await client.GetAsync("http://www.jimber.org/redirect.php");
                var requestUri = connect.RequestMessage.RequestUri.AbsoluteUri;
                Console.WriteLine(requestUri);

            }
        }
    }
}

Output Windows: http://www.google.be/#youdontgetthisinlinux
Output Linux: http://www.google.be/

Expected output is the Windows version. Workaround: Disable autoredirect and read location header.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions