public
Fork of rails/rails
Description: Ruby on Rails
Homepage: http://rubyonrails.org
Clone URL: git://github.com/josh/rails.git
AbstractRequest.relative_url_root is no longer automatically configured by 
a HTTP header. It can now be set in your configuration environment with 
config.action_controller.relative_url_root
josh (author)
Thu Jul 24 11:41:51 -0700 2008
commit  a87462afcb6c642e59bfcd2e11e3351e2b718c38
tree    d5826ee11982767558f23456487b67be5f035911
parent  3fd9036fc554979e951422a79f0f77f061112bdc
...
1
2
 
 
3
4
5
...
1
2
3
4
5
6
7
0
@@ -1,5 +1,7 @@
0
 *Edge*
0
 
0
+* AbstractRequest.relative_url_root is no longer automatically configured by a HTTP header. It can now be set in your configuration environment with config.action_controller.relative_url_root [Josh Peek]
0
+
0
 * Update Prototype to 1.6.0.2 #599 [Patrick Joyce]
0
 
0
 * Conditional GET utility methods. [Jeremy Kemper]
...
354
355
356
 
 
 
 
357
358
359
...
354
355
356
357
358
359
360
361
362
363
0
@@ -354,6 +354,10 @@ module ActionController #:nodoc:
0
     class_inheritable_accessor :allow_forgery_protection
0
     self.allow_forgery_protection = true
0
 
0
+ # If you are deploying to a subdirectory, you will need to set
0
+ # <tt>config.action_controller.relative_url_root</tt>
0
+ class_inheritable_accessor :relative_url_root
0
+
0
     # Holds the request object that's primarily used to get environment variables through access like
0
     # <tt>request.env["REQUEST_URI"]</tt>.
0
     attr_internal :request
...
3
4
5
6
 
7
8
9
10
11
12
 
 
 
 
 
13
14
15
...
111
112
113
114
115
 
 
116
117
118
119
120
121
 
122
123
124
...
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
 
 
323
324
325
326
327
328
...
343
344
345
346
347
 
 
348
349
350
351
352
353
354
 
355
356
357
...
3
4
5
 
6
7
8
9
10
 
 
11
12
13
14
15
16
17
18
...
114
115
116
 
 
117
118
119
120
121
122
123
 
124
125
126
127
...
306
307
308
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
309
310
311
312
 
313
314
315
...
330
331
332
 
 
333
334
335
336
337
338
339
340
 
341
342
343
344
0
@@ -3,13 +3,16 @@ require 'stringio'
0
 require 'strscan'
0
 
0
 module ActionController
0
- # HTTP methods which are accepted by default.
0
+ # HTTP methods which are accepted by default.
0
   ACCEPTED_HTTP_METHODS = Set.new(%w( get head put post delete options ))
0
 
0
   # CgiRequest and TestRequest provide concrete implementations.
0
   class AbstractRequest
0
- cattr_accessor :relative_url_root
0
- remove_method :relative_url_root
0
+ def self.relative_url_root=(*args)
0
+ ActiveSupport::Deprecation.warn(
0
+ "ActionController::AbstractRequest.relative_url_root= has been renamed." +
0
+ "You can now set it with config.action_controller.relative_url_root=", caller)
0
+ end
0
 
0
     # The hash of environment variables for this request,
0
     # such as { 'RAILS_ENV' => 'production' }.
0
@@ -111,14 +114,14 @@ module ActionController
0
         end
0
       end
0
     end
0
-
0
-
0
+
0
+
0
     # Sets the format by string extension, which can be used to force custom formats that are not controlled by the extension.
0
     # Example:
0
     #
0
     # class ApplicationController < ActionController::Base
0
     # before_filter :adjust_format_for_iphone
0
- #
0
+ #
0
     # private
0
     # def adjust_format_for_iphone
0
     # request.format = :iphone if request.env["HTTP_USER_AGENT"][/iPhone/]
0
@@ -303,26 +306,10 @@ EOM
0
       path = (uri = request_uri) ? uri.split('?').first.to_s : ''
0
 
0
       # Cut off the path to the installation directory if given
0
- path.sub!(%r/^#{relative_url_root}/, '')
0
- path || ''
0
- end
0
-
0
- # Returns the path minus the web server relative installation directory.
0
- # This can be set with the environment variable RAILS_RELATIVE_URL_ROOT.
0
- # It can be automatically extracted for Apache setups. If the server is not
0
- # Apache, this method returns an empty string.
0
- def relative_url_root
0
- @@relative_url_root ||= case
0
- when @env["RAILS_RELATIVE_URL_ROOT"]
0
- @env["RAILS_RELATIVE_URL_ROOT"]
0
- when server_software == 'apache'
0
- @env["SCRIPT_NAME"].to_s.sub(/\/dispatch\.(fcgi|rb|cgi)$/, '')
0
- else
0
- ''
0
- end
0
+ path.sub!(%r/^#{ActionController::Base.relative_url_root}/, '')
0
+ path || ''
0
     end
0
 
0
-
0
     # Read the request body. This is useful for web services that need to
0
     # work with raw requests directly.
0
     def raw_post
0
@@ -343,15 +330,15 @@ EOM
0
       @symbolized_path_parameters = @parameters = nil
0
     end
0
 
0
- # The same as <tt>path_parameters</tt> with explicitly symbolized keys
0
- def symbolized_path_parameters
0
+ # The same as <tt>path_parameters</tt> with explicitly symbolized keys
0
+ def symbolized_path_parameters
0
       @symbolized_path_parameters ||= path_parameters.symbolize_keys
0
     end
0
 
0
     # Returns a hash with the parameters used to form the path of the request.
0
     # Returned hash keys are strings. See <tt>symbolized_path_parameters</tt> for symbolized keys.
0
     #
0
- # Example:
0
+ # Example:
0
     #
0
     # {'action' => 'my_action', 'controller' => 'my_controller'}
0
     def path_parameters
...
76
77
78
79
 
80
81
82
...
76
77
78
 
79
80
81
82
0
@@ -76,7 +76,7 @@ module ActionController
0
             elements << '#{request.host_with_port}'
0
           end
0
 
0
- elements << '#{request.relative_url_root if request.relative_url_root}'
0
+ elements << '#{ActionController::Base.relative_url_root if ActionController::Base.relative_url_root}'
0
 
0
           # The last entry in <tt>route.segments</tt> appears to *always* be a
0
           # 'divider segment' for '/' but we have assertions to ensure that
...
37
38
39
40
 
41
42
43
...
67
68
69
70
 
71
72
73
...
108
109
110
111
 
112
113
114
...
37
38
39
 
40
41
42
43
...
67
68
69
 
70
71
72
73
...
108
109
110
 
111
112
113
114
0
@@ -37,7 +37,7 @@ module ActionController
0
     # * <tt>:port</tt> - Optionally specify the port to connect to.
0
     # * <tt>:anchor</tt> - An anchor name to be appended to the path.
0
     # * <tt>:skip_relative_url_root</tt> - If true, the url is not constructed using the
0
- # +relative_url_root+ set in ActionController::AbstractRequest.relative_url_root.
0
+ # +relative_url_root+ set in ActionController::Base.relative_url_root.
0
     # * <tt>:trailing_slash</tt> - If true, adds a trailing slash, as in "/archive/2009/"
0
     #
0
     # Any other key (<tt>:controller</tt>, <tt>:action</tt>, etc.) given to
0
@@ -67,7 +67,7 @@ module ActionController
0
         [:protocol, :host, :port, :skip_relative_url_root].each { |k| options.delete(k) }
0
       end
0
       trailing_slash = options.delete(:trailing_slash) if options.key?(:trailing_slash)
0
- url << ActionController::AbstractRequest.relative_url_root.to_s unless options[:skip_relative_url_root]
0
+ url << ActionController::Base.relative_url_root.to_s unless options[:skip_relative_url_root]
0
       anchor = "##{CGI.escape options.delete(:anchor).to_param.to_s}" if options[:anchor]
0
       generated = Routing::Routes.generate(options, {})
0
       url << (trailing_slash ? generated.sub(/\?|\z/) { "/" + $& } : generated)
0
@@ -108,7 +108,7 @@ module ActionController
0
         end
0
 
0
         path = rewrite_path(options)
0
- rewritten_url << @request.relative_url_root.to_s unless options[:skip_relative_url_root]
0
+ rewritten_url << ActionController::Base.relative_url_root.to_s unless options[:skip_relative_url_root]
0
         rewritten_url << (options[:trailing_slash] ? path.sub(/\?|\z/) { "/" + $& } : path)
0
         rewritten_url << "##{options[:anchor]}" if options[:anchor]
0
 
...
476
477
478
479
 
480
481
482
...
492
493
494
495
496
 
 
497
498
499
...
476
477
478
 
479
480
481
482
...
492
493
494
 
 
495
496
497
498
499
0
@@ -476,7 +476,7 @@ module ActionView
0
             if has_request
0
               [ @controller.request.protocol,
0
                 ActionController::Base.asset_host.to_s,
0
- @controller.request.relative_url_root,
0
+ ActionController::Base.relative_url_root,
0
                 dir, source, ext, include_host ].join
0
             else
0
               [ ActionController::Base.asset_host.to_s,
0
@@ -492,8 +492,8 @@ module ActionView
0
               else
0
                 source = "/#{dir}/#{source}" unless source[0] == ?/
0
                 if has_request
0
- unless source =~ %r{^#{@controller.request.relative_url_root}/}
0
- source = "#{@controller.request.relative_url_root}#{source}"
0
+ unless source =~ %r{^#{ActionController::Base.relative_url_root}/}
0
+ source = "#{ActionController::Base.relative_url_root}#{source}"
0
                   end
0
                 end
0
 
...
9
10
11
12
 
13
14
15
16
 
17
18
19
...
24
25
26
27
 
28
29
 
30
31
32
33
 
34
35
 
36
37
38
39
 
 
 
40
41
 
42
43
 
44
45
46
 
 
47
48
49
50
51
52
 
 
 
 
53
54
55
...
90
91
92
93
 
94
95
 
96
97
98
...
118
119
120
121
122
123
124
125
 
 
 
 
 
126
127
 
128
129
130
 
 
 
 
 
 
 
 
131
132
133
134
135
136
137
138
139
140
141
142
143
 
 
 
144
145
146
147
 
 
 
148
149
150
151
 
 
 
152
153
154
155
156
157
158
159
160
161
162
 
 
 
 
 
 
 
 
 
163
164
165
...
204
205
206
207
 
208
209
210
211
212
213
214
 
215
216
217
218
219
220
 
221
222
223
...
237
238
239
240
241
242
243
...
9
10
11
 
12
13
14
15
 
16
17
18
19
...
24
25
26
 
27
28
 
29
30
31
32
 
33
34
 
35
36
 
 
 
37
38
39
40
 
41
42
 
43
44
 
 
45
46
47
48
 
 
 
 
49
50
51
52
53
54
55
...
90
91
92
 
93
94
 
95
96
97
98
...
118
119
120
 
 
 
 
 
121
122
123
124
125
126
 
127
128
 
 
129
130
131
132
133
134
135
136
137
 
 
 
 
 
 
138
139
140
 
 
 
141
142
143
144
 
 
 
145
146
147
148
 
 
 
149
150
151
152
153
 
 
 
 
 
 
 
 
 
154
155
156
157
158
159
160
161
162
163
164
165
...
204
205
206
 
207
208
209
210
211
212
213
 
214
215
216
217
218
219
 
220
221
222
223
...
237
238
239
 
240
241
242
0
@@ -9,11 +9,11 @@ class Workshop
0
   def initialize(id, new_record)
0
     @id, @new_record = id, new_record
0
   end
0
-
0
+
0
   def new_record?
0
     @new_record
0
   end
0
-
0
+
0
   def to_s
0
     id.to_s
0
   end
0
@@ -24,32 +24,32 @@ class RedirectController < ActionController::Base
0
     redirect_to :action => "hello_world"
0
   end
0
 
0
- def redirect_with_status
0
+ def redirect_with_status
0
     redirect_to({:action => "hello_world", :status => 301})
0
- end
0
+ end
0
 
0
   def redirect_with_status_hash
0
     redirect_to({:action => "hello_world"}, {:status => 301})
0
- end
0
+ end
0
 
0
- def url_redirect_with_status
0
+ def url_redirect_with_status
0
     redirect_to("http://www.example.com", :status => :moved_permanently)
0
- end
0
-
0
- def url_redirect_with_status_hash
0
+ end
0
+
0
+ def url_redirect_with_status_hash
0
     redirect_to("http://www.example.com", {:status => 301})
0
- end
0
+ end
0
 
0
- def relative_url_redirect_with_status
0
+ def relative_url_redirect_with_status
0
     redirect_to("/things/stuff", :status => :found)
0
- end
0
-
0
+ end
0
+
0
   def relative_url_redirect_with_status_hash
0
     redirect_to("/things/stuff", {:status => 301})
0
- end
0
-
0
- def redirect_to_back_with_status
0
- redirect_to :back, :status => 307
0
+ end
0
+
0
+ def redirect_to_back_with_status
0
+ redirect_to :back, :status => 307
0
   end
0
 
0
   def host_redirect
0
@@ -90,9 +90,9 @@ class RedirectController < ActionController::Base
0
   end
0
 
0
   def rescue_errors(e) raise e end
0
-
0
+
0
   def rescue_action(e) raise end
0
-
0
+
0
   protected
0
     def dashbord_url(id, message)
0
       url_for :action => "dashboard", :params => { "id" => id, "message" => message }
0
@@ -118,48 +118,48 @@ class RedirectTest < Test::Unit::TestCase
0
     assert_equal "http://test.host/redirect/hello_world", redirect_to_url
0
   end
0
 
0
- def test_redirect_with_status
0
- get :redirect_with_status
0
- assert_response 301
0
- assert_equal "http://test.host/redirect/hello_world", redirect_to_url
0
- end
0
+ def test_redirect_with_status
0
+ get :redirect_with_status
0
+ assert_response 301
0
+ assert_equal "http://test.host/redirect/hello_world", redirect_to_url
0
+ end
0
 
0
- def test_redirect_with_status_hash
0
+ def test_redirect_with_status_hash
0
     get :redirect_with_status_hash
0
- assert_response 301
0
- assert_equal "http://test.host/redirect/hello_world", redirect_to_url
0
+ assert_response 301
0
+ assert_equal "http://test.host/redirect/hello_world", redirect_to_url
0
+ end
0
+
0
+ def test_url_redirect_with_status
0
+ get :url_redirect_with_status
0
+ assert_response 301
0
+ assert_equal "http://www.example.com", redirect_to_url
0
   end
0
-
0
- def test_url_redirect_with_status
0
- get :url_redirect_with_status
0
- assert_response 301
0
- assert_equal "http://www.example.com", redirect_to_url
0
- end
0
 
0
   def test_url_redirect_with_status_hash
0
     get :url_redirect_with_status_hash
0
- assert_response 301
0
- assert_equal "http://www.example.com", redirect_to_url
0
- end
0
+ assert_response 301
0
+ assert_equal "http://www.example.com", redirect_to_url
0
+ end
0
 
0
-
0
- def test_relative_url_redirect_with_status
0
- get :relative_url_redirect_with_status
0
+
0
+ def test_relative_url_redirect_with_status
0
+ get :relative_url_redirect_with_status
0
     assert_response 302
0
- assert_equal "http://test.host/things/stuff", redirect_to_url
0
- end
0
-
0
+ assert_equal "http://test.host/things/stuff", redirect_to_url
0
+ end
0
+
0
   def test_relative_url_redirect_with_status_hash
0
     get :relative_url_redirect_with_status_hash
0
- assert_response 301
0
- assert_equal "http://test.host/things/stuff", redirect_to_url
0
- end
0
-
0
- def test_redirect_to_back_with_status
0
- @request.env["HTTP_REFERER"] = "http://www.example.com/coming/from"
0
- get :redirect_to_back_with_status
0
- assert_response 307
0
- assert_equal "http://www.example.com/coming/from", redirect_to_url
0
+ assert_response 301
0
+ assert_equal "http://test.host/things/stuff", redirect_to_url
0
+ end
0
+
0
+ def test_redirect_to_back_with_status
0
+ @request.env["HTTP_REFERER"] = "http://www.example.com/coming/from"
0
+ get :redirect_to_back_with_status
0
+ assert_response 307
0
+ assert_equal "http://www.example.com/coming/from", redirect_to_url
0
   end
0
 
0
   def test_simple_redirect_using_options
0
@@ -204,20 +204,20 @@ class RedirectTest < Test::Unit::TestCase
0
     assert_response :redirect
0
     assert_equal "http://www.example.com/coming/from", redirect_to_url
0
   end
0
-
0
+
0
   def test_redirect_to_back_with_no_referer
0
     assert_raises(ActionController::RedirectBackError) {
0
       @request.env["HTTP_REFERER"] = nil
0
       get :redirect_to_back
0
     }
0
   end
0
-
0
+
0
   def test_redirect_to_record
0
     ActionController::Routing::Routes.draw do |map|
0
       map.resources :workshops
0
       map.connect ':controller/:action/:id'
0
     end
0
-
0
+
0
     get :redirect_to_existing_record
0
     assert_equal "http://test.host/workshops/5", redirect_to_url
0
     assert_redirected_to Workshop.new(5, false)
0
@@ -237,7 +237,6 @@ class RedirectTest < Test::Unit::TestCase
0
       get :redirect_to_nil
0
     end
0
   end
0
-
0
 end
0
 
0
 module ModuleTest
...
3
4
5
 
6
7
8
 
 
 
 
9
10
11
...
38
39
40
41
 
42
43
44
...
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
 
201
202
203
204
 
205
206
 
207
208
209
210
 
211
212
213
214
215
216
217
218
219
 
220
221
222
223
224
225
 
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
 
253
254
255
256
257
258
 
259
260
261
 
262
263
 
264
265
266
 
267
268
 
269
270
271
 
272
273
274
...
276
277
278
279
280
281
282
283
284
285
 
286
287
288
...
415
416
417
418
 
419
420
421
422
 
423
424
425
426
 
427
428
429
...
774
775
776
777
 
778
779
780
781
782
783
 
784
785
786
 
787
788
789
 
790
791
792
...
3
4
5
6
7
8
9
10
11
12
13
14
15
16
...
43
44
45
 
46
47
48
49
...
125
126
127
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
128
129
130
 
131
132
133
134
 
135
136
137
138
 
139
140
141
142
 
143
144
145
146
 
147
148
149
150
 
151
152
153
154
155
 
156
157
158
159
160
161
162
 
163
164
165
166
167
168
169
170
 
171
172
173
174
175
176
177
178
 
179
180
181
182
183
184
185
 
186
187
188
189
190
191
 
192
193
194
195
196
 
197
198
199
200
201
 
202
203
204
205
206
207
208
 
209
210
211
212
213
214
215
 
216
217
 
218
219
220
 
221
222
 
223
224
225
 
226
227
228
229
...
231
232
233
 
234
235
236
237
238
 
239
240
241
242
...
369
370
371
 
372
373
374
375
 
376
377
378
379
 
380
381
382
383
...
728
729
730
 
731
732
733
734
735
736
 
737
738
739
 
740
741
742
 
743
744
745
746
0
@@ -3,9 +3,14 @@ require 'action_controller/integration'
0
 
0
 class RequestTest < Test::Unit::TestCase
0
   def setup
0
+ ActionController::Base.relative_url_root = nil
0
     @request = ActionController::TestRequest.new
0
   end
0
 
0
+ def teardown
0
+ ActionController::Base.relative_url_root = nil
0
+ end
0
+
0
   def test_remote_ip
0
     assert_equal '0.0.0.0', @request.remote_ip
0
 
0
@@ -38,7 +43,7 @@ class RequestTest < Test::Unit::TestCase
0
 
0
     @request.env['HTTP_X_FORWARDED_FOR'] = '10.0.0.1,3.4.5.6'
0
     assert_equal '3.4.5.6', @request.remote_ip
0
-
0
+
0
     @request.env['HTTP_X_FORWARDED_FOR'] = '10.0.0.1, 10.0.0.1, 3.4.5.6'
0
     assert_equal '3.4.5.6', @request.remote_ip
0
 
0
@@ -120,155 +125,105 @@ class RequestTest < Test::Unit::TestCase
0
     assert_equal ":8080", @request.port_string
0
   end
0
 
0
- def test_relative_url_root
0
- @request.env['SCRIPT_NAME'] = "/hieraki/dispatch.cgi"
0
- @request.env['SERVER_SOFTWARE'] = 'lighttpd/1.2.3'
0
- assert_equal '', @request.relative_url_root, "relative_url_root should be disabled on lighttpd"
0
-
0
- @request.env['SERVER_SOFTWARE'] = 'apache/1.2.3 some random text'
0
-
0
- @request.env['SCRIPT_NAME'] = nil
0
- assert_equal "", @request.relative_url_root
0
-
0
- @request.env['SCRIPT_NAME'] = "/dispatch.cgi"
0
- assert_equal "", @request.relative_url_root
0
-
0
- @request.env['SCRIPT_NAME'] = "/myapp.rb"
0
- assert_equal "", @request.relative_url_root
0
-
0
- @request.relative_url_root = nil
0
- @request.env['SCRIPT_NAME'] = "/hieraki/dispatch.cgi"
0
- assert_equal "/hieraki", @request.relative_url_root
0
-
0
- @request.relative_url_root = nil
0
- @request.env['SCRIPT_NAME'] = "/collaboration/hieraki/dispatch.cgi"
0
- assert_equal "/collaboration/hieraki", @request.relative_url_root
0
-
0
- # apache/scgi case
0
- @request.relative_url_root = nil
0
- @request.env['SCRIPT_NAME'] = "/collaboration/hieraki"
0
- assert_equal "/collaboration/hieraki", @request.relative_url_root
0
-
0
- @request.relative_url_root = nil
0
- @request.env['SCRIPT_NAME'] = "/hieraki/dispatch.cgi"
0
- @request.env['SERVER_SOFTWARE'] = 'lighttpd/1.2.3'
0
- @request.env['RAILS_RELATIVE_URL_ROOT'] = "/hieraki"
0
- assert_equal "/hieraki", @request.relative_url_root
0
-
0
- # @env overrides path guess
0
- @request.relative_url_root = nil
0
- @request.env['SCRIPT_NAME'] = "/hieraki/dispatch.cgi"
0
- @request.env['SERVER_SOFTWARE'] = 'apache/1.2.3 some random text'
0
- @request.env['RAILS_RELATIVE_URL_ROOT'] = "/real_url"
0
- assert_equal "/real_url", @request.relative_url_root
0
- end
0
-
0
   def test_request_uri
0
     @request.env['SERVER_SOFTWARE'] = 'Apache 42.342.3432'
0
 
0
- @request.relative_url_root = nil
0
     @request.set_REQUEST_URI "http://www.rubyonrails.org/path/of/some/uri?mapped=1"
0
     assert_equal "/path/of/some/uri?mapped=1", @request.request_uri
0
     assert_equal "/path/of/some/uri", @request.path
0
 
0
- @request.relative_url_root = nil
0
     @request.set_REQUEST_URI "http://www.rubyonrails.org/path/of/some/uri"
0
     assert_equal "/path/of/some/uri", @request.request_uri
0
     assert_equal "/path/of/some/uri", @request.path
0
 
0
- @request.relative_url_root = nil
0
     @request.set_REQUEST_URI "/path/of/some/uri"
0
     assert_equal "/path/of/some/uri", @request.request_uri
0
     assert_equal "/path/of/some/uri", @request.path
0
 
0
- @request.relative_url_root = nil
0
     @request.set_REQUEST_URI "/"
0
     assert_equal "/", @request.request_uri
0
     assert_equal "/", @request.path
0
 
0
- @request.relative_url_root = nil
0
     @request.set_REQUEST_URI "/?m=b"
0
     assert_equal "/?m=b", @request.request_uri
0
     assert_equal "/", @request.path
0
 
0
- @request.relative_url_root = nil
0
     @request.set_REQUEST_URI "/"
0
     @request.env['SCRIPT_NAME'] = "/dispatch.cgi"
0
     assert_equal "/", @request.request_uri
0
     assert_equal "/", @request.path
0
 
0
- @request.relative_url_root = nil
0
+ ActionController::Base.relative_url_root = "/hieraki"
0
     @request.set_REQUEST_URI "/hieraki/"
0
     @request.env['SCRIPT_NAME'] = "/hieraki/dispatch.cgi"
0
     assert_equal "/hieraki/", @request.request_uri
0
     assert_equal "/", @request.path
0
+ ActionController::Base.relative_url_root = nil
0
 
0
- @request.relative_url_root = nil
0
+ ActionController::Base.relative_url_root = "/collaboration/hieraki"
0
     @request.set_REQUEST_URI "/collaboration/hieraki/books/edit/2"
0
     @request.env['SCRIPT_NAME'] = "/collaboration/hieraki/dispatch.cgi"
0
     assert_equal "/collaboration/hieraki/books/edit/2", @request.request_uri
0
     assert_equal "/books/edit/2", @request.path
0
+ ActionController::Base.relative_url_root = nil
0
 
0
     # The following tests are for when REQUEST_URI is not supplied (as in IIS)
0
- @request.relative_url_root = nil
0
     @request.set_REQUEST_URI nil
0
     @request.env['PATH_INFO'] = "/path/of/some/uri?mapped=1"
0
     @request.env['SCRIPT_NAME'] = nil #"/path/dispatch.rb"
0
     assert_equal "/path/of/some/uri?mapped=1", @request.request_uri
0
     assert_equal "/path/of/some/uri", @request.path
0
 
0
+ ActionController::Base.relative_url_root = '/path'
0
     @request.set_REQUEST_URI nil
0
- @request.relative_url_root = nil
0
     @request.env['PATH_INFO'] = "/path/of/some/uri?mapped=1"
0
     @request.env['SCRIPT_NAME'] = "/path/dispatch.rb"
0
     assert_equal "/path/of/some/uri?mapped=1", @request.request_uri
0
     assert_equal "/of/some/uri", @request.path
0
+ ActionController::Base.relative_url_root = nil
0
 
0
     @request.set_REQUEST_URI nil
0
- @request.relative_url_root = nil
0
     @request.env['PATH_INFO'] = "/path/of/some/uri"
0
     @request.env['SCRIPT_NAME'] = nil
0
     assert_equal "/path/of/some/uri", @request.request_uri
0
     assert_equal "/path/of/some/uri", @request.path
0
 
0
     @request.set_REQUEST_URI nil
0
- @request.relative_url_root = nil
0
     @request.env['PATH_INFO'] = "/"
0
     assert_equal "/", @request.request_uri
0
     assert_equal "/", @request.path
0
 
0
     @request.set_REQUEST_URI nil
0
- @request.relative_url_root = nil
0
     @request.env['PATH_INFO'] = "/?m=b"
0
     assert_equal "/?m=b", @request.request_uri
0
     assert_equal "/", @request.path
0
 
0
     @request.set_REQUEST_URI nil
0
- @request.relative_url_root = nil
0
     @request.env['PATH_INFO'] = "/"
0
     @request.env['SCRIPT_NAME'] = "/dispatch.cgi"
0
     assert_equal "/", @request.request_uri
0
     assert_equal "/", @request.path
0
 
0
+ ActionController::Base.relative_url_root = '/hieraki'
0
     @request.set_REQUEST_URI nil
0
- @request.relative_url_root = nil
0
     @request.env['PATH_INFO'] = "/hieraki/"
0
     @request.env['SCRIPT_NAME'] = "/hieraki/dispatch.cgi"
0
     assert_equal "/hieraki/", @request.request_uri
0
     assert_equal "/", @request.path
0
+ ActionController::Base.relative_url_root = nil
0
 
0
     @request.set_REQUEST_URI '/hieraki/dispatch.cgi'
0
- @request.relative_url_root = '/hieraki'
0
+ ActionController::Base.relative_url_root = '/hieraki'
0
     assert_equal "/dispatch.cgi", @request.path
0
- @request.relative_url_root = nil
0
+ ActionController::Base.relative_url_root = nil
0
 
0
     @request.set_REQUEST_URI '/hieraki/dispatch.cgi'
0
- @request.relative_url_root = '/foo'
0
+ ActionController::Base.relative_url_root = '/foo'
0
     assert_equal "/hieraki/dispatch.cgi", @request.path
0
- @request.relative_url_root = nil
0
+ ActionController::Base.relative_url_root = nil
0
 
0
     # This test ensures that Rails uses REQUEST_URI over PATH_INFO
0
- @request.relative_url_root = nil
0
+ ActionController::Base.relative_url_root = nil
0
     @request.env['REQUEST_URI'] = "/some/path"
0
     @request.env['PATH_INFO'] = "/another/path"
0
     @request.env['SCRIPT_NAME'] = "/dispatch.cgi"
0
@@ -276,13 +231,12 @@ class RequestTest < Test::Unit::TestCase
0
     assert_equal "/some/path", @request.path
0
   end
0
 
0
-
0
   def test_host_with_default_port
0
     @request.host = "rubyonrails.org"
0
  &nb