Request and URL Rewriting Reworking

Showing 1-3 of 3 messages
Request and URL Rewriting Reworking Andrew Short 8/7/12 4:46 PM

As part of my GSOC work I've greatly reworked the way requests are generated and handled. The main aim was to reduce the amount of procedural code, separate concerns and make it more testable. Along the line though I've also made some significant enhancements and changes.

The branches I've done the work on are:

The changes I've made are:

  • I've extracted the routing logic from the request class into separate classes.

  • I've changed it so the extension is included in the request URL. This is a big change, but I think it's worth it - at the moment SS will ignore the extension when handling requests, leading to duplicate content issues. For most sites I don't think changing this is an issue, and it's something that needs to be fixed.

  • The $_FILES information is no longer included in the post variables in a request. There is now a separate accessor to better mimic how PHP handles requests.

  • Moved a lot of the http request functionality around, moving url, base url etc generation into the request class rather than random places in various bootstrap files.

  • Changed the way requests are rewritten - rather than appending the URL as a query parameter, proper methods are now used. This allows tests requests to be generated more easily, and makes it testable. This is a big change, since there's a lot of different behaviours across servers. I've base the URL extracting code on that from Zend Framework (which Symfony also uses), so it should be fairly reliable. However, this will need testing on lots of set ups. So far I've tested it on apache, lighttpd and nginx. The rewrite rules should be backwards compatible, so existing setups should continue to work. I've updated the installer htaccess to the new format thought, and changed the docs.

The unit tests all pass as well. To do this I had to make some tweaks to the injector stuff, but that is fairly minor.

It would be good to get some thoughts on this - these are all major changes which may introduce upgrading pain, but I think they're worth it.

Andrew Short.

Re: [silverstripe-dev] Request and URL Rewriting Reworking Nicolaas Thiemen Francken - Sunny Side Up 8/7/12 7:49 PM
This is very exciting news.
Re: [silverstripe-dev] Request and URL Rewriting Reworking Ingo Schommer 8/9/12 5:43 AM
Amazing work, thanks Andrew! 
Had a 5 min look, and think I understood most of the architecture decisions, which is a good sign ;)
I'm particularly glad to see HTTPRequest->match() be consolidated into RoutedRequest,
that was always a bit icky. And pre/post request processing FTW!

You received this message because you are subscribed to the Google Groups "SilverStripe Core Development" group.
To post to this group, send email to
To unsubscribe from this group, send email to
For more options, visit this group at