ethon 0.12.0 → 0.14.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (102) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/ruby.yml +41 -0
  3. data/CHANGELOG.md +3 -0
  4. data/Gemfile +5 -0
  5. data/Guardfile +1 -0
  6. data/README.md +1 -1
  7. data/Rakefile +1 -0
  8. data/ethon.gemspec +2 -1
  9. data/lib/ethon.rb +1 -0
  10. data/lib/ethon/curl.rb +1 -0
  11. data/lib/ethon/curls/classes.rb +1 -0
  12. data/lib/ethon/curls/codes.rb +1 -1
  13. data/lib/ethon/curls/constants.rb +1 -0
  14. data/lib/ethon/curls/form_options.rb +1 -0
  15. data/lib/ethon/curls/functions.rb +4 -13
  16. data/lib/ethon/curls/infos.rb +4 -3
  17. data/lib/ethon/curls/messages.rb +1 -0
  18. data/lib/ethon/curls/options.rb +25 -22
  19. data/lib/ethon/curls/settings.rb +1 -0
  20. data/lib/ethon/easy.rb +1 -1
  21. data/lib/ethon/easy/callbacks.rb +4 -3
  22. data/lib/ethon/easy/debug_info.rb +1 -0
  23. data/lib/ethon/easy/features.rb +1 -0
  24. data/lib/ethon/easy/form.rb +1 -0
  25. data/lib/ethon/easy/header.rb +1 -0
  26. data/lib/ethon/easy/http.rb +1 -0
  27. data/lib/ethon/easy/http/actionable.rb +1 -0
  28. data/lib/ethon/easy/http/custom.rb +1 -0
  29. data/lib/ethon/easy/http/delete.rb +1 -0
  30. data/lib/ethon/easy/http/get.rb +1 -0
  31. data/lib/ethon/easy/http/head.rb +1 -0
  32. data/lib/ethon/easy/http/options.rb +1 -0
  33. data/lib/ethon/easy/http/patch.rb +1 -0
  34. data/lib/ethon/easy/http/post.rb +1 -0
  35. data/lib/ethon/easy/http/postable.rb +1 -0
  36. data/lib/ethon/easy/http/put.rb +1 -0
  37. data/lib/ethon/easy/http/putable.rb +1 -0
  38. data/lib/ethon/easy/informations.rb +1 -0
  39. data/lib/ethon/easy/mirror.rb +1 -0
  40. data/lib/ethon/easy/operations.rb +16 -1
  41. data/lib/ethon/easy/options.rb +1 -0
  42. data/lib/ethon/easy/params.rb +1 -0
  43. data/lib/ethon/easy/queryable.rb +1 -0
  44. data/lib/ethon/easy/response_callbacks.rb +1 -0
  45. data/lib/ethon/easy/util.rb +1 -0
  46. data/lib/ethon/errors.rb +1 -0
  47. data/lib/ethon/errors/ethon_error.rb +1 -0
  48. data/lib/ethon/errors/global_init.rb +1 -0
  49. data/lib/ethon/errors/invalid_option.rb +1 -0
  50. data/lib/ethon/errors/invalid_value.rb +1 -0
  51. data/lib/ethon/errors/multi_add.rb +1 -0
  52. data/lib/ethon/errors/multi_fdset.rb +1 -0
  53. data/lib/ethon/errors/multi_remove.rb +1 -0
  54. data/lib/ethon/errors/multi_timeout.rb +1 -0
  55. data/lib/ethon/errors/select.rb +1 -0
  56. data/lib/ethon/libc.rb +1 -0
  57. data/lib/ethon/loggable.rb +1 -0
  58. data/lib/ethon/multi.rb +1 -0
  59. data/lib/ethon/multi/operations.rb +1 -0
  60. data/lib/ethon/multi/options.rb +8 -7
  61. data/lib/ethon/multi/stack.rb +1 -0
  62. data/lib/ethon/version.rb +2 -1
  63. data/profile/benchmarks.rb +1 -0
  64. data/profile/memory_leaks.rb +1 -0
  65. data/profile/perf_spec_helper.rb +1 -0
  66. data/profile/support/memory_test_helpers.rb +1 -0
  67. data/profile/support/os_memory_leak_tracker.rb +1 -0
  68. data/profile/support/ruby_object_leak_tracker.rb +1 -0
  69. data/spec/ethon/curl_spec.rb +1 -0
  70. data/spec/ethon/easy/callbacks_spec.rb +1 -0
  71. data/spec/ethon/easy/debug_info_spec.rb +1 -0
  72. data/spec/ethon/easy/features_spec.rb +1 -0
  73. data/spec/ethon/easy/form_spec.rb +1 -0
  74. data/spec/ethon/easy/header_spec.rb +1 -0
  75. data/spec/ethon/easy/http/custom_spec.rb +1 -0
  76. data/spec/ethon/easy/http/delete_spec.rb +1 -0
  77. data/spec/ethon/easy/http/get_spec.rb +1 -0
  78. data/spec/ethon/easy/http/head_spec.rb +1 -0
  79. data/spec/ethon/easy/http/options_spec.rb +1 -0
  80. data/spec/ethon/easy/http/patch_spec.rb +1 -0
  81. data/spec/ethon/easy/http/post_spec.rb +1 -0
  82. data/spec/ethon/easy/http/put_spec.rb +1 -0
  83. data/spec/ethon/easy/http_spec.rb +1 -0
  84. data/spec/ethon/easy/informations_spec.rb +1 -0
  85. data/spec/ethon/easy/mirror_spec.rb +1 -0
  86. data/spec/ethon/easy/operations_spec.rb +1 -0
  87. data/spec/ethon/easy/options_spec.rb +2 -1
  88. data/spec/ethon/easy/queryable_spec.rb +1 -0
  89. data/spec/ethon/easy/response_callbacks_spec.rb +1 -0
  90. data/spec/ethon/easy/util_spec.rb +1 -0
  91. data/spec/ethon/easy_spec.rb +3 -2
  92. data/spec/ethon/libc_spec.rb +1 -0
  93. data/spec/ethon/loggable_spec.rb +1 -0
  94. data/spec/ethon/multi/operations_spec.rb +1 -0
  95. data/spec/ethon/multi/options_spec.rb +1 -0
  96. data/spec/ethon/multi/stack_spec.rb +1 -0
  97. data/spec/ethon/multi_spec.rb +1 -0
  98. data/spec/spec_helper.rb +1 -0
  99. data/spec/support/localhost_server.rb +2 -1
  100. data/spec/support/server.rb +1 -0
  101. metadata +6 -7
  102. data/.travis.yml +0 -30
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  module Ethon
2
3
  class Easy
3
4
  # This module contains the logic around adding headers to libcurl.
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  require 'ethon/easy/http/actionable'
2
3
  require 'ethon/easy/http/post'
3
4
  require 'ethon/easy/http/get'
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  require 'ethon/easy/http/putable'
2
3
  require 'ethon/easy/http/postable'
3
4
 
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  module Ethon
2
3
  class Easy
3
4
  module Http
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  module Ethon
2
3
  class Easy
3
4
  module Http
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  module Ethon
2
3
  class Easy
3
4
  module Http
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  module Ethon
2
3
  class Easy
3
4
  module Http
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  module Ethon
2
3
  class Easy
3
4
  module Http
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  module Ethon
2
3
  class Easy
3
4
  module Http
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  module Ethon
2
3
  class Easy
3
4
  module Http
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  module Ethon
2
3
  class Easy
3
4
  module Http
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  module Ethon
2
3
  class Easy
3
4
  module Http
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  module Ethon
2
3
  class Easy
3
4
  module Http
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  module Ethon
2
3
  class Easy
3
4
 
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  module Ethon
2
3
  class Easy
3
4
  class Mirror
@@ -1,8 +1,23 @@
1
+ # frozen_string_literal: true
1
2
  module Ethon
2
3
  class Easy
3
4
  # This module contains the logic to prepare and perform
4
5
  # an easy.
5
6
  module Operations
7
+
8
+ class PointerHelper
9
+ class<<self
10
+ def synchronize( &block )
11
+ (@mutex ||= Mutex.new).synchronize( &block )
12
+ end
13
+
14
+ def release( pointer )
15
+ synchronize { Curl.easy_cleanup pointer }
16
+ end
17
+ end
18
+ synchronize{}
19
+ end
20
+
6
21
  # Returns a pointer to the curl easy handle.
7
22
  #
8
23
  # @example Return the handle.
@@ -10,7 +25,7 @@ module Ethon
10
25
  #
11
26
  # @return [ FFI::Pointer ] A pointer to the curl easy handle.
12
27
  def handle
13
- @handle ||= FFI::AutoPointer.new(Curl.easy_init, Curl.method(:easy_cleanup))
28
+ @handle ||= FFI::AutoPointer.new(Curl.easy_init, PointerHelper.method(:release) )
14
29
  end
15
30
 
16
31
  # Sets a pointer to the curl easy handle.
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  module Ethon
2
3
  class Easy
3
4
 
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  require 'ethon/easy/util'
2
3
  require 'ethon/easy/queryable'
3
4
 
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  module Ethon
2
3
  class Easy
3
4
 
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  module Ethon
2
3
  class Easy
3
4
 
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  module Ethon
2
3
  class Easy # :nodoc:
3
4
 
data/lib/ethon/errors.rb CHANGED
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  require 'ethon/errors/ethon_error'
2
3
  require 'ethon/errors/global_init'
3
4
  require 'ethon/errors/multi_timeout'
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  module Ethon
2
3
  module Errors
3
4
 
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  module Ethon
2
3
  module Errors
3
4
 
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  module Ethon
2
3
  module Errors
3
4
 
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  module Ethon
2
3
  module Errors
3
4
 
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  module Ethon
2
3
  module Errors
3
4
 
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  module Ethon
2
3
  module Errors
3
4
 
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  module Ethon
2
3
  module Errors
3
4
 
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  module Ethon
2
3
  module Errors
3
4
 
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  module Ethon
2
3
  module Errors
3
4
 
data/lib/ethon/libc.rb CHANGED
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  module Ethon
2
3
 
3
4
  # FFI Wrapper module for Libc.
@@ -1,4 +1,5 @@
1
1
  # encoding: utf-8
2
+ # frozen_string_literal: true
2
3
  module Ethon
3
4
 
4
5
  # Contains logging behaviour.
data/lib/ethon/multi.rb CHANGED
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  require 'ethon/easy/util'
2
3
  require 'ethon/multi/stack'
3
4
  require 'ethon/multi/operations'
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  module Ethon
2
3
  class Multi # :nodoc
3
4
  # This module contains logic to run a multi.
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  module Ethon
2
3
  class Multi
3
4
 
@@ -8,7 +9,7 @@ module Ethon
8
9
  # Sets max_total_connections option.
9
10
  #
10
11
  # @example Set max_total_connections option.
11
- # easy.max_total_conections = $value
12
+ # multi.max_total_conections = $value
12
13
  #
13
14
  # @param [ String ] value The value to set.
14
15
  #
@@ -20,7 +21,7 @@ module Ethon
20
21
  # Sets maxconnects option.
21
22
  #
22
23
  # @example Set maxconnects option.
23
- # easy.maxconnects = $value
24
+ # multi.maxconnects = $value
24
25
  #
25
26
  # @param [ String ] value The value to set.
26
27
  #
@@ -32,7 +33,7 @@ module Ethon
32
33
  # Sets pipelining option.
33
34
  #
34
35
  # @example Set pipelining option.
35
- # easy.pipelining = $value
36
+ # multi.pipelining = $value
36
37
  #
37
38
  # @param [ String ] value The value to set.
38
39
  #
@@ -44,7 +45,7 @@ module Ethon
44
45
  # Sets socketdata option.
45
46
  #
46
47
  # @example Set socketdata option.
47
- # easy.socketdata = $value
48
+ # multi.socketdata = $value
48
49
  #
49
50
  # @param [ String ] value The value to set.
50
51
  #
@@ -56,7 +57,7 @@ module Ethon
56
57
  # Sets socketfunction option.
57
58
  #
58
59
  # @example Set socketfunction option.
59
- # easy.socketfunction = $value
60
+ # multi.socketfunction = $value
60
61
  #
61
62
  # @param [ String ] value The value to set.
62
63
  #
@@ -68,7 +69,7 @@ module Ethon
68
69
  # Sets timerdata option.
69
70
  #
70
71
  # @example Set timerdata option.
71
- # easy.timerdata = $value
72
+ # multi.timerdata = $value
72
73
  #
73
74
  # @param [ String ] value The value to set.
74
75
  #
@@ -80,7 +81,7 @@ module Ethon
80
81
  # Sets timerfunction option.
81
82
  #
82
83
  # @example Set timerfunction option.
83
- # easy.timerfunction = $value
84
+ # multi.timerfunction = $value
84
85
  #
85
86
  # @param [ String ] value The value to set.
86
87
  #
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  module Ethon
2
3
  class Multi
3
4
 
data/lib/ethon/version.rb CHANGED
@@ -1,5 +1,6 @@
1
+ # frozen_string_literal: true
1
2
  module Ethon
2
3
 
3
4
  # Ethon version.
4
- VERSION = '0.12.0'
5
+ VERSION = '0.14.0'
5
6
  end
@@ -1,4 +1,5 @@
1
1
  # encoding: utf-8
2
+ # frozen_string_literal: true
2
3
  require 'ethon'
3
4
  require 'open-uri'
4
5
  require 'patron'
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  require 'ethon'
2
3
  require 'ethon/easy'
3
4
 
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  #### SETUP
2
3
  require 'bundler'
3
4
  Bundler.setup
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  require_relative 'ruby_object_leak_tracker'
2
3
  require_relative 'os_memory_leak_tracker'
3
4
 
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  class OSMemoryLeakTracker
2
3
  attr_reader :current_run
3
4
 
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  class RubyObjectLeakTracker
2
3
  attr_reader :previous_count_hash, :current_count_hash
3
4
 
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  require 'spec_helper'
2
3
 
3
4
  describe Ethon::Curl do
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  require 'spec_helper'
2
3
 
3
4
  describe Ethon::Easy::Callbacks do
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  require 'spec_helper'
2
3
 
3
4
  describe Ethon::Easy::DebugInfo do
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  require 'spec_helper'
2
3
 
3
4
  describe Ethon::Easy::Informations do
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  require 'spec_helper'
2
3
 
3
4
  describe Ethon::Easy::Form do
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  require 'spec_helper'
2
3
 
3
4
  describe Ethon::Easy::Header do
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  require 'spec_helper'
2
3
 
3
4
  describe Ethon::Easy::Http::Custom do
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  require 'spec_helper'
2
3
 
3
4
  describe Ethon::Easy::Http::Delete do
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  require 'spec_helper'
2
3
 
3
4
  describe Ethon::Easy::Http::Get do
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  require 'spec_helper'
2
3
 
3
4
  describe Ethon::Easy::Http::Head do
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  require 'spec_helper'
2
3
 
3
4
  describe Ethon::Easy::Http::Options do
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  require 'spec_helper'
2
3
 
3
4
  describe Ethon::Easy::Http::Patch do
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  require 'spec_helper'
2
3
 
3
4
  describe Ethon::Easy::Http::Post do