Graham Dumpleton wrote: > > On Nov 2, 9:17 am, Chris McDonough <chr...@plope.com> wrote: >> repoze.bfg 1.1b1 has been released. >> >> ... >> >> - If a BFG app that had a route matching the root URL was mounted >> under a path in modwsgi, ala ``WSGIScriptAlias /myapp >> /Users/chrism/projects/modwsgi/env/bfg.wsgi``, the home route (a >> route with the path of ``'/'`` or ``''``) would not match when the >> path ``/myapp`` was visited (only when the path ``/myapp/`` was >> visited). This is now fixed: if the urldispatch root factory notes >> that the PATH_INFO is empty, it converts it to a single slash before >> trying to do matching. > > Hmmm, not sure if that sounds right. Internally adding in a slash like > that can possibly stuff up relative URLs generated in that page in as > much as browser will interpret them incorrectly.
The change log entry was worded badly. The code I added doesn't actually mutate PATH_INFO or SCRIPT_NAME (or any environment value), and it doesn't effect URL generation in any way or do any redirection; it just adjusts an internal value used only within the scope of a method. This value is used as input to the route matching code. Mapping '' to '/' internally in this way was just easier than changing the route matching code itself. The change log entry should probably have read something like this: - Changed route matching code to deal properly with empty PATH_INFO. > For example, if browser requested '/myapp' and that page had relative > URL 'page.html' where you expected browser to interpret that as '/ > myapp/page.html', you will be disappointed as browser will instead > interpret it as '/page.html'. > > Normally one would send a redirect back to the browser to tell it to > request again with the trailing slash added. This way the browser is > aware of the correct base URL and so relative URLs in the response > will work properly. > > That said, I know nothing about how your stuff works, so what I say > may not be relevant in your system. Thanks. You're right to be suspicious given the wording in the changelog. - C _______________________________________________ Repoze-dev mailing list Repoze-dev@lists.repoze.org http://lists.repoze.org/listinfo/repoze-dev