Ticket #56 (closed defect: fixed)

Opened 16 months ago

Last modified 15 months ago

[PATCH] UriTemplate.Match should normalize uris

Reported by: anonymous Owned by: serialseb
Priority: critical Milestone: 2.0 Beta 1
Component: Core - Pipeline Version: 2.0 Beta 1 - 2.0.100.195
Keywords: Cc:
Time remaining: 1d Blocked By:
Time spent: 1d Time planned: 1d
Blocking:

Description

I've moved from WebDev? server to IIS7 & immediately all my resources started to fail with 404 not found because ResourceTypeResolver? couldn't match incoming urls to resources anymore. Digging into the source & debugging revealed that under IIS7 the app base uri is like  http://localhost/rastademo, i.e. without trailing slash. So the segments are "/" & "rastademo". When browsing to  http://localhost/rastademo/ incoming uri segments are "/" & "rastademo/", so they do not match.

Attached patch normalizes both base & incoming uris by trimming trailing "/" of segment ("/" segments are not trimmed) before matching uris by segments. This solves the issue. All tests pass.

Attachments

UriTemplate_Match_ShouldNormalizeUris.patch Download (4.9 KB) - added by anonymous 16 months ago.

Change History

Changed 16 months ago by anonymous

Changed 16 months ago by serialseb

That's been an issue since the first versions, never bothered reviewing the code for use in vpaths, so i'm not surprised :)

Need to write a unit test for this and run it against the MS implementation too. Also need to review the code, as I'm unsure if the base uri resolving in UriTemplate? actually works.

If I remember corectly, it doesn't work but this is alleviated by the fact that the URI routing is not using the real base URI.

Changed 16 months ago by serialseb

  • status changed from new to assigned

Changed 16 months ago by anonymous

BindByName? & BindByPosition? needs to Normalize Uris too. My app is in vdir & I get urls like  http://localhost/about instead of  http://localhost/rastademo/about. Tha's becasue baseAddress used in those methods is  http://localhost/rastademo under IIS7 (haven't checked under VS embedded). I've changed normalization locally to add trailing slash to urls, not to strip it. I'm not including a patch cause it's pretty trivial & you should be able to see it yourself easily.

Changed 15 months ago by serialseb

  • status changed from assigned to closed
  • version set to 2.0 Beta 1 - 2.0.100.195
  • resolution set to fixed
  • milestone set to 2.0 Beta 1

Add/Change #56 ([PATCH] UriTemplate.Match should normalize uris)

Author


E-mail address and user name can be saved in the Preferences.


Action
as closed
Next status will be 'reopened'
 
Note: See TracTickets for help on using tickets.