Curt Hibbs
2005-Dec-08 12:01 UTC
[Instantrails-users] Fwd: [Rails-commit] [3237] trunk/actionpack: More robust relative url root discovery for SCGI compatibility.
Take a look at this change just committed to the Rails CVS repo... should
help us a lot!
Curt
---------- Forwarded message ----------
From: david at loudthinking.com <david at loudthinking.com>
Date: Dec 7, 2005 10:40 PM
Subject: [Rails-commit] [3237] trunk/actionpack: More robust relative url
root discovery for SCGI compatibility.
To: rails-commit at lists.rubyonrails.org
Revision 3237 Author bitsweat Date 2005-12-08 04:40:24 +0000 (Thu, 08 Dec
2005) Log Message
More robust relative url root discovery for SCGI compatibility. This
solves the ''SCGI routes problem'' -- you no longer need to
prefix all
your routes with the name of the SCGI mountpoint. References #3070.
Modified Paths
-
trunk/actionpack/CHANGELOG<#10808aba4322d65a_trunkactionpackCHANGELOG>
-
trunk/actionpack/lib/action_controller/request.rb<#10808aba4322d65a_trunkactionpacklibaction_controllerrequestrb>
-
trunk/actionpack/test/controller/request_test.rb<#10808aba4322d65a_trunkactionpacktestcontrollerrequest_testrb>
Diff Modified: trunk/actionpack/CHANGELOG (3236 => 3237)
--- trunk/actionpack/CHANGELOG 2005-12-08 04:36:22 UTC (rev 3236)
+++ trunk/actionpack/CHANGELOG 2005-12-08 04:40:24 UTC (rev 3237)
@@ -1,5 +1,7 @@
*SVN*
+* More robust relative url root discovery for SCGI compatibility.
This solves the ''SCGI routes problem'' -- you no longer need to
prefix
all your routes with the name of the SCGI mountpoint. #3070 [Dave
Ringoen]
+
* Fix docs for text_area_tag. #3083. [Christopher Cotton]
* Change form_for and fields_for method signatures to take object
name and object as separate arguments rather than as a Hash. [DHH]
Modified: trunk/actionpack/lib/action_controller/request.rb (3236 => 3237)
--- trunk/actionpack/lib/action_controller/request.rb 2005-12-08
04:36:22 UTC (rev 3236)
+++ trunk/actionpack/lib/action_controller/request.rb 2005-12-08
04:40:24 UTC (rev 3237)
@@ -169,7 +169,8 @@
# Returns the path minus the web server relative installation directory.
# This method returns nil unless the web server is apache.
def relative_url_root
- @@relative_url_root ||= server_software == ''apache'' ?
File.dirname(env["SCRIPT_NAME"].to_s).gsub(/(^\.$|^\/$)/,
'''') : ''''
+ @@relative_url_root ||= server_software == ''apache'' ?
env["SCRIPT_NAME"].to_s.sub(/\/dispatch\.(fcgi|rb|cgi)$/,
'''') : ''''
+
end
# Returns the port number of this request as an integer.
Modified: trunk/actionpack/test/controller/request_test.rb (3236 => 3237)
--- trunk/actionpack/test/controller/request_test.rb 2005-12-08
04:36:22 UTC (rev 3236)
+++ trunk/actionpack/test/controller/request_test.rb 2005-12-08
04:40:24 UTC (rev 3237)
@@ -100,6 +100,11 @@
@request.relative_url_root = nil
@request.env[''SCRIPT_NAME''] =
"/collaboration/hieraki/dispatch.cgi"
assert_equal "/collaboration/hieraki", @request.relative_url_root
+
+ # apache/scgi case
+ @request.relative_url_root = nil
+ @request.env[''SCRIPT_NAME''] =
"/collaboration/hieraki"
+ assert_equal "/collaboration/hieraki", @request.relative_url_root
end
def test_request_uri
_______________________________________________
Rails-commit mailing list
Rails-commit at lists.rubyonrails.org
http://lists.rubyonrails.org/mailman/listinfo/rails-commit
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
http://rubyforge.org/pipermail/instantrails-users/attachments/20051208/a59c7aa7/attachment.htm
David Morton
2005-Dec-08 14:26 UTC
[Instantrails-users] Fwd: [Rails-commit] [3237] trunk/actionpack: More robust relative url root discovery for SCGI compatibility.
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Curt Hibbs wrote:> Take a look at this change just committed to the Rails CVS repo... > should help us a lot!...> More robust relative url root discovery for SCGI compatibility. This solves the ''SCGI routes problem'' -- you no longer need to prefix all your routes with the name of the SCGI mountpoint. References #3070....> # Returns the path minus the web server relative installation directory. > # This method returns nil unless the web server is apache. > def relative_url_root > - @@relative_url_root ||= server_software == ''apache'' ? File.dirname(env["SCRIPT_NAME"].to_s).gsub(/(^\.$|^\/$)/, '''') : '''' > + @@relative_url_root ||= server_software == ''apache'' ? env["SCRIPT_NAME"].to_s.sub(/\/dispatch\.(fcgi|rb|cgi)$/, '''') : ''''Hmm. Well, they are a funny lot. Sometimes I''ll see a problem, try to tell them, and they shout me down, only to actually fix the problem a month later. LOL I''m not sure this totally solves the problem, though... when we use scgi, there''s no /dispatch\.(fcgi|rb|cgi) to match against anyway. I haven''t tested it, but I don''t see how it helps, unless one can SCGIMount /dispatch.cgi ? - -- David Morton Maia Mailguard - http://www.maiamailguard.com Morton Software Design and Consulting - http://www.dgrmm.net -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.2 (MingW32) Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org iD8DBQFDmEJ9SIxC85HZHLMRAvfdAJ4gtDom7pRk9GQ1v2d/hoNuhLMTXwCcCDDW 4TPow1Mc1OZKg+ij/6ep1X8=fkZ8 -----END PGP SIGNATURE-----