public
Description: A Ruby web application framework
Homepage: http://www.mackframework.com
Clone URL: git://github.com/markbates/mack.git
Search Repo:
Click here to lend your support to: mack and make a donation at www.pledgie.com !
Merge branch 'master' into file_rework

* master:
  Fixed boundary condition of two sessions being set on pages with a 
  render(:url) call with no previous session cookie.
  Fixed bug with cookies not merging with configured app_config 
  parameters.
  Fixed local urls using the same session/sharing requests.
  gem mack_ruby_core_extensions 0.1.27
  gem mack_ruby_core_extensions 0.1.26
  Working on using the same session for local url requests.

Conflicts:

  CHANGELOG
markbates (author)
Fri May 09 10:29:31 -0700 2008
commit  2cf1aa4c45b2f7e78825cee75ab4836068196b72
tree    94f1c8e531bea616075ef049f9be85e665e5af8a
parent  17e4915bba44c75c0a03b906e111f165de22bdd2 parent  e76a4560397d79668e25a7b9958043ed140200fc
...
1
 
2
3
4
 
5
6
 
7
8
9
...
1
2
3
4
 
5
6
 
7
8
9
10
0
@@ -1,9 +1,10 @@
0
 * Refactored, and reorganized some files to clean up the gem.
0
+* Fixed bug with cookies not merging with configured app_config parameters.
0
 * Added mime-types. The 'Content-Type' header is now being set based on the format that is requested. Default is text/html.
0
 * Fixed r.defaults in routes so they are always the last routes to be checked, no matter where they are placed in the routes definitions.
0
-* render(:url) now recognizes 'local' urls and tries to run them through the app.
0
+* render(:url) now recognizes 'local' urls and tries to run them through the app, mimicking most headers from the original request.
0
 * Added 'options' banners to the mack and mack_ring_server binaries.
0
-* gem: mack_ruby_core_extensions 0.1.25
0
+* gem: mack_ruby_core_extensions 0.1.27
0
 
0
 ===0.5.0
0
 * Added rake db:create and db:create:all rake tasks.
...
1
2
3
4
5
6
7
8
9
 
10
11
12
...
17
18
19
20
 
21
22
23
...
27
28
29
30
 
31
32
33
...
54
55
56
 
 
 
 
 
 
 
 
 
 
 
 
57
58
59
...
 
 
1
2
3
4
5
6
 
7
8
9
10
...
15
16
17
 
18
19
20
21
...
25
26
27
 
28
29
30
31
...
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
0
@@ -1,12 +1,10 @@
0
-require 'net/http'
0
-require File.join(File.dirname(__FILE__), "..", 'base')
0
 module Mack
0
   module Rendering
0
     # Used when someone calls render(:url => "http://www.mackframework.com")
0
     class Url < Base
0
       
0
       def render
0
- options = {:method => :get, :domain => app_config.mack.site_domain, :raise_exception => false}.merge(self.options)
0
+ options = {:method => :get, :, :raise_exception => false}.merge(self.options)
0
         url = options[:url]
0
         remote = url.match(/^[a-zA-Z]+:\/\//)
0
         case options[:method]
0
@@ -17,7 +15,7 @@
0
             end
0
           else
0
             do_render_local_url(url, options) do |url, options|
0
- Rack::MockRequest.new(self.view_binder.app_for_rendering).get(url)
0
+ Rack::MockRequest.new(self.view_binder.app_for_rendering).get(url, options)
0
             end
0
           end
0
         when :post
0
@@ -27,7 +25,7 @@
0
             end
0
           else
0
             do_render_local_url(url, options) do |url, options|
0
- Rack::MockRequest.new(self.view_binder.app_for_rendering).post(url)
0
+ Rack::MockRequest.new(self.view_binder.app_for_rendering).post(url, options)
0
             end
0
           end
0
         else
0
@@ -54,6 +52,18 @@
0
       
0
       def do_render_local_url(url, options)
0
         Timeout::timeout(app_config.mack.render_url_timeout || 5) do
0
+ cooks = {}
0
+ self.view_binder.controller.cookies.all.each do |c,v|
0
+ cooks[c] = v[:value]
0
+ end
0
+ request = self.view_binder.controller.request
0
+ # MACK_DEFAULT_LOGGER.debug "ORIGINAL REQUEST: #{request.env.inspect}"
0
+ env = request.env.dup
0
+ env - ["rack.input", "rack.errors", "PATH_INFO", "REQUEST_PATH", "REQUEST_URI", "REQUEST_METHOD"]
0
+ env["rack.request.query_hash"] = options[:parameters]
0
+ env["HTTP_COOKIE"] = "#{app_config.mack.session_id}=#{request.session.id};" if env["HTTP_COOKIE"].nil?
0
+ options = env.merge(options)
0
+ # MACK_DEFAULT_LOGGER.debug "NEW OPTIONS: #{options.inspect}"
0
           response = yield url, options
0
           if response.successful?
0
             return response.body
...
42
43
44
45
 
46
47
48
...
42
43
44
 
45
46
47
48
0
@@ -42,7 +42,7 @@
0
       unless value.is_a?(Hash)
0
         value = {:value => value}
0
       end
0
- value = app_config.mack.cookie_values.s.merge(value)
0
+ value = app_config.mack.cookie_values.symbolize_keys.merge(value)
0
       self.all_cookies[key] = value
0
       self.response.set_cookie(key, value)
0
     end
...
48
49
50
51
 
52
53
54
...
48
49
50
 
51
52
53
54
0
@@ -48,7 +48,7 @@
0
         s.rdoc_options << '--title' << 'Mack' << '--main' << 'README' << '--line-numbers' << "--inline-source"
0
         
0
         s.add_dependency("rack", "0.3.0")
0
- s.add_dependency("mack_ruby_core_extensions", "0.1.25")
0
+ s.add_dependency("mack_ruby_core_extensions", "0.1.27")
0
         s.add_dependency("application_configuration", "1.2.2")
0
         s.add_dependency("cachetastic", "1.4.2")
0
         s.add_dependency("log4r", "1.0.5")

Comments

    No one has commented yet.