puffing-billy 0.4.0 → 0.4.1

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 17920d6438879d1d259e39e392c06bd47b42fce5
4
- data.tar.gz: c9637100ed8fe09ac260dc2c29fe3047975e9a69
3
+ metadata.gz: 6557e02e504855ec7a7776eeee317695021c9e50
4
+ data.tar.gz: c25a26247ee30db7daa8158f739503b19848615f
5
5
  SHA512:
6
- metadata.gz: 4eb515c5510665d687778a9672ab955fade8c6fb2c4970056e6122c8688b01755c910e675929588c519b77a9f41ca4f799e0de33e6c5eb0656a286f52aa255ae
7
- data.tar.gz: b33a22eb955333f85094a73ffeaf7a59416bdef8b87686815d50329e15619ba70c9dd3bbfe913f47a7805c830bab4f85d266a5d66eaa7845763683ca7d223a55
6
+ metadata.gz: 94a428edbe74084084326f1daad96992928f8c22dcc6e52d0c95bc153e3d4296bd754f3bd3dfb02d1a435729e62e46726f5ed772fd6a646ce9c8e95a1ae0452d
7
+ data.tar.gz: c0d6395651e775a9bde1a67cb164617fceb901baa758e204dc4fc5adea37932cd68a0095471906f5d31fbaae3868c9b9092d4cd8e43705553f781d1266836357
@@ -1,4 +1,10 @@
1
+ v0.4.1, 2015-01-02
2
+ ------------------
3
+
4
+ * Use Addressable for all URI parsing
5
+
1
6
  v0.4.0, 2015-01-02
7
+ ------------------
2
8
 
3
9
  * Add new configuration to merge cache hits by URL regex (#76)
4
10
  * Allow pipes in URLs by switching to Addressable (#84)
@@ -16,7 +22,7 @@ v0.3.0, 2014-12-29
16
22
  * Adds EventMachine timeout configuration (#57)
17
23
  * Support dynamic jsonp with params (#58)
18
24
  * Writing error messages to the logger rather than stdout (#69)
19
- * Don't recommend changing javascript_driver config (#70)
25
+ * Do not recommend changing javascript_driver config (#70)
20
26
  * README link pointing at wrong target (#73)
21
27
  * Adding example config to README for playing nicely with Webmock, VCR (#74)
22
28
  * Make dynamic_jsonp regex less brittle (#81)
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- puffing-billy (0.4.0)
4
+ puffing-billy (0.4.1)
5
5
  addressable
6
6
  em-http-request
7
7
  em-synchrony
@@ -1,4 +1,5 @@
1
1
  require 'billy/handlers/handler'
2
+ require 'addressable/uri'
2
3
  require 'cgi'
3
4
 
4
5
  module Billy
@@ -35,7 +36,7 @@ module Billy
35
36
  private
36
37
 
37
38
  def replace_response_callback(response, url)
38
- request_uri = URI::parse(url)
39
+ request_uri = Addressable::URI.parse(url)
39
40
  if request_uri.query
40
41
  params = CGI::parse(request_uri.query)
41
42
  if params['callback'].any? and response[:content].match(/\w+\(/)
@@ -1,4 +1,5 @@
1
1
  require 'billy/handlers/handler'
2
+ require 'addressable/uri'
2
3
  require 'eventmachine'
3
4
  require 'em-synchrony/em-http'
4
5
 
@@ -73,7 +74,7 @@ module Billy
73
74
  def disabled_request?(url)
74
75
  return false unless Billy.config.non_whitelisted_requests_disabled
75
76
 
76
- uri = URI(url)
77
+ uri = Addressable::URI.parse(url)
77
78
  # In isolated environments, you may want to stop the request from happening
78
79
  # or else you get "getaddrinfo: Name or service not known" errors
79
80
  blacklisted_path?(uri.path) || !whitelisted_url?(uri)
@@ -86,7 +87,7 @@ module Billy
86
87
  def cacheable?(url, headers, status)
87
88
  return false unless Billy.config.cache
88
89
 
89
- url = URI(url)
90
+ url = Addressable::URI.parse(url)
90
91
  # Cache the responses if they aren't whitelisted host[:port]s but always cache blacklisted paths on any hosts
91
92
  cacheable_status?(status) && (!whitelisted_url?(url) || blacklisted_path?(url.path))
92
93
  end
@@ -1,4 +1,5 @@
1
1
  require 'billy/handlers/handler'
2
+ require 'addressable/uri'
2
3
 
3
4
  module Billy
4
5
  class StubHandler
@@ -7,7 +8,7 @@ module Billy
7
8
  def handle_request(method, url, headers, body)
8
9
  if handles_request?(method, url, headers, body)
9
10
  if (stub = find_stub(method, url))
10
- query_string = URI.parse(url).query || ""
11
+ query_string = Addressable::URI.parse(url).query || ""
11
12
  params = CGI.parse(query_string)
12
13
  stub.call(params, headers, body).tap do |response|
13
14
  Billy.log(:info, "puffing-billy: STUB #{method} for '#{url}'")
@@ -1,4 +1,3 @@
1
- require 'uri'
2
1
  require 'json'
3
2
 
4
3
  module Billy
@@ -37,4 +36,4 @@ module Billy
37
36
  JSONUtils::sort_hash_keys(JSON.parse(json_str, symbolize_names: true)).to_json
38
37
  end
39
38
  end
40
- end
39
+ end
@@ -1,5 +1,4 @@
1
1
  require 'cgi'
2
- require 'uri'
3
2
  require 'eventmachine'
4
3
 
5
4
  module Billy
@@ -1,4 +1,4 @@
1
- require 'uri'
1
+ require 'addressable/uri'
2
2
  require 'eventmachine'
3
3
  require 'http/parser'
4
4
  require 'em-http'
@@ -36,7 +36,7 @@ module Billy
36
36
  restart_with_ssl(@parser.request_url)
37
37
  else
38
38
  if @ssl
39
- uri = URI.parse(@parser.request_url)
39
+ uri = Addressable::URI.parse(@parser.request_url)
40
40
  @url = "https://#{@ssl}#{[uri.path,uri.query].compact.join('?')}"
41
41
  else
42
42
  @url = @parser.request_url
@@ -1,3 +1,3 @@
1
1
  module Billy
2
- VERSION = "0.4.0"
2
+ VERSION = "0.4.1"
3
3
  end
@@ -1,3 +1,5 @@
1
+ require 'addressable/uri'
2
+
1
3
  namespace :cache do
2
4
 
3
5
  desc 'Print out all cache file information'
@@ -57,7 +59,7 @@ namespace :cache do
57
59
 
58
60
  Dir.glob(cache_path+file_pattern) do |filename|
59
61
  data = load_cache_file(filename)
60
- url = URI(data[:url])
62
+ url = Addressable::URI.parse(data[:url])
61
63
  data[:url_path] = "#{url.path}#{url.query ? '?'+url.query : ''}#{url.fragment ? '#'+url.fragment : ''}"
62
64
  data[:filename] = filename.gsub(Rails.root.to_s+'/','')
63
65
  cache_array << data
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: puffing-billy
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.0
4
+ version: 0.4.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Olly Smith
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-01-02 00:00:00.000000000 Z
11
+ date: 2015-01-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rspec