shuber-proxy 1.2.3 → 1.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/CHANGELOG CHANGED
@@ -1,3 +1,9 @@
1
+ 2009-05-20 - Sean Huber (shuber@huberry.com)
2
+ * Update date in gemspec so github rebuilds gem
3
+
4
+ 2009-05-18 - Sean Huber (shuber@huberry.com)
5
+ * Fix compatibility issues with actionpack >= 2.2.2
6
+
1
7
  2009-01-24 - Sean Huber (shuber@huberry.com)
2
8
  * Add compatibility for edge/upcoming rails versions
3
9
 
data/README.markdown CHANGED
@@ -5,6 +5,8 @@ A gem/plugin that allows rails applications to dynamically respond to proxied re
5
5
 
6
6
  The original session domain, default host, and relative url root will be restored after each request.
7
7
 
8
+ Requires actionpack version >= 2.0.0
9
+
8
10
 
9
11
  Installation
10
12
  ------------
@@ -45,8 +47,8 @@ Relative Url Root Proxy Setup
45
47
 
46
48
  The client's proxy must forward the request uri header in order for this plugin to automatically set the relative url root correctly. Here is how the client would setup a proxy in apache for the example above:
47
49
 
48
- RewriteRule ^neworders(.*) http://client.example.com/orders$1 [P,E=originalUri:%{REQUEST_URI}]
49
- RequestHeader append X_FORWARDED_URI %{originalUri}e
50
+ RewriteRule ^neworders(.*) http://client.example.com/orders$1 [P,QSA,L,E=originalUri:%{REQUEST_URI}]
51
+ RequestHeader append X_FORWARDED_URI %{originalUri}e e=originalUri
50
52
 
51
53
 
52
54
  Contact
data/Rakefile CHANGED
@@ -3,7 +3,17 @@ require 'rake/testtask'
3
3
  require 'rake/rdoctask'
4
4
 
5
5
  desc 'Default: run the proxy tests'
6
- task :default => :test
6
+ task :default => :test_all_versions
7
+
8
+ desc 'Default: run the proxy tests for all versions of actionpack'
9
+ task :test_all_versions do
10
+ versions = `gem list`.match(/actionpack \((.+)\)/).captures[0].split(/, /).select { |v| v[0,1].to_i > 1 }
11
+ versions.each do |version|
12
+ puts "\n\n============================================================="
13
+ puts "TESTING WITH ACTION PACK VERSION #{version}\n\n"
14
+ system "rake test ACTION_PACK_VERSION=#{version}"
15
+ end
16
+ end
7
17
 
8
18
  desc 'Test the proxy plugin.'
9
19
  Rake::TestTask.new(:test) do |t|
@@ -11,7 +11,10 @@ module Huberry
11
11
  # It will not set the :host option if <tt>options</tt> is not a hash or
12
12
  # if the <tt>ActionController::UrlWriter.default_url_options[:host]</tt> is blank
13
13
  def rewrite_url_with_proxy(options)
14
- options[:host] ||= ::ActionController::UrlWriter.default_url_options[:host] if options.is_a?(Hash) && !::ActionController::UrlWriter.default_url_options[:host].blank?
14
+ if options.is_a?(Hash)
15
+ options[:host] ||= ::ActionController::UrlWriter.default_url_options[:host] unless ::ActionController::UrlWriter.default_url_options[:host].blank?
16
+ options.delete(:original_host)
17
+ end
15
18
  rewrite_url_without_proxy(options)
16
19
  end
17
20
  end
@@ -11,7 +11,10 @@ module Huberry
11
11
  # It will not set the :host option if <tt>options</tt> is not a hash or
12
12
  # if the <tt>ActionController::UrlWriter.default_url_options[:host]</tt> is blank
13
13
  def url_for_with_proxy(options = {})
14
- options[:host] ||= ::ActionController::UrlWriter.default_url_options[:host] if options.is_a?(Hash) && !::ActionController::UrlWriter.default_url_options[:host].blank?
14
+ if options.is_a?(Hash)
15
+ options[:host] ||= ::ActionController::UrlWriter.default_url_options[:host] unless ::ActionController::UrlWriter.default_url_options[:host].blank?
16
+ options.delete(:original_host)
17
+ end
15
18
  url_for_without_proxy(options)
16
19
  end
17
20
  end
data/lib/proxy.rb CHANGED
@@ -9,4 +9,19 @@ ActionController::AbstractRequest.send :include, Huberry::Proxy::ActionControlle
9
9
  ActionController::Base.send :include, Huberry::Proxy::ActionController::Base
10
10
  ActionController::Routing::RouteSet::NamedRouteCollection.send :include, Huberry::Proxy::ActionController::NamedRouteCollection
11
11
  ActionController::UrlRewriter.send :include, Huberry::Proxy::ActionController::UrlRewriter
12
- ActionView::Base.send :include, Huberry::Proxy::ActionView::UrlHelper
12
+ ActionView::Base.send :include, Huberry::Proxy::ActionView::UrlHelper
13
+
14
+ unless ActionController::UrlWriter.respond_to?(:default_url_options)
15
+ ActionController::Base.class_eval do
16
+ include ActionController::UrlWriter
17
+
18
+ def default_url_options_with_backwards_compatibility(*args)
19
+ default_url_options_without_backwards_compatibility
20
+ end
21
+ alias_method_chain :default_url_options, :backwards_compatibility
22
+ end
23
+
24
+ class << ActionController::UrlWriter
25
+ delegate :default_url_options, :default_url_options=, :to => ::ActionController::Base
26
+ end
27
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: shuber-proxy
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.3
4
+ version: 1.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sean Huber
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-01-24 00:00:00 -08:00
12
+ date: 2009-05-20 00:00:00 -07:00
13
13
  default_executable:
14
14
  dependencies: []
15
15