Bug 693996

Summary: UriTemplate doesn't support named wildcards
Product: [Mono] Mono: Class Libraries Reporter: David Strawbridge <davidstrawbridge>
Component: WCFAssignee: Atsushi Enomoto <atsushieno>
Status: NEW --- QA Contact: Mono Bugs <mono-bugs>
Severity: Normal    
Priority: P5 - None    
Version: 2.6.x   
Target Milestone: ---   
Hardware: 64bit   
OS: Ubuntu   
Whiteboard:
Found By: --- Services Priority:
Business Priority: Blocker: ---
Marketing QA Status: --- IT Deployment: ---
Attachments: Test program

Description David Strawbridge 2011-05-16 11:11:03 UTC
Created attachment 429745 [details]
Test program

User-Agent:       Mozilla/5.0 (X11; Linux x86_64; rv:6.0a1) Gecko/20110515 Firefox/6.0a1

Compiled code which runs under Microsoft.NET which has a UriTemplate with a named wildcard segment.
Under Mono on Ubuntu, this throws a System.FormatException: Wildcard in UriTemplate is valid only if it is placed at the last part of the path: '{*path}'

Admittedly, this is not really documented by Microsoft, but they do support it, and it allows access to the wildcard path via the UriTemplateMatch.BoundVariables, and also enables WCF methods to have named wildcard parameters.


Reproducible: Always

Steps to Reproduce:
1. Build attached test program (need reference to System.ServiceModel.Web.dll)
2. Run program - exception is thrown

Actual Results:  
Unhandled Exception: System.FormatException: Wildcard in UriTemplate is valid only if it is placed at the last part of the path: '{*path}'
  at System.UriTemplate.ParsePathTemplate (System.String template, Int32 index, Int32 end) [0x00000] in <filename unknown>:0 
  at System.UriTemplate..ctor (System.String template, Boolean ignoreTrailingSlash, IDictionary`2 additionalDefaults) [0x00000] in <filename unknown>:0 
  at System.UriTemplate..ctor (System.String template, Boolean ignoreTrailingSlash) [0x00000] in <filename unknown>:0 
  at System.UriTemplate..ctor (System.String template) [0x00000] in <filename unknown>:0 
  at uritemplatewildcardbug.MainClass.Main (System.String[] args) [0x00000] in <filename unknown>:0 


Expected Results:  
Under MS .NET, the output is (as expected)

Match, path='something'
Comment 1 David Strawbridge 2011-05-16 11:20:12 UTC
I think it's because the implementation just checks for a "*" character, and if found, ensures it's the last character in the UriTemplate string.