manticore 0.6.1-java → 0.6.2-java

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: f1e6b7d1ea5d4bb60011c89d4b3e7b10abff3b42
4
- data.tar.gz: db35b3f276b9f5040cee58407a16858f291435d6
3
+ metadata.gz: 52e7c6c63c54c59317eb836e5caa6cc1dbb08fc1
4
+ data.tar.gz: 362d618ee0a1e92762bd5acbb9639c0ea18af0e9
5
5
  SHA512:
6
- metadata.gz: e8a1d7749fd671e7f44970067dd67899d5485de989c320baa39ab6f05df886e34148a3ccdd05ec7513792138314d4d37421509a5a7fd6b47231c30f2f862acec
7
- data.tar.gz: f83f8a304ad9c12d94c3b8fd8b5914fded62083a6b90ed61a67e80aa754683ec69fa122e802377f250cc6eaa40f79a09930bb482d5c337cabce3bc799271945c
6
+ metadata.gz: ab0c5c529908001ac420bc3c82234ff9016139024211dc2e1e9111dc71e43b37b6ce92c674a5b67c270329de752e3d33fc9e8cb726246a792bdc060e02bb3881
7
+ data.tar.gz: 1aa799e26509c9e0ce51be46b5cf3f156bd0bfc33f9ecc8a41c136a039f2547ef8e8d0ad479afcfd69a34b6d0fbdb7525e670d65c8c594e51d50a4c53a04a62f
@@ -9,14 +9,15 @@ rvm:
9
9
  - jruby-9.0.5.0
10
10
  jdk:
11
11
  - oraclejdk8
12
- - oraclejdk7
13
12
  - openjdk7
14
13
  before_install:
15
14
  - gem install ruby-maven bundler
16
15
  - bundle install
17
16
  matrix:
18
17
  include:
18
+ - rvm: jruby-9.2.0.0
19
+ jdk: oraclejdk8
19
20
  - rvm: jruby-head
20
21
  jdk: oraclejdk8
21
22
  allow_failures:
22
- - rvm: jruby-head
23
+ - rvm: jruby-head
@@ -1,6 +1,6 @@
1
1
  ## v0.6
2
2
 
3
- ### v0.6.1 (pending)
3
+ ### v0.6.1
4
4
 
5
5
  * Manticore will accept a URI object (which it calls #to_s on) as an alternate to a String for the URL in client#get(url)
6
6
 
data/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # Manticore
2
2
 
3
- [![Build Status](https://travis-ci.org/cheald/manticore.png?branch=master)](https://travis-ci.org/cheald/manticore)
3
+ [![Build Status](https://travis-ci.org/cheald/manticore.svg?branch=master)](https://travis-ci.org/cheald/manticore)
4
4
 
5
5
  Manticore is a fast, robust HTTP client built on the Apache HTTPClient libraries. It is only compatible with JRuby.
6
6
 
data/Rakefile CHANGED
@@ -1,27 +1,27 @@
1
1
  require "bundler/gem_tasks"
2
2
 
3
- require 'rspec/core/rake_task'
3
+ require "rspec/core/rake_task"
4
4
  RSpec::Core::RakeTask.new(:spec) do |spec|
5
- spec.pattern = 'spec/**/*_spec.rb'
6
- spec.rspec_opts = ['--tty --color --format documentation']
5
+ spec.pattern = "spec/**/*_spec.rb"
6
+ spec.rspec_opts = ["--tty --color --format documentation"]
7
7
  end
8
8
  task :default => [:generate_certs, :spec]
9
9
 
10
10
  # Download and vendor the jars needed
11
- require 'jars/installer'
11
+ require "jars/installer"
12
12
  task :install_jars do
13
13
  Jars::Installer.vendor_jars!
14
14
  end
15
15
 
16
16
  ## Build the Manticore extensions into a jar. You may need to install_jars first
17
17
  # Dependency jars for the Manticore ext build
18
- require 'rake/javaextensiontask'
19
- jars = ["#{ENV['MY_RUBY_HOME']}/lib/jruby.jar"] + Dir.glob("lib/**/*.jar")
20
- jars.reject! {|j| j.match("manticore-ext") }
18
+ require "rake/javaextensiontask"
19
+ jars = ["#{ENV["MY_RUBY_HOME"]}/lib/jruby.jar"] + Dir.glob("lib/**/*.jar")
20
+ jars.reject! { |j| j.match("manticore-ext") }
21
21
  Rake::JavaExtensionTask.new do |ext|
22
22
  ext.name = "manticore-ext"
23
23
  ext.lib_dir = "lib/org/manticore"
24
- ext.classpath = jars.map {|x| File.expand_path x}.join ':'
24
+ ext.classpath = jars.map { |x| File.expand_path x }.join ":"
25
25
  end
26
26
 
27
27
  # Generate all the stuff we need for a full test run
@@ -30,10 +30,10 @@ task :generate_certs do
30
30
  openssl = `which openssl`.strip
31
31
  keytool = `which keytool`.strip
32
32
 
33
- Dir.glob("#{root}/*").each {|f| File.unlink f }
33
+ Dir.glob("#{root}/*").each { |f| File.unlink f }
34
34
 
35
- # Create the CA
36
35
  cmds = [
36
+ # Create the CA
37
37
  "#{openssl} genrsa 4096 | #{openssl} pkcs8 -topk8 -nocrypt -out #{root}/root-ca.key",
38
38
  "#{openssl} req -sha256 -x509 -newkey rsa:4096 -nodes -key #{root}/root-ca.key -sha256 -days 365 -out #{root}/root-ca.crt -subj \"/C=US/ST=The Internet/L=The Internet/O=Manticore CA/OU=Manticore/CN=localhost\"",
39
39
 
@@ -41,15 +41,17 @@ task :generate_certs do
41
41
  "#{openssl} genrsa 4096 | #{openssl} pkcs8 -topk8 -nocrypt -out #{root}/client.key",
42
42
  "#{openssl} req -sha256 -key #{root}/client.key -newkey rsa:4096 -out #{root}/client.csr -subj \"/C=US/ST=The Internet/L=The Internet/O=Manticore Client/OU=Manticore/CN=localhost\"",
43
43
  "#{openssl} x509 -req -in #{root}/client.csr -CA #{root}/root-ca.crt -CAkey #{root}/root-ca.key -CAcreateserial -out #{root}/client.crt -sha256 -days 1",
44
+ "#{openssl} x509 -req -in #{root}/client.csr -CA #{root}/root-ca.crt -CAkey #{root}/root-ca.key -CAcreateserial -out #{root}/client-expired.crt -sha256 -days -7",
44
45
 
45
46
  # Create the server cert
46
47
  "#{openssl} genrsa 4096 | #{openssl} pkcs8 -topk8 -nocrypt -out #{root}/host.key",
47
48
  "#{openssl} req -sha256 -key #{root}/host.key -newkey rsa:4096 -out #{root}/host.csr -subj \"/C=US/ST=The Internet/L=The Internet/O=Manticore Host/OU=Manticore/CN=localhost\"",
48
49
  "#{openssl} x509 -req -in #{root}/host.csr -CA #{root}/root-ca.crt -CAkey #{root}/root-ca.key -CAcreateserial -out #{root}/host.crt -sha256 -days 1",
50
+ "#{openssl} x509 -req -in #{root}/host.csr -CA #{root}/root-ca.crt -CAkey #{root}/root-ca.key -CAcreateserial -out #{root}/host-expired.crt -sha256 -days -7",
49
51
 
50
52
  "#{keytool} -import -file #{root}/root-ca.crt -alias rootCA -keystore #{root}/truststore.jks -noprompt -storepass test123",
51
53
  "#{openssl} pkcs12 -export -clcerts -out #{root}/client.p12 -inkey #{root}/client.key -in #{root}/client.crt -certfile #{root}/root-ca.crt -password pass:test123",
52
54
  ]
53
55
 
54
- cmds.each.with_index {|cmd, index| puts "#{index}. #{cmd}"; system cmd }
55
- end
56
+ cmds.each.with_index { |cmd, index| puts "#{index}. #{cmd}"; system cmd }
57
+ end
@@ -43,6 +43,10 @@ public class Manticore implements Library {
43
43
  if(charset == null) { charset = HTTP.DEFAULT_CONTENT_CHARSET; }
44
44
  Encoding encoding;
45
45
  try {
46
+ String mimeType = EntityUtils.getContentMimeType(entity);
47
+ if (mimeType.startsWith("application/json")) {
48
+ charset = "UTF-8";
49
+ }
46
50
  encoding = context.getRuntime().getEncodingService().getEncodingFromString(charset);
47
51
  } catch(Throwable e) {
48
52
  encoding = context.getRuntime().getEncodingService().getEncodingFromString(HTTP.DEFAULT_CONTENT_CHARSET);
@@ -1,9 +1,9 @@
1
- require 'faraday'
1
+ require "faraday"
2
2
 
3
3
  module Faraday
4
4
  class Adapter
5
5
  class Manticore < Faraday::Adapter
6
- dependency { require 'manticore' }
6
+ dependency { require "manticore" }
7
7
 
8
8
  class ParallelManager
9
9
  def client=(client)
@@ -30,10 +30,10 @@ module Faraday
30
30
  opts = {}
31
31
  if ssl = env[:ssl].to_hash
32
32
  opts[:ssl] = {}
33
- opts[:ssl][:verify] = :disable if ssl[:verify] == false
34
- opts[:ssl][:ca_file] = ssl[:ca_file]
33
+ opts[:ssl][:verify] = :disable if ssl[:verify] == false
34
+ opts[:ssl][:ca_file] = ssl[:ca_file]
35
35
  opts[:ssl][:client_cert] = ssl[:client_cert]
36
- opts[:ssl][:client_key] = ssl[:client_key]
36
+ opts[:ssl][:client_key] = ssl[:client_key]
37
37
  end
38
38
  conn_opts = @connection_options.dup
39
39
  if conn_opts.key?(:ssl)
@@ -50,7 +50,7 @@ module Faraday
50
50
  opts = {}
51
51
  if env.key? :request_headers
52
52
  opts[:headers] = env[:request_headers]
53
- opts[:headers].reject! {|k, _| k.downcase == "content-length" } # Manticore computes Content-Length
53
+ opts[:headers].reject! { |k, _| k.downcase == "content-length" } # Manticore computes Content-Length
54
54
  end
55
55
  body = read_body(env)
56
56
  opts[:body] = body if body
@@ -60,9 +60,9 @@ module Faraday
60
60
  opts[:connect_timeout] = req[:open_timeout] if req.key?(:open_timeout)
61
61
  if prx = req[:proxy]
62
62
  opts[:proxy] = {
63
- :url => prx[:uri].to_s,
64
- :user => prx[:user],
65
- :password => prx[:password]
63
+ :url => prx[:uri].to_s,
64
+ :user => prx[:user],
65
+ :password => prx[:password],
66
66
  }
67
67
  end
68
68
  end
@@ -106,6 +106,7 @@ module Faraday
106
106
  env[:body].respond_to?(:read) ? env[:body].read : env[:body]
107
107
  end
108
108
  end
109
+
109
110
  register_middleware nil, :manticore => :Manticore
110
111
  end
111
- end
112
+ end
@@ -1,6 +1,6 @@
1
- require 'java'
2
- require 'uri'
3
- require 'cgi'
1
+ require "java"
2
+ require "uri"
3
+ require "cgi"
4
4
 
5
5
  require_relative "./manticore_jars.rb"
6
6
  require_relative "./org/manticore/manticore-ext"
@@ -42,12 +42,12 @@ module Manticore
42
42
  class UnknownException < ManticoreException; end
43
43
 
44
44
  require_relative "./manticore/java_extensions"
45
- require_relative './manticore/client/proxies'
46
- require_relative './manticore/client'
47
- require_relative './manticore/response'
48
- require_relative './manticore/stubbed_response'
49
- require_relative './manticore/cookie'
50
- require_relative './manticore/facade'
45
+ require_relative "./manticore/client/proxies"
46
+ require_relative "./manticore/client"
47
+ require_relative "./manticore/response"
48
+ require_relative "./manticore/stubbed_response"
49
+ require_relative "./manticore/cookie"
50
+ require_relative "./manticore/facade"
51
51
 
52
52
  include Facade
53
53
  include_http_client
@@ -57,4 +57,4 @@ module Manticore
57
57
  props.setProperty("org.apache.commons.logging.Log", "org.apache.commons.logging.impl.SimpleLog")
58
58
  props.setProperty("org.apache.commons.logging.simplelog.log.org.apache.http", "error")
59
59
  end
60
- end
60
+ end
@@ -1,6 +1,6 @@
1
- require 'thread'
2
- require 'base64'
3
- require 'weakref'
1
+ require "thread"
2
+ require "base64"
3
+ require "weakref"
4
4
 
5
5
  module Manticore
6
6
  # @!macro [new] http_method_shared
@@ -13,9 +13,9 @@ module Manticore
13
13
  # @option options [String] proxy Proxy host in form: http://proxy.org:1234
14
14
  # @option options [Hash] proxy Proxy host in form: {host: 'proxy.org'[, port: 80[, scheme: 'http']]}
15
15
  # @option options [URI] proxy Proxy host as a URI object
16
- # @option options [Integer] connect_timeout Request-specific connect timeout
17
- # @option options [Integer] socket_timeout Request-specific socket timeout
18
- # @option options [Integer] request_timeout Request-specific request timeout
16
+ # @option options [Float] connect_timeout Request-specific connect timeout (in seconds)
17
+ # @option options [Float] socket_timeout Request-specific socket timeout (in seconds)
18
+ # @option options [Float] request_timeout Request-specific request timeout (in seconds)
19
19
  # @option options [Integer] max_redirects Request-specific maximum redirect limit
20
20
  # @option options [Boolean] follow_redirects Specify whether this request should follow redirects
21
21
  # @option options [Hash] auth Specify authentication for the request
@@ -79,7 +79,7 @@ module Manticore
79
79
  include_package "org.apache.http.auth"
80
80
  include_package "java.util.concurrent"
81
81
  include_package "org.apache.http.client.protocol"
82
- include_package 'org.apache.http.conn.ssl'
82
+ include_package "org.apache.http.conn.ssl"
83
83
  include_package "java.security.cert"
84
84
  include_package "java.security.spec"
85
85
  include_package "java.security"
@@ -105,14 +105,14 @@ module Manticore
105
105
  include ProxiesInterface
106
106
 
107
107
  # The default maximum pool size for requests
108
- DEFAULT_MAX_POOL_SIZE = 50
108
+ DEFAULT_MAX_POOL_SIZE = 50
109
109
 
110
110
  DEFAULT_REQUEST_TIMEOUT = 60
111
- DEFAULT_SOCKET_TIMEOUT = 10
111
+ DEFAULT_SOCKET_TIMEOUT = 10
112
112
  DEFAULT_CONNECT_TIMEOUT = 10
113
- DEFAULT_MAX_REDIRECTS = 5
113
+ DEFAULT_MAX_REDIRECTS = 5
114
114
  DEFAULT_EXPECT_CONTINUE = false
115
- DEFAULT_STALE_CHECK = false
115
+ DEFAULT_STALE_CHECK = false
116
116
 
117
117
  attr_reader :client
118
118
 
@@ -177,7 +177,7 @@ module Manticore
177
177
  @finalizers = []
178
178
  self.class.shutdown_on_finalize self, @finalizers
179
179
 
180
- builder = client_builder
180
+ builder = client_builder
181
181
  builder.set_user_agent options.fetch(:user_agent, "Manticore #{VERSION}")
182
182
  @options = options
183
183
  @use_cookies = options.fetch(:cookies, false)
@@ -195,24 +195,24 @@ module Manticore
195
195
 
196
196
  @keepalive = options.fetch(:keepalive, true)
197
197
  if @keepalive == false
198
- builder.set_connection_reuse_strategy {|response, context| false }
198
+ builder.set_connection_reuse_strategy { |response, context| false }
199
199
  else
200
200
  builder.set_connection_reuse_strategy DefaultConnectionReuseStrategy.new
201
201
  end
202
202
 
203
203
  socket_config_builder = SocketConfig.custom
204
- socket_config_builder.set_so_timeout( options.fetch(:socket_timeout, DEFAULT_SOCKET_TIMEOUT) * 1000 )
205
- socket_config_builder.set_tcp_no_delay( options.fetch(:tcp_no_delay, true) )
204
+ socket_config_builder.set_so_timeout(options.fetch(:socket_timeout, DEFAULT_SOCKET_TIMEOUT) * 1000)
205
+ socket_config_builder.set_tcp_no_delay(options.fetch(:tcp_no_delay, true))
206
206
  builder.set_default_socket_config socket_config_builder.build
207
207
 
208
208
  builder.set_connection_manager pool(options)
209
209
 
210
210
  request_config = RequestConfig.custom
211
- request_config.set_connection_request_timeout options.fetch(:request_timeout, DEFAULT_REQUEST_TIMEOUT) * 1000
212
- request_config.set_connect_timeout options.fetch(:connect_timeout, DEFAULT_CONNECT_TIMEOUT) * 1000
213
- request_config.set_socket_timeout options.fetch(:socket_timeout, DEFAULT_SOCKET_TIMEOUT) * 1000
214
- request_config.set_max_redirects options.fetch(:max_redirects, DEFAULT_MAX_REDIRECTS)
215
- request_config.set_expect_continue_enabled options.fetch(:expect_continue, DEFAULT_EXPECT_CONTINUE)
211
+ request_config.set_connection_request_timeout options.fetch(:request_timeout, DEFAULT_REQUEST_TIMEOUT) * 1000
212
+ request_config.set_connect_timeout options.fetch(:connect_timeout, DEFAULT_CONNECT_TIMEOUT) * 1000
213
+ request_config.set_socket_timeout options.fetch(:socket_timeout, DEFAULT_SOCKET_TIMEOUT) * 1000
214
+ request_config.set_max_redirects options.fetch(:max_redirects, DEFAULT_MAX_REDIRECTS)
215
+ request_config.set_expect_continue_enabled options.fetch(:expect_continue, DEFAULT_EXPECT_CONTINUE)
216
216
  request_config.set_stale_connection_check_enabled options.fetch(:stale_check, DEFAULT_STALE_CHECK)
217
217
  request_config.set_circular_redirects_allowed false
218
218
 
@@ -233,7 +233,7 @@ module Manticore
233
233
  max: stats.get_max,
234
234
  leased: stats.get_leased,
235
235
  pending: stats.get_pending,
236
- available: stats.get_available
236
+ available: stats.get_available,
237
237
  }
238
238
  end
239
239
 
@@ -333,7 +333,7 @@ module Manticore
333
333
  # @return [Array] An array of the responses from the requests executed.
334
334
  def execute!
335
335
  method = executor.java_method(:submit, [java.util.concurrent.Callable.java_class])
336
- result = @async_requests.map {|r| method.call r }
336
+ result = @async_requests.map { |r| method.call r }
337
337
  @async_requests.clear
338
338
  result.map do |future|
339
339
  begin
@@ -357,8 +357,8 @@ module Manticore
357
357
 
358
358
  def self.shutdown_on_finalize(client, objs)
359
359
  ObjectSpace.define_finalizer client, -> {
360
- objs.each {|obj, args| obj.send(*args) rescue nil }
361
- }
360
+ objs.each { |obj, args| obj.send(*args) rescue nil }
361
+ }
362
362
  end
363
363
 
364
364
  protected
@@ -383,12 +383,12 @@ module Manticore
383
383
  end
384
384
 
385
385
  def pool_builder(options)
386
- http_sf = PlainConnectionSocketFactory.new
386
+ http_sf = PlainConnectionSocketFactory.new
387
387
 
388
388
  if options[:ignore_ssl_validation]
389
- $stderr.puts 'The options[:ignore_ssl_validation] setting is deprecated in favor of options[:ssl][:verify]'
389
+ $stderr.puts "The options[:ignore_ssl_validation] setting is deprecated in favor of options[:ssl][:verify]"
390
390
  options[:ssl] ||= {}
391
- options[:ssl] = {:verify => !options.delete(:ignore_ssl_validation)}.merge(options[:ssl])
391
+ options[:ssl] = {:verify => !options.delete(:ignore_ssl_validation)}.merge(options[:ssl])
392
392
  end
393
393
 
394
394
  https_sf = ssl_socket_factory_from_options options.fetch(:ssl, {})
@@ -416,10 +416,10 @@ module Manticore
416
416
 
417
417
  def request(klass, url, options, &block)
418
418
  req, context = request_from_options(klass, url, options)
419
- async = options.delete(:async)
420
- background = options.delete(:async_background)
419
+ async = options.delete(:async)
420
+ background = options.delete(:async_background)
421
421
  create_executor_if_needed if (background || async)
422
- response = response_object_for(req, context, &block)
422
+ response = response_object_for(req, context, &block)
423
423
 
424
424
  if async
425
425
  @async_requests << response
@@ -439,7 +439,7 @@ module Manticore
439
439
 
440
440
  match_key = @stubs.keys.find { |k| request_uri.match(k) }
441
441
  if match_key
442
- StubbedResponse.new(self, request, context, &block).stub( @stubs[match_key] )
442
+ StubbedResponse.new(self, request, context, &block).stub(@stubs[match_key])
443
443
  else
444
444
  Response.new(self, request, context, &block)
445
445
  end
@@ -456,7 +456,7 @@ module Manticore
456
456
  def request_from_options(klass, url, options)
457
457
  req = klass.new uri_from_url_and_options(url, options).to_s
458
458
 
459
- if ( options[:params] || options[:body] || options[:entity]) && req.kind_of?(HttpEntityEnclosingRequestBase)
459
+ if (options[:params] || options[:body] || options[:entity]) && req.kind_of?(HttpEntityEnclosingRequestBase)
460
460
  if options[:params]
461
461
  pairs = struct_to_name_value_pairs(options[:params])
462
462
  encoding = minimum_encoding_for options[:params].to_s
@@ -479,10 +479,10 @@ module Manticore
479
479
  if req_options[:proxy]
480
480
  config.set_proxy get_proxy_host(req_options[:proxy])
481
481
  end
482
- config.set_max_redirects req_options[:max_redirects] if req_options[:max_redirects]
483
- config.set_redirects_enabled !!req_options[:follow_redirects] if req_options.fetch(:follow_redirects, nil) != nil
484
- config.set_connect_timeout req_options[:connect_timeout] * 1000 if req_options[:connect_timeout]
485
- config.set_socket_timeout req_options[:socket_timeout] * 1000 if req_options[:socket_timeout]
482
+ config.set_max_redirects req_options[:max_redirects] if req_options[:max_redirects]
483
+ config.set_redirects_enabled !!req_options[:follow_redirects] if req_options.fetch(:follow_redirects, nil) != nil
484
+ config.set_connect_timeout req_options[:connect_timeout] * 1000 if req_options[:connect_timeout]
485
+ config.set_socket_timeout req_options[:socket_timeout] * 1000 if req_options[:socket_timeout]
486
486
  config.set_connection_request_timeout req_options[:request_timeout] * 1000 if req_options[:request_timeout]
487
487
  req.set_config config.build
488
488
  end
@@ -502,7 +502,7 @@ module Manticore
502
502
 
503
503
  context = HttpClientContext.new
504
504
  proxy_user = req_options[:proxy].is_a?(Hash) && (req_options[:proxy][:user] || req_options[:proxy][:username])
505
- auth_from_options(req, req_options, context) if req_options.key?(:auth) || proxy_user
505
+ auth_from_options(req, req_options, context)
506
506
 
507
507
  if @use_cookies == :per_request
508
508
  store = BasicCookieStore.new
@@ -537,16 +537,15 @@ module Manticore
537
537
 
538
538
  def auth_from_options(req, options, context)
539
539
  proxy = options.fetch(:proxy, {})
540
-
540
+
541
541
  proxy_user, proxy_pass = if proxy.is_a?(String)
542
- proxy_uri = URI.parse(proxy)
543
- [proxy_uri.user, proxy_uri.password]
544
- else
545
- [(proxy[:user] || proxy[:username]),
546
- (proxy[:pass] || proxy[:password])]
547
- end
548
-
549
-
542
+ proxy_uri = URI.parse(proxy)
543
+ [proxy_uri.user, proxy_uri.password]
544
+ else
545
+ [(proxy[:user] || proxy[:username]),
546
+ (proxy[:pass] || proxy[:password])]
547
+ end
548
+
550
549
  if options[:auth] || proxy_user
551
550
  provider = BasicCredentialsProvider.new
552
551
  if options[:auth]
@@ -577,9 +576,9 @@ module Manticore
577
576
  when nil
578
577
  []
579
578
  when Hash
580
- value.flat_map {|key, val| struct_to_name_value_pairs val, namespace ? "#{namespace}[#{key}]" : key }
579
+ value.flat_map { |key, val| struct_to_name_value_pairs val, namespace ? "#{namespace}[#{key}]" : key }
581
580
  when Array
582
- value.flat_map {|val| struct_to_name_value_pairs val, namespace }
581
+ value.flat_map { |val| struct_to_name_value_pairs val, namespace }
583
582
  else
584
583
  BasicNameValuePair.new(namespace, value.to_s)
585
584
  end
@@ -588,6 +587,7 @@ module Manticore
588
587
  # Apache HTTP assumes ISO_8859_1 for StringEntities; we'll try to be nice and pass that when possible
589
588
  # so that it doesn't have to any multibyte work.
590
589
  ISO_8859_1 = "ISO-8859-1".freeze
590
+
591
591
  def minimum_encoding_for(string)
592
592
  if string.ascii_only?
593
593
  ISO_8859_1
@@ -639,6 +639,7 @@ module Manticore
639
639
  end
640
640
 
641
641
  KEY_EXTRACTION_REGEXP = /(?:^-----BEGIN(.* )PRIVATE KEY-----\n)(.*?)(?:-----END\1PRIVATE KEY.*$)/m
642
+
642
643
  def setup_key_store(ssl_options, context)
643
644
  key_store = get_store(:keystore, ssl_options) if ssl_options.key?(:keystore)
644
645
  keystore_password = (ssl_options[:keystore_password] || "").to_java.toCharArray
@@ -685,7 +686,7 @@ module Manticore
685
686
  end
686
687
 
687
688
  def blank_keystore
688
- KeyStore.get_instance(KeyStore.get_default_type).tap {|k| k.load(nil, nil) }
689
+ KeyStore.get_instance(KeyStore.get_default_type).tap { |k| k.load(nil, nil) }
689
690
  end
690
691
 
691
692
  def guess_store_type(filename)
@@ -698,7 +699,7 @@ module Manticore
698
699
 
699
700
  def treat_params_as_query(options)
700
701
  if options.key?(:params) && !options.key?(:query)
701
- options.dup.tap {|o| o[:query] = o.delete(:params) }
702
+ options.dup.tap { |o| o[:query] = o.delete(:params) }
702
703
  else
703
704
  options
704
705
  end