Skip to content

Commit

Permalink
Backport #321 to 2.5 to create 2.5.1 release
Browse files Browse the repository at this point in the history
  • Loading branch information
seancorfield committed Apr 23, 2015
1 parent 1a72bd1 commit dba8030
Showing 1 changed file with 12 additions and 14 deletions.
26 changes: 12 additions & 14 deletions org/corfield/framework.cfc
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
component {
variables._fw1_version = "2.5";
variables._fw1_version = "2.5.1";
/*
Copyright (c) 2009-2014, Sean Corfield, Marcin Szczepanski, Ryan Cogswell
Copyright (c) 2009-2015, Sean Corfield, Marcin Szczepanski, Ryan Cogswell
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
Expand All @@ -17,22 +17,20 @@ component {
*/

this.name = hash( getBaseTemplatePath() );
if ( len( getContextRoot() ) ) {
variables.cgiScriptName = replace( CGI.SCRIPT_NAME, getContextRoot(), '' );
variables.cgiPathInfo = replace( CGI.PATH_INFO, getContextRoot(), '' );
} else {
variables.cgiScriptName = CGI.SCRIPT_NAME;
variables.cgiPathInfo = CGI.PATH_INFO;
}
request._fw1 = {
cgiScriptName = CGI.SCRIPT_NAME,
cgiPathInfo = CGI.PATH_INFO,
cgiRequestMethod = CGI.REQUEST_METHOD,
controllers = [ ],
requestDefaultsInitialized = false,
services = [ ],
doTrace = false,
trace = [ ]
};
if ( len( getContextRoot() ) ) {
request._fw1.cgiScriptName = replace( CGI.SCRIPT_NAME, getContextRoot(), '' );
request._fw1.cgiPathInfo = replace( CGI.PATH_INFO, getContextRoot(), '' );
}
// do not rely on these, they are meant to be true magic...
variables.magicApplicationSubsystem = '][';
variables.magicApplicationController = '[]';
Expand Down Expand Up @@ -2085,7 +2083,7 @@ component {
variables.framework.action = 'action';
}
if ( !structKeyExists(variables.framework, 'base') ) {
variables.framework.base = getDirectoryFromPath( variables.cgiScriptName );
variables.framework.base = getDirectoryFromPath( request._fw1.cgiScriptName );
} else if ( right( variables.framework.base, 1 ) != '/' ) {
variables.framework.base = variables.framework.base & '/';
}
Expand Down Expand Up @@ -2232,18 +2230,18 @@ component {

private void function setupRequestDefaults() {
if ( !request._fw1.requestDefaultsInitialized ) {
var pathInfo = variables.cgiPathInfo;
var pathInfo = request._fw1.cgiPathInfo;
request.base = variables.framework.base;
request.cfcbase = variables.framework.cfcbase;

if ( !structKeyExists(request, 'context') ) {
request.context = { };
}
// SES URLs by popular request :)
if ( len( pathInfo ) > len( variables.cgiScriptName ) && left( pathInfo, len( variables.cgiScriptName ) ) == variables.cgiScriptName ) {
if ( len( pathInfo ) > len( request._fw1.cgiScriptName ) && left( pathInfo, len( request._fw1.cgiScriptName ) ) == request._fw1.cgiScriptName ) {
// canonicalize for IIS:
pathInfo = right( pathInfo, len( pathInfo ) - len( variables.cgiScriptName ) );
} else if ( len( pathInfo ) > 0 && pathInfo == left( variables.cgiScriptName, len( pathInfo ) ) ) {
pathInfo = right( pathInfo, len( pathInfo ) - len( request._fw1.cgiScriptName ) );
} else if ( len( pathInfo ) > 0 && pathInfo == left( request._fw1.cgiScriptName, len( pathInfo ) ) ) {
// pathInfo is bogus so ignore it:
pathInfo = '';
}
Expand Down

0 comments on commit dba8030

Please sign in to comment.