pretty_proxy 3.0.0 → 3.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/pretty_proxy.rb +5 -6
  3. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 9ba185c1e9ef80173adf3ed23ad9b0ec056e305e
4
- data.tar.gz: 4af0397bcdcaa6cd5baa7a2ea664e1ba1e734449
3
+ metadata.gz: 4f0b7cd40975e96c78486559c56a14332c80c480
4
+ data.tar.gz: 36e64c2a281cf96d487b4258a096204f4f1bc9da
5
5
  SHA512:
6
- metadata.gz: a3f0e0c339617821d7122b1cfe8784e34f17b1f4c70e628c0f670061b71b8ba900cf32c7a202fe26b998b26b182312c50001810f36378b7456e73dec5db0ff74
7
- data.tar.gz: da92cb376d0975d95faf9ab262b24405ebd2156da6d4a0170ab693e2d73247c7d7b2eafd1482005eb24d88b037e368966e2ef02cf3841334493c390a2f63a4a5
6
+ metadata.gz: dd0cd6022492f5b31122b58b52f8f907674b8c55c37f5d38dbc510d19f59904bdcab62714b35884670a0047f54169bce43c4c24ab7fc31646fd434a29079c650
7
+ data.tar.gz: 164ea3a9431730971635076a2173799fa87e555f35f0f5fc2aeba73220e903154c4ac122da8b670c8cafdc7f7d7449938afdeb0300e8684211e13f780d46ab30
data/lib/pretty_proxy.rb CHANGED
@@ -3,7 +3,6 @@ require 'nokogiri'
3
3
  require 'rack'
4
4
  require 'rack-proxy'
5
5
  require 'addressable/uri'
6
- require 'uri'
7
6
 
8
7
  # The PrettyProxy class aggregate and validate the configuration of a
9
8
  # proxy based in simple pretty url oriented rewriting rules. It's too
@@ -245,13 +244,13 @@ class PrettyProxy < Rack::Proxy
245
244
  env = env.clone
246
245
  url_requested_to_proxy = Rack::Request.new(env).url
247
246
  # Using URI, and not Addressable::URI because the port value is incorrect in the last
248
- unproxified_url = URI(unproxify_url(url_requested_to_proxy))
247
+ unproxified_url = Addressable::URI.parse(unproxify_url(url_requested_to_proxy))
249
248
 
250
249
  if env['HTTP_HOST']
251
250
  env['HTTP_HOST'] = unproxified_url.host
252
251
  end
253
252
  env['SERVER_NAME'] = unproxified_url.host
254
- env['SERVER_PORT'] = unproxified_url.port.to_s
253
+ env['SERVER_PORT'] = unproxified_url.inferred_port.to_s
255
254
 
256
255
  if env['SCRIPT_NAME'].empty? && !env['PATH_INFO'].empty?
257
256
  env['PATH_INFO'] = unproxified_url.path
@@ -423,9 +422,9 @@ class PrettyProxy < Rack::Proxy
423
422
  module Utils
424
423
  # TODO: check if isn't the case of change this for 'u1.site == u2.site'
425
424
  def self.same_domain?(u1, u2)
426
- u1.scheme == u2.scheme &&
427
- u1.host == u2.host &&
428
- u1.port == u2.port
425
+ u1.normalized_scheme == u2.normalized_scheme &&
426
+ u1.normalized_host == u2.normalized_host &&
427
+ u1.normalized_port == u2.normalized_port
429
428
  end
430
429
 
431
430
  def self.validate_proxy_path(proxy_path)
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pretty_proxy
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.0.0
4
+ version: 3.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Henrique Becker
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-05-29 00:00:00.000000000 Z
11
+ date: 2013-05-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: nokogiri