Bug 4896 - Incorrect routing of catchall parameter
Summary: Incorrect routing of catchall parameter
Status: NEW
Alias: None
Product: Class Libraries
Classification: Mono
Component: System.Web (show other bugs)
Version: 2.10.x
Hardware: PC Windows
: --- normal
Target Milestone: Untriaged
Assignee: Bugzilla
URL:
Depends on:
Blocks:
 
Reported: 2012-05-04 18:22 UTC by Bassam
Modified: 2016-11-11 09:42 UTC (History)
3 users (show)

See Also:
Tags:
Is this bug a regression?: ---
Last known good build:


Attachments

Description Bassam 2012-05-04 18:22:21 UTC
System.Web.Routing does not seem to parse the catchall parameter correctly. Below is a repro:

using System;
using System.Collections.Specialized;
using System.Web;
using System.Web.Routing;

namespace MonoRoutingBug
{
    class Program
    {
        static void Main(string[] args)
        {
            Route route = new Route("api/v{version}/folder/{folderId}/search/{*relativePath}", new RouteValueDictionary(new { controller = "Foo", action = "Index" }), new DummyRouteHandler());
            RouteData data = route.GetRouteData(new DummyHttpContext("/api/v0/folder/2793d936b47c4a73b97d01fea321db3a/search/"));
            Console.WriteLine("{0}", data == null);
            // Expected : data is not null
            // Actual: data is null
        }
    }

    class DummyRouteHandler : IRouteHandler
    {
        public IHttpHandler GetHttpHandler(RequestContext requestContext)
        {
            return null;
        }
    }

    class DummyHttpRequest: HttpRequestBase
    {
        private Uri url;

        public DummyHttpRequest(string urlString)
        {
            url = new Uri(new Uri("http://localhost"), urlString);
        }

        public override string AppRelativeCurrentExecutionFilePath { get {
return "~" + url.LocalPath; } }
        public override string PathInfo { get { return string.Empty; } }
        public override NameValueCollection QueryString { get { return
HttpUtility.ParseQueryString(url.Query); } }
    }

    class DummyHttpContext : HttpContextBase
    {
        private DummyHttpRequest req;

        public DummyHttpContext(string urlString)
        {
            req = new DummyHttpRequest(urlString);
        }

        public override HttpRequestBase Request { get { return req; } }
    }
}
Comment 1 michael 2012-09-26 13:02:48 UTC
This was fixed in 65f7b4a137cc45d8c666669a9343953f5f415aa4 in the mono-2-10 branch.

Note You need to log in before you can comment on or make changes to this bug.