Bug 693996 - UriTemplate doesn't support named wildcards
Summary: UriTemplate doesn't support named wildcards
Status: NEW
Alias: None
Product: Mono: Class Libraries
Classification: Mono
Component: WCF (show other bugs)
Version: 2.6.x
Hardware: 64bit Ubuntu
: P5 - None : Normal
Target Milestone: ---
Assignee: Atsushi Enomoto
QA Contact: Mono Bugs
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-05-16 11:11 UTC by David Strawbridge
Modified: 2011-05-16 11:20 UTC (History)
0 users

See Also:
Found By: ---
Services Priority:
Business Priority:
Blocker: ---
Marketing QA Status: ---
IT Deployment: ---


Attachments
Test program (458 bytes, text/plain)
2011-05-16 11:11 UTC, David Strawbridge
Details

Note You need to log in before you can comment on or make changes to this bug.
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.