patron 0.4.2 → 0.4.3

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/Rakefile CHANGED
@@ -94,8 +94,8 @@ task :shell => :compile do
94
94
  end
95
95
 
96
96
  Rake::RDocTask.new do |rdoc|
97
- rdoc.rdoc_dir = 'doc'
98
- rdoc.title = "Patron documentation"
97
+ rdoc.rdoc_dir = 'rdoc'
98
+ rdoc.title = 'Patron documentation'
99
99
  rdoc.main = 'README.txt'
100
100
  rdoc.options << '--line-numbers' << '--inline-source'
101
101
  rdoc.rdoc_files.include('README.txt')
@@ -126,6 +126,9 @@ Spec::Rake::SpecTask.new('spec:rcov') do |t|
126
126
  t.rcov_opts << '--exclude /Library/Ruby/Gems'
127
127
  end
128
128
 
129
- Jeweler::RubyforgeTasks.new
129
+ Jeweler::RubyforgeTasks.new do |t|
130
+ t.remote_doc_path = ''
131
+ t.doc_task = :yardoc
132
+ end
130
133
 
131
134
  task :default => :spec
@@ -40,4 +40,6 @@ if CONFIG['CC'] =~ /gcc/
40
40
  $CFLAGS << ' -Wall'
41
41
  end
42
42
 
43
+ $defs.push("-DHAVE_TBR") if have_func('rb_thread_blocking_region')
44
+
43
45
  create_makefile 'patron/session_ext'
@@ -274,6 +274,12 @@ static void set_options_from_request(VALUE self, VALUE request) {
274
274
  curl_easy_setopt(curl, CURLOPT_HTTPAUTH, rb_iv_get(request, "@auth_type"));
275
275
  curl_easy_setopt(curl, CURLOPT_USERPWD, StringValuePtr(credentials));
276
276
  }
277
+
278
+ VALUE insecure = rb_iv_get(request, "@insecure");
279
+ if(!NIL_P(insecure)) {
280
+ curl_easy_setopt(curl, CURLOPT_SSL_VERIFYPEER, 0);
281
+ curl_easy_setopt(curl, CURLOPT_SSL_VERIFYHOST, 1);
282
+ }
277
283
  }
278
284
 
279
285
  // Use the info in a Curl handle to create a new Response object.
@@ -334,7 +340,11 @@ static VALUE perform_request(VALUE self) {
334
340
  curl_easy_setopt(curl, CURLOPT_WRITEDATA, body_buffer);
335
341
  }
336
342
 
343
+ #ifdef HAVE_TBR
344
+ CURLcode ret = rb_thread_blocking_region(curl_easy_perform, curl, RUBY_UBF_IO, 0);
345
+ #else
337
346
  CURLcode ret = curl_easy_perform(curl);
347
+ #endif
338
348
  if (CURLE_OK == ret) {
339
349
  VALUE response = create_response(curl);
340
350
  if (!NIL_P(body_buffer)) {
@@ -40,7 +40,7 @@ module Patron
40
40
  @max_redirects = -1
41
41
  end
42
42
 
43
- attr_accessor :url, :username, :password, :file_name, :proxy, :auth_type
43
+ attr_accessor :url, :username, :password, :file_name, :proxy, :auth_type, :insecure
44
44
  attr_reader :action, :timeout, :connect_timeout, :max_redirects, :headers
45
45
  attr_reader :auth_type
46
46
 
@@ -88,7 +88,7 @@ module Patron
88
88
  end
89
89
 
90
90
  def timeout=(new_timeout)
91
- if new_timeout.to_i < 1
91
+ if new_timeout && new_timeout.to_i < 1
92
92
  raise ArgumentError, "Timeout must be a positive integer greater than 0"
93
93
  end
94
94
 
@@ -96,7 +96,7 @@ module Patron
96
96
  end
97
97
 
98
98
  def connect_timeout=(new_timeout)
99
- if new_timeout.to_i < 1
99
+ if new_timeout && new_timeout.to_i < 1
100
100
  raise ArgumentError, "Timeout must be a positive integer greater than 0"
101
101
  end
102
102
 
@@ -60,6 +60,9 @@ module Patron
60
60
  # @see Patron::Request#auth_type
61
61
  attr_accessor :auth_type
62
62
 
63
+ # Does this session stricly verify SSL certificates?
64
+ attr_accessor :insecure
65
+
63
66
  private :ext_initialize, :handle_request, :enable_cookie_session
64
67
 
65
68
  # Create a new Session object.
@@ -168,6 +171,7 @@ module Patron
168
171
  req.file_name = options[:file]
169
172
  req.proxy = proxy
170
173
  req.auth_type = auth_type
174
+ req.insecure = insecure
171
175
 
172
176
  req.url = self.base_url.to_s + url.to_s
173
177
  raise ArgumentError, "Empty URL" if req.url.empty?
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: patron
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.2
4
+ version: 0.4.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Phillip Toland
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-08-13 00:00:00 -05:00
12
+ date: 2009-08-30 00:00:00 -05:00
13
13
  default_executable:
14
14
  dependencies: []
15
15