rest-client 1.6.14 → 2.0.2

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.
Files changed (65) hide show
  1. checksums.yaml +5 -5
  2. data/.gitignore +6 -6
  3. data/.rspec +2 -1
  4. data/.rubocop-disables.yml +384 -0
  5. data/.rubocop.yml +3 -0
  6. data/.travis.yml +46 -1
  7. data/AUTHORS +28 -5
  8. data/Gemfile +5 -1
  9. data/LICENSE +21 -0
  10. data/README.md +784 -0
  11. data/Rakefile +95 -12
  12. data/bin/restclient +11 -12
  13. data/history.md +180 -16
  14. data/lib/restclient.rb +25 -11
  15. data/lib/restclient/abstract_response.rb +171 -51
  16. data/lib/restclient/exceptions.rb +102 -56
  17. data/lib/restclient/params_array.rb +72 -0
  18. data/lib/restclient/payload.rb +43 -74
  19. data/lib/restclient/platform.rb +22 -2
  20. data/lib/restclient/raw_response.rb +7 -3
  21. data/lib/restclient/request.rb +672 -179
  22. data/lib/restclient/resource.rb +6 -7
  23. data/lib/restclient/response.rb +64 -10
  24. data/lib/restclient/utils.rb +235 -0
  25. data/lib/restclient/version.rb +2 -1
  26. data/lib/restclient/windows.rb +8 -0
  27. data/lib/restclient/windows/root_certs.rb +105 -0
  28. data/rest-client.gemspec +16 -11
  29. data/rest-client.windows.gemspec +19 -0
  30. data/spec/helpers.rb +22 -0
  31. data/spec/integration/_lib.rb +1 -0
  32. data/spec/integration/capath_verisign/415660c1.0 +14 -0
  33. data/spec/integration/capath_verisign/7651b327.0 +14 -0
  34. data/spec/integration/capath_verisign/README +8 -0
  35. data/spec/integration/capath_verisign/verisign.crt +14 -0
  36. data/spec/integration/httpbin_spec.rb +87 -0
  37. data/spec/integration/integration_spec.rb +125 -0
  38. data/spec/integration/request_spec.rb +72 -20
  39. data/spec/spec_helper.rb +29 -0
  40. data/spec/unit/_lib.rb +1 -0
  41. data/spec/unit/abstract_response_spec.rb +145 -0
  42. data/spec/unit/exceptions_spec.rb +108 -0
  43. data/spec/{master_shake.jpg → unit/master_shake.jpg} +0 -0
  44. data/spec/unit/params_array_spec.rb +36 -0
  45. data/spec/{payload_spec.rb → unit/payload_spec.rb} +73 -54
  46. data/spec/{raw_response_spec.rb → unit/raw_response_spec.rb} +5 -4
  47. data/spec/unit/request2_spec.rb +54 -0
  48. data/spec/unit/request_spec.rb +1250 -0
  49. data/spec/unit/resource_spec.rb +134 -0
  50. data/spec/unit/response_spec.rb +241 -0
  51. data/spec/unit/restclient_spec.rb +79 -0
  52. data/spec/unit/utils_spec.rb +147 -0
  53. data/spec/unit/windows/root_certs_spec.rb +22 -0
  54. metadata +143 -53
  55. data/README.rdoc +0 -300
  56. data/lib/restclient/net_http_ext.rb +0 -55
  57. data/spec/abstract_response_spec.rb +0 -85
  58. data/spec/base.rb +0 -13
  59. data/spec/exceptions_spec.rb +0 -98
  60. data/spec/integration_spec.rb +0 -38
  61. data/spec/request2_spec.rb +0 -35
  62. data/spec/request_spec.rb +0 -528
  63. data/spec/resource_spec.rb +0 -136
  64. data/spec/response_spec.rb +0 -169
  65. data/spec/restclient_spec.rb +0 -73
data/Rakefile CHANGED
@@ -1,38 +1,122 @@
1
- begin
2
- # optionally load `rake build/install/release tasks'
3
- require 'bundler/gem_tasks'
4
- rescue LoadError
1
+ # load `rake build/install/release tasks'
2
+ require 'bundler/setup'
3
+ require_relative './lib/restclient/version'
4
+
5
+ namespace :ruby do
6
+ Bundler::GemHelper.install_tasks(:name => 'rest-client')
5
7
  end
6
8
 
7
9
  require "rspec/core/rake_task"
8
10
 
9
11
  desc "Run all specs"
10
- task :spec => ["spec:unit", "spec:integration"]
12
+ RSpec::Core::RakeTask.new('spec')
11
13
 
12
14
  desc "Run unit specs"
13
15
  RSpec::Core::RakeTask.new('spec:unit') do |t|
14
- t.pattern = ['spec/*_spec.rb']
16
+ t.pattern = 'spec/unit/*_spec.rb'
15
17
  end
16
18
 
17
19
  desc "Run integration specs"
18
20
  RSpec::Core::RakeTask.new('spec:integration') do |t|
19
- t.pattern = ['spec/integration/*_spec.rb']
21
+ t.pattern = 'spec/integration/*_spec.rb'
20
22
  end
21
23
 
22
24
  desc "Print specdocs"
23
25
  RSpec::Core::RakeTask.new(:doc) do |t|
24
26
  t.rspec_opts = ["--format", "specdoc", "--dry-run"]
25
- t.pattern = ['spec/*_spec.rb']
27
+ t.pattern = 'spec/**/*_spec.rb'
26
28
  end
27
29
 
28
30
  desc "Run all examples with RCov"
29
31
  RSpec::Core::RakeTask.new('rcov') do |t|
30
- t.pattern = ['spec/*_spec.rb']
32
+ t.pattern = 'spec/*_spec.rb'
31
33
  t.rcov = true
32
34
  t.rcov_opts = ['--exclude', 'examples']
33
35
  end
34
36
 
35
- task :default => :spec
37
+ desc 'Regenerate authors file'
38
+ task :authors do
39
+ Dir.chdir(File.dirname(__FILE__)) do
40
+ File.open('AUTHORS', 'w') do |f|
41
+ f.write( <<-EOM
42
+ The Ruby REST Client would not be what it is today without the help of
43
+ the following kind souls:
44
+
45
+ EOM
46
+ )
47
+ end
48
+
49
+ sh 'git shortlog -s | cut -f 2 >> AUTHORS'
50
+ end
51
+ end
52
+
53
+ task :default do
54
+ sh 'rake -T'
55
+ end
56
+
57
+ def alias_task(alias_task, original)
58
+ desc "Alias for rake #{original}"
59
+ task alias_task, Rake.application[original].arg_names => original
60
+ end
61
+ alias_task(:test, :spec)
62
+
63
+ ############################
64
+
65
+ WindowsPlatforms = %w{x86-mingw32 x64-mingw32 x86-mswin32}
66
+
67
+ namespace :all do
68
+
69
+ desc "Build rest-client #{RestClient::VERSION} for all platforms"
70
+ task :build => ['ruby:build'] + \
71
+ WindowsPlatforms.map {|p| "windows:#{p}:build"}
72
+
73
+ desc "Create tag v#{RestClient::VERSION} and for all platforms build and push " \
74
+ "rest-client #{RestClient::VERSION} to Rubygems"
75
+ task :release => ['build', 'ruby:release'] + \
76
+ WindowsPlatforms.map {|p| "windows:#{p}:push"}
77
+
78
+ end
79
+
80
+ namespace :windows do
81
+ spec_path = File.join(File.dirname(__FILE__), 'rest-client.windows.gemspec')
82
+
83
+ WindowsPlatforms.each do |platform|
84
+ namespace platform do
85
+ gem_filename = "rest-client-#{RestClient::VERSION}-#{platform}.gem"
86
+ base = File.dirname(__FILE__)
87
+ pkg_dir = File.join(base, 'pkg')
88
+ gem_file_path = File.join(pkg_dir, gem_filename)
89
+
90
+ desc "Build #{gem_filename} into the pkg directory"
91
+ task 'build' do
92
+ orig_platform = ENV['BUILD_PLATFORM']
93
+ begin
94
+ ENV['BUILD_PLATFORM'] = platform
95
+
96
+ sh("gem build -V #{spec_path}") do |ok, res|
97
+ if ok
98
+ FileUtils.mkdir_p(pkg_dir)
99
+ FileUtils.mv(File.join(base, gem_filename), pkg_dir)
100
+ Bundler.ui.confirm("rest-client #{RestClient::VERSION} " \
101
+ "built to pkg/#{gem_filename}")
102
+ else
103
+ abort "Command `gem build` failed: #{res}"
104
+ end
105
+ end
106
+
107
+ ensure
108
+ ENV['BUILD_PLATFORM'] = orig_platform
109
+ end
110
+ end
111
+
112
+ desc "Push #{gem_filename} to Rubygems"
113
+ task 'push' do
114
+ sh("gem push #{gem_file_path}")
115
+ end
116
+ end
117
+ end
118
+
119
+ end
36
120
 
37
121
  ############################
38
122
 
@@ -43,7 +127,6 @@ Rake::RDocTask.new do |t|
43
127
  t.title = "rest-client, fetch RESTful resources effortlessly"
44
128
  t.options << '--line-numbers' << '--inline-source' << '-A cattr_accessor=object'
45
129
  t.options << '--charset' << 'utf-8'
46
- t.rdoc_files.include('README.rdoc')
130
+ t.rdoc_files.include('README.md')
47
131
  t.rdoc_files.include('lib/*.rb')
48
132
  end
49
-
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env ruby
2
2
 
3
- $:.unshift File.dirname(__FILE__) + "/../lib"
3
+ $LOAD_PATH.unshift File.dirname(__FILE__) + "/../lib"
4
4
 
5
5
  require 'rubygems'
6
6
  require 'restclient'
@@ -26,10 +26,10 @@ end
26
26
 
27
27
  config = YAML.load(File.read(ENV['HOME'] + "/.restclient")) rescue {}
28
28
 
29
- @url, @username, @password = if c = config[@url]
30
- [c['url'], c['username'], c['password']]
29
+ if (c = config[@url])
30
+ @url, @username, @password = [c['url'], c['username'], c['password']]
31
31
  else
32
- [@url, * ARGV]
32
+ @url, @username, @password = [@url, * ARGV]
33
33
  end
34
34
 
35
35
  usage("invalid url '#{@url}") unless @url =~ /^https?/
@@ -50,17 +50,15 @@ if @verb
50
50
  end
51
51
  exit 0
52
52
  rescue RestClient::Exception => e
53
- puts e.response.body if e.respond_to? :response
53
+ puts e.response.body if e.respond_to?(:response) && e.response
54
54
  raise
55
55
  end
56
56
  end
57
57
 
58
58
  POSSIBLE_VERBS.each do |m|
59
- eval <<-end_eval
60
- def #{m}(path, *args, &b)
61
- r[path].#{m}(*args, &b)
62
- end
63
- end_eval
59
+ define_method(m.to_sym) do |path, *args, &b|
60
+ r[path].public_send(m.to_sym, *args, &b)
61
+ end
64
62
  end
65
63
 
66
64
  def method_missing(s, * args, & b)
@@ -79,11 +77,12 @@ end
79
77
  require 'irb'
80
78
  require 'irb/completion'
81
79
 
82
- if File.exists? ".irbrc"
80
+ if File.exist? ".irbrc"
83
81
  ENV['IRBRC'] = ".irbrc"
84
82
  end
85
83
 
86
- if File.exists?(File.expand_path(rcfile = "~/.restclientrc"))
84
+ rcfile = File.expand_path("~/.restclientrc")
85
+ if File.exist?(rcfile)
87
86
  load(rcfile)
88
87
  end
89
88
 
data/history.md CHANGED
@@ -1,19 +1,183 @@
1
- # 1.6.14
2
-
3
- - This release is unchanged from 1.6.9. It was published in order to supersede
4
- the malicious 1.6.10-13 versions, even for users who are still pinning to the
5
- legacy 1.6.x series. All users are encouraged to upgrade to rest-client 2.x.
6
-
7
- # 1.6.10, 1.6.11, 1.6.12, 1.6.13 (CVE-2019-15224)
8
-
9
- - These versions were pushed by a malicious actor and included a backdoor permitting
10
- remote code execution in Rails environments.
11
- - They were live for about five days before being yanked.
12
- https://github.com/rest-client/rest-client/issues/713
13
-
14
- # 1.6.9
15
-
16
- - Move rdoc to a development dependency
1
+ # 2.0.2
2
+
3
+ - Suppress the header override warning introduced in 2.0.1 if the value is the
4
+ same. There's no conflict if the value is unchanged. (#578)
5
+
6
+ # 2.0.1
7
+
8
+ - Warn if auto-generated headers from the payload, such as Content-Type,
9
+ override headers set by the user. This is usually not what the user wants to
10
+ happen, and can be surprising. (#554)
11
+ - Drop the old check for weak default TLS ciphers, and use the built-in Ruby
12
+ defaults. Ruby versions from Oct. 2014 onward use sane defaults, so this is
13
+ no longer needed. (#573)
14
+
15
+ # 2.0.0
16
+
17
+ This release is largely API compatible, but makes several breaking changes.
18
+
19
+ - Drop support for Ruby 1.9
20
+ - Allow mime-types as new as 3.x (requires ruby 2.0)
21
+ - Respect Content-Type charset header provided by server. Previously,
22
+ rest-client would not override the string encoding chosen by Net::HTTP. Now
23
+ responses that specify a charset will yield a body string in that encoding.
24
+ For example, `Content-Type: text/plain; charset=EUC-JP` will return a String
25
+ encoded with `Encoding::EUC_JP`. (#361)
26
+ - Change exceptions raised on request timeout. Instead of
27
+ `RestClient::RequestTimeout` (which is still used for HTTP 408), network
28
+ timeouts will now raise either `RestClient::Exceptions::ReadTimeout` or
29
+ `RestClient::Exceptions::OpenTimeout`, both of which inherit from
30
+ `RestClient::Exceptions::Timeout`. For backwards compatibility, this still
31
+ inherits from `RestClient::RequestTimeout` so existing uses will still work.
32
+ This may change in a future major release. These new timeout classes also
33
+ make the original wrapped exception available as `#original_exception`.
34
+ - Unify request exceptions under `RestClient::RequestFailed`, which still
35
+ inherits from `ExceptionWithResponse`. Previously, HTTP 304, 401, and 404
36
+ inherited directly from `ExceptionWithResponse` rather than from
37
+ `RequestFailed`. Now _all_ HTTP status code exceptions inherit from both.
38
+ - Rename the `:timeout` request option to `:read_timeout`. When `:timeout` is
39
+ passed, now set both `:read_timeout` and `:open_timeout`.
40
+ - Change default HTTP Accept header to `*/*`
41
+ - Use a more descriptive User-Agent header by default
42
+ - Drop RC4-MD5 from default cipher list
43
+ - Only prepend http:// to URIs without a scheme
44
+ - Fix some support for using IPv6 addresses in URLs (still affected by Ruby
45
+ 2.0+ bug https://bugs.ruby-lang.org/issues/9129, with the fix expected to be
46
+ backported to 2.0 and 2.1)
47
+ - `Response` objects are now a subclass of `String` rather than a `String` that
48
+ mixes in the response functionality. Most of the methods remain unchanged,
49
+ but this makes it much easier to understand what is happening when you look
50
+ at a RestClient response object. There are a few additional changes:
51
+ - Response objects now implement `.inspect` to make this distinction clearer.
52
+ - `Response#to_i` will now behave like `String#to_i` instead of returning the
53
+ HTTP response code, which was very surprising behavior.
54
+ - `Response#body` and `#to_s` will now return a true `String` object rather
55
+ than self. Previously there was no easy way to get the true `String`
56
+ response instead of the Frankenstein response string object with
57
+ AbstractResponse mixed in.
58
+ - Response objects no longer accept an extra request args hash, but instead
59
+ access request args directly from the request object, which reduces
60
+ confusion and duplication.
61
+ - Handle multiple HTTP response headers with the same name (except for
62
+ Set-Cookie, which is special) by joining the values with a comma space,
63
+ compliant with RFC 7230
64
+ - Rewrite cookie support to be much smarter and to use cookie jars consistently
65
+ for requests, responses, and redirection in order to resolve long-standing
66
+ complaints about the previously broken behavior: (#498)
67
+ - The `:cookies` option may now be a Hash of Strings, an Array of
68
+ HTTP::Cookie objects, or a full HTTP::CookieJar.
69
+ - Add `RestClient::Request#cookie_jar` and reimplement `Request#cookies` to
70
+ be a wrapper around the cookie jar.
71
+ - Still support passing the `:cookies` option in the headers hash, but now
72
+ raise ArgumentError if that option is also passed to `Request#initialize`.
73
+ - Warn if both `:cookies` and a `Cookie` header are supplied.
74
+ - Use the `Request#cookie_jar` as the basis for `Response#cookie_jar`,
75
+ creating a copy of the jar and adding any newly received cookies.
76
+ - When following redirection, also use this same strategy so that cookies
77
+ from the original request are carried through in a standards-compliant way
78
+ by the cookie jar.
79
+ - Don't set basic auth header if explicit `Authorization` header is specified
80
+ - Add `:proxy` option to requests, which can be used for thread-safe
81
+ per-request proxy configuration, overriding `RestClient.proxy`
82
+ - Allow overriding `ENV['http_proxy']` to disable proxies by setting
83
+ `RestClient.proxy` to a falsey value. Previously there was no way in Ruby 2.x
84
+ to turn off a proxy specified in the environment without changing `ENV`.
85
+ - Add actual support for streaming request payloads. Previously rest-client
86
+ would call `.to_s` even on RestClient::Payload::Streamed objects. Instead,
87
+ treat any object that responds to `.read` as a streaming payload and pass it
88
+ through to `.body_stream=` on the Net:HTTP object. This massively reduces the
89
+ memory required for large file uploads.
90
+ - Changes to redirection behavior: (#381, #484)
91
+ - Remove `RestClient::MaxRedirectsReached` in favor of the normal
92
+ `ExceptionWithResponse` subclasses. This makes the response accessible on
93
+ the exception object as `.response`, making it possible for callers to tell
94
+ what has actually happened when the redirect limit is reached.
95
+ - When following HTTP redirection, store a list of each previous response on
96
+ the response object as `.history`. This makes it possible to access the
97
+ original response headers and body before the redirection was followed.
98
+ - Follow redirection consistently, regardless of whether the HTTP method was
99
+ passed as a symbol or string. Under the hood rest-client now normalizes the
100
+ HTTP request method to a lowercase string.
101
+ - Add `:before_execution_proc` option to `RestClient::Request`. This makes it
102
+ possible to add procs like `RestClient.add_before_execution_proc` to a single
103
+ request without global state.
104
+ - Run tests on Travis's beta OS X support.
105
+ - Make `Request#transmit` a private method, along with a few others.
106
+ - Refactor URI parsing to happen earlier, in Request initialization.
107
+ - Improve consistency and functionality of complex URL parameter handling:
108
+ - When adding URL params, handle URLs that already contain params.
109
+ - Add new convention for handling URL params containing deeply nested arrays
110
+ and hashes, unify handling of null/empty values, and use the same code for
111
+ GET and POST params. (#437)
112
+ - Add the RestClient::ParamsArray class, a simple array-like container that
113
+ can be used to pass multiple keys with same name or keys where the ordering
114
+ is significant.
115
+ - Add a few more exception classes for obscure HTTP status codes.
116
+ - Multipart: use a much more robust multipart boundary with greater entropy.
117
+ - Make `RestClient::Payload::Base#inspect` stop pretending to be a String.
118
+ - Add `Request#redacted_uri` and `Request#redacted_url` to display the URI
119
+ with any password redacted.
120
+
121
+ # 2.0.0.rc1
122
+
123
+ Changes in the release candidate that did not persist through the final 2.0.0
124
+ release:
125
+ - RestClient::Exceptions::Timeout was originally going to be a direct subclass
126
+ of RestClient::Exception in the release candidate. This exception tree was
127
+ made a subclass of RestClient::RequestTimeout prior to the final release.
128
+
129
+ # 1.8.0
130
+
131
+ - Security: implement standards compliant cookie handling by adding a
132
+ dependency on http-cookie. This breaks compatibility, but was necessary to
133
+ address a session fixation / cookie disclosure vulnerability.
134
+ (#369 / CVE-2015-1820)
135
+
136
+ Previously, any Set-Cookie headers found in an HTTP 30x response would be
137
+ sent to the redirection target, regardless of domain. Responses now expose a
138
+ cookie jar and respect standards compliant domain / path flags in Set-Cookie
139
+ headers.
140
+
141
+ # 1.7.3
142
+
143
+ - Security: redact password in URI from logs (#349 / OSVDB-117461)
144
+ - Drop monkey patch on MIME::Types (added `type_for_extension` method, use
145
+ the public interface instead.
146
+
147
+ # 1.7.2
148
+
149
+ - Ignore duplicate certificates in CA store on Windows
150
+
151
+ # 1.7.1
152
+
153
+ - Relax mime-types dependency to continue supporting mime-types 1.x series.
154
+ There seem to be a large number of popular gems that have depended on
155
+ mime-types '~> 1.16' until very recently.
156
+ - Improve urlencode performance
157
+ - Clean up a number of style points
158
+
159
+ # 1.7.0
160
+
161
+ - This release drops support for Ruby 1.8.7 and breaks compatibility in a few
162
+ other relatively minor ways
163
+ - Upgrade to mime-types ~> 2.0
164
+ - Don't CGI.unescape cookie values sent to the server (issue #89)
165
+ - Add support for reading credentials from netrc
166
+ - Lots of SSL changes and enhancements: (#268)
167
+ - Enable peer verification by default (setting `VERIFY_PEER` with OpenSSL)
168
+ - By default, use the system default certificate store for SSL verification,
169
+ even on Windows (this uses a separate Windows build that pulls in ffi)
170
+ - Add support for SSL `ca_path`
171
+ - Add support for SSL `cert_store`
172
+ - Add support for SSL `verify_callback` (with some caveats for jruby, OS X, #277)
173
+ - Add support for SSL ciphers, and choose secure ones by default
174
+ - Run tests under travis
175
+ - Several other bugfixes and test improvements
176
+ - Convert Errno::ETIMEDOUT to RestClient::RequestTimeout
177
+ - Handle more HTTP response codes from recent standards
178
+ - Save raw responses to binary mode tempfile (#110)
179
+ - Disable timeouts with :timeout => nil rather than :timeout => -1
180
+ - Drop all Net::HTTP monkey patches
17
181
 
18
182
  # 1.6.8
19
183
 
@@ -1,24 +1,21 @@
1
+ require 'net/http'
2
+ require 'openssl'
3
+ require 'stringio'
1
4
  require 'uri'
2
5
  require 'zlib'
3
- require 'stringio'
4
-
5
- begin
6
- require 'net/https'
7
- rescue LoadError => e
8
- raise e unless RUBY_PLATFORM =~ /linux/
9
- raise LoadError, "no such file to load -- net/https. Try running apt-get install libopenssl-ruby"
10
- end
11
6
 
12
7
  require File.dirname(__FILE__) + '/restclient/version'
13
8
  require File.dirname(__FILE__) + '/restclient/platform'
14
9
  require File.dirname(__FILE__) + '/restclient/exceptions'
10
+ require File.dirname(__FILE__) + '/restclient/utils'
15
11
  require File.dirname(__FILE__) + '/restclient/request'
16
12
  require File.dirname(__FILE__) + '/restclient/abstract_response'
17
13
  require File.dirname(__FILE__) + '/restclient/response'
18
14
  require File.dirname(__FILE__) + '/restclient/raw_response'
19
15
  require File.dirname(__FILE__) + '/restclient/resource'
16
+ require File.dirname(__FILE__) + '/restclient/params_array'
20
17
  require File.dirname(__FILE__) + '/restclient/payload'
21
- require File.dirname(__FILE__) + '/restclient/net_http_ext'
18
+ require File.dirname(__FILE__) + '/restclient/windows'
22
19
 
23
20
  # This module's static methods are the entry point for using the REST client.
24
21
  #
@@ -94,8 +91,24 @@ module RestClient
94
91
  Request.execute(:method => :options, :url => url, :headers => headers, &block)
95
92
  end
96
93
 
97
- class << self
98
- attr_accessor :proxy
94
+ # A global proxy URL to use for all requests. This can be overridden on a
95
+ # per-request basis by passing `:proxy` to RestClient::Request.
96
+ def self.proxy
97
+ @proxy ||= nil
98
+ end
99
+
100
+ def self.proxy=(value)
101
+ @proxy = value
102
+ @proxy_set = true
103
+ end
104
+
105
+ # Return whether RestClient.proxy was set explicitly. We use this to
106
+ # differentiate between no value being set and a value explicitly set to nil.
107
+ #
108
+ # @return [Boolean]
109
+ #
110
+ def self.proxy_set?
111
+ @proxy_set ||= false
99
112
  end
100
113
 
101
114
  # Setup the log for RestClient calls.
@@ -155,6 +168,7 @@ module RestClient
155
168
  # Add a Proc to be called before each request in executed.
156
169
  # The proc parameters will be the http request and the request params.
157
170
  def self.add_before_execution_proc &proc
171
+ raise ArgumentError.new('block is required') unless proc
158
172
  @@before_execution_procs << proc
159
173
  end
160
174