pingram 1.0.40 → 1.0.41
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 +4 -4
- data/Gemfile.lock +5 -5
- data/lib/pingram/api/account_api.rb +191 -4
- data/lib/pingram/api/webhooks_api.rb +6 -6
- data/lib/pingram/api_client.rb +1 -1
- data/lib/pingram/models/account_get_response_billing_alerts.rb +1 -1
- data/lib/pingram/models/account_payment_methods.rb +214 -0
- data/lib/pingram/models/account_payment_methods_payment_methods_inner.rb +270 -0
- data/lib/pingram/models/assign_payment_method_request.rb +216 -0
- data/lib/pingram/models/billing_post_response_body.rb +1 -1
- data/lib/pingram/models/confirm_change_email_request.rb +14 -4
- data/lib/pingram/models/confirm_change_email_response.rb +192 -0
- data/lib/pingram/models/confirm_password_change_request.rb +191 -0
- data/lib/pingram/models/create_payment_method_setup_request.rb +191 -0
- data/lib/pingram/models/list_invoices_response_invoices_inner.rb +1 -1
- data/lib/pingram/models/logs_get_response_logs_inner.rb +10 -1
- data/lib/pingram/models/password_status_response.rb +195 -0
- data/lib/pingram/models/payment_method_setup.rb +191 -0
- data/lib/pingram/models/sign_in_username_request.rb +164 -0
- data/lib/pingram/models/sign_in_username_response.rb +165 -0
- data/lib/pingram/models/start_change_email_request.rb +13 -20
- data/lib/pingram/models/start_password_change_request.rb +185 -0
- data/lib/pingram/models/webhook_endpoint.rb +14 -5
- data/lib/pingram/models/webhook_endpoint_basic_auth.rb +193 -0
- data/lib/pingram/models/webhook_endpoint_upsert_request.rb +15 -5
- data/lib/pingram/models/webhook_endpoint_upsert_request_basic_auth.rb +176 -0
- data/lib/pingram/models/webhook_endpoints_response_endpoints_inner.rb +14 -5
- data/lib/pingram/version.rb +1 -1
- data/lib/pingram.rb +13 -0
- data/vendor/bundle/ruby/3.2.0/cache/ethon-0.19.1.gem +0 -0
- data/vendor/bundle/ruby/3.2.0/cache/io-console-0.9.5.gem +0 -0
- data/vendor/bundle/ruby/3.2.0/cache/typhoeus-1.7.1.gem +0 -0
- data/vendor/bundle/ruby/3.2.0/extensions/x86_64-linux/3.2.0/byebug-13.0.0/gem_make.out +5 -5
- data/vendor/bundle/ruby/3.2.0/extensions/x86_64-linux/3.2.0/date-3.6.0/gem_make.out +5 -5
- data/vendor/bundle/ruby/3.2.0/extensions/x86_64-linux/3.2.0/{io-console-0.9.4 → io-console-0.9.5}/gem_make.out +10 -10
- data/vendor/bundle/ruby/3.2.0/extensions/x86_64-linux/3.2.0/io-console-0.9.5/io/console.so +0 -0
- data/vendor/bundle/ruby/3.2.0/extensions/x86_64-linux/3.2.0/{io-console-0.9.4 → io-console-0.9.5}/mkmf.log +6 -6
- data/vendor/bundle/ruby/3.2.0/extensions/x86_64-linux/3.2.0/jaro_winkler-1.5.6/gem_make.out +5 -5
- data/vendor/bundle/ruby/3.2.0/extensions/x86_64-linux/3.2.0/psych-5.5.0/gem_make.out +5 -5
- data/vendor/bundle/ruby/3.2.0/extensions/x86_64-linux/3.2.0/racc-1.8.1/gem_make.out +5 -5
- data/vendor/bundle/ruby/3.2.0/extensions/x86_64-linux/3.2.0/stringio-3.2.0/gem_make.out +5 -5
- data/vendor/bundle/ruby/3.2.0/gems/ethon-0.19.1/CHANGELOG.md +1120 -0
- data/vendor/bundle/ruby/3.2.0/gems/ethon-0.19.1/README.md +261 -0
- data/vendor/bundle/ruby/3.2.0/gems/{ethon-0.18.0 → ethon-0.19.1}/lib/ethon/curl.rb +22 -0
- data/vendor/bundle/ruby/3.2.0/gems/ethon-0.19.1/lib/ethon/curls/classes.rb +337 -0
- data/vendor/bundle/ruby/3.2.0/gems/{ethon-0.18.0 → ethon-0.19.1}/lib/ethon/curls/codes.rb +28 -9
- data/vendor/bundle/ruby/3.2.0/gems/{ethon-0.18.0 → ethon-0.19.1}/lib/ethon/curls/constants.rb +61 -4
- data/vendor/bundle/ruby/3.2.0/gems/{ethon-0.18.0 → ethon-0.19.1}/lib/ethon/curls/form_options.rb +2 -1
- data/vendor/bundle/ruby/3.2.0/gems/ethon-0.19.1/lib/ethon/curls/functions.rb +107 -0
- data/vendor/bundle/ruby/3.2.0/gems/{ethon-0.18.0 → ethon-0.19.1}/lib/ethon/curls/infos.rb +104 -5
- data/vendor/bundle/ruby/3.2.0/gems/ethon-0.19.1/lib/ethon/curls/introspection.rb +139 -0
- data/vendor/bundle/ruby/3.2.0/gems/ethon-0.19.1/lib/ethon/curls/introspection_constants.rb +42 -0
- data/vendor/bundle/ruby/3.2.0/gems/ethon-0.19.1/lib/ethon/curls/mime.rb +187 -0
- data/vendor/bundle/ruby/3.2.0/gems/ethon-0.19.1/lib/ethon/curls/optional.rb +14 -0
- data/vendor/bundle/ruby/3.2.0/gems/{ethon-0.18.0 → ethon-0.19.1}/lib/ethon/curls/options.rb +298 -71
- data/vendor/bundle/ruby/3.2.0/gems/ethon-0.19.1/lib/ethon/curls/settings.rb +21 -0
- data/vendor/bundle/ruby/3.2.0/gems/ethon-0.19.1/lib/ethon/curls/share.rb +165 -0
- data/vendor/bundle/ruby/3.2.0/gems/ethon-0.19.1/lib/ethon/curls/share_constants.rb +47 -0
- data/vendor/bundle/ruby/3.2.0/gems/ethon-0.19.1/lib/ethon/curls/url.rb +171 -0
- data/vendor/bundle/ruby/3.2.0/gems/ethon-0.19.1/lib/ethon/curls/url_constants.rb +78 -0
- data/vendor/bundle/ruby/3.2.0/gems/ethon-0.19.1/lib/ethon/easy/callbacks.rb +281 -0
- data/vendor/bundle/ruby/3.2.0/gems/{ethon-0.18.0 → ethon-0.19.1}/lib/ethon/easy/features.rb +4 -1
- data/vendor/bundle/ruby/3.2.0/gems/ethon-0.19.1/lib/ethon/easy/files.rb +113 -0
- data/vendor/bundle/ruby/3.2.0/gems/{ethon-0.18.0 → ethon-0.19.1}/lib/ethon/easy/form.rb +65 -6
- data/vendor/bundle/ruby/3.2.0/gems/ethon-0.19.1/lib/ethon/easy/header.rb +103 -0
- data/vendor/bundle/ruby/3.2.0/gems/ethon-0.19.1/lib/ethon/easy/headers_api.rb +79 -0
- data/vendor/bundle/ruby/3.2.0/gems/{ethon-0.18.0 → ethon-0.19.1}/lib/ethon/easy/http/actionable.rb +25 -3
- data/vendor/bundle/ruby/3.2.0/gems/{ethon-0.18.0 → ethon-0.19.1}/lib/ethon/easy/http/get.rb +5 -1
- data/vendor/bundle/ruby/3.2.0/gems/{ethon-0.18.0 → ethon-0.19.1}/lib/ethon/easy/http/post.rb +1 -0
- data/vendor/bundle/ruby/3.2.0/gems/{ethon-0.18.0 → ethon-0.19.1}/lib/ethon/easy/http/postable.rb +9 -2
- data/vendor/bundle/ruby/3.2.0/gems/ethon-0.19.1/lib/ethon/easy/http/putable.rb +40 -0
- data/vendor/bundle/ruby/3.2.0/gems/{ethon-0.18.0 → ethon-0.19.1}/lib/ethon/easy/http.rb +16 -4
- data/vendor/bundle/ruby/3.2.0/gems/{ethon-0.18.0 → ethon-0.19.1}/lib/ethon/easy/informations.rb +51 -2
- data/vendor/bundle/ruby/3.2.0/gems/ethon-0.19.1/lib/ethon/easy/mime.rb +29 -0
- data/vendor/bundle/ruby/3.2.0/gems/ethon-0.19.1/lib/ethon/easy/mirror.rb +49 -0
- data/vendor/bundle/ruby/3.2.0/gems/ethon-0.19.1/lib/ethon/easy/operations.rb +317 -0
- data/vendor/bundle/ruby/3.2.0/gems/ethon-0.19.1/lib/ethon/easy/options.rb +369 -0
- data/vendor/bundle/ruby/3.2.0/gems/{ethon-0.18.0 → ethon-0.19.1}/lib/ethon/easy/queryable.rb +59 -14
- data/vendor/bundle/ruby/3.2.0/gems/{ethon-0.18.0 → ethon-0.19.1}/lib/ethon/easy/response_callbacks.rb +33 -12
- data/vendor/bundle/ruby/3.2.0/gems/ethon-0.19.1/lib/ethon/easy/share.rb +28 -0
- data/vendor/bundle/ruby/3.2.0/gems/ethon-0.19.1/lib/ethon/easy/url.rb +32 -0
- data/vendor/bundle/ruby/3.2.0/gems/ethon-0.19.1/lib/ethon/easy/util.rb +47 -0
- data/vendor/bundle/ruby/3.2.0/gems/{ethon-0.18.0 → ethon-0.19.1}/lib/ethon/easy.rb +185 -10
- data/vendor/bundle/ruby/3.2.0/gems/ethon-0.19.1/lib/ethon/errors/fork_safety.rb +10 -0
- data/vendor/bundle/ruby/3.2.0/gems/ethon-0.19.1/lib/ethon/errors/form_add.rb +12 -0
- data/vendor/bundle/ruby/3.2.0/gems/{ethon-0.18.0 → ethon-0.19.1}/lib/ethon/errors/global_init.rb +1 -1
- data/vendor/bundle/ruby/3.2.0/gems/ethon-0.19.1/lib/ethon/errors/header.rb +12 -0
- data/vendor/bundle/ruby/3.2.0/gems/{ethon-0.18.0 → ethon-0.19.1}/lib/ethon/errors/invalid_option.rb +3 -1
- data/vendor/bundle/ruby/3.2.0/gems/ethon-0.19.1/lib/ethon/errors/invalid_value.rb +15 -0
- data/vendor/bundle/ruby/3.2.0/gems/ethon-0.19.1/lib/ethon/errors/mime.rb +17 -0
- data/vendor/bundle/ruby/3.2.0/gems/{ethon-0.18.0 → ethon-0.19.1}/lib/ethon/errors/multi_add.rb +1 -1
- data/vendor/bundle/ruby/3.2.0/gems/ethon-0.19.1/lib/ethon/errors/multi_assign.rb +12 -0
- data/vendor/bundle/ruby/3.2.0/gems/{ethon-0.18.0 → ethon-0.19.1}/lib/ethon/errors/multi_fdset.rb +1 -1
- data/vendor/bundle/ruby/3.2.0/gems/ethon-0.19.1/lib/ethon/errors/multi_perform.rb +12 -0
- data/vendor/bundle/ruby/3.2.0/gems/ethon-0.19.1/lib/ethon/errors/multi_poll.rb +12 -0
- data/vendor/bundle/ruby/3.2.0/gems/{ethon-0.18.0 → ethon-0.19.1}/lib/ethon/errors/multi_remove.rb +1 -1
- data/vendor/bundle/ruby/3.2.0/gems/{ethon-0.18.0 → ethon-0.19.1}/lib/ethon/errors/multi_timeout.rb +2 -2
- data/vendor/bundle/ruby/3.2.0/gems/ethon-0.19.1/lib/ethon/errors/multi_wait.rb +12 -0
- data/vendor/bundle/ruby/3.2.0/gems/ethon-0.19.1/lib/ethon/errors/multi_wakeup.rb +12 -0
- data/vendor/bundle/ruby/3.2.0/gems/{ethon-0.18.0 → ethon-0.19.1}/lib/ethon/errors/select.rb +1 -1
- data/vendor/bundle/ruby/3.2.0/gems/ethon-0.19.1/lib/ethon/errors/set_option.rb +27 -0
- data/vendor/bundle/ruby/3.2.0/gems/ethon-0.19.1/lib/ethon/errors/share.rb +17 -0
- data/vendor/bundle/ruby/3.2.0/gems/ethon-0.19.1/lib/ethon/errors/unsupported_option.rb +23 -0
- data/vendor/bundle/ruby/3.2.0/gems/ethon-0.19.1/lib/ethon/errors/url.rb +17 -0
- data/vendor/bundle/ruby/3.2.0/gems/{ethon-0.18.0 → ethon-0.19.1}/lib/ethon/errors.rb +13 -0
- data/vendor/bundle/ruby/3.2.0/gems/ethon-0.19.1/lib/ethon/libc.rb +50 -0
- data/vendor/bundle/ruby/3.2.0/gems/{ethon-0.18.0 → ethon-0.19.1}/lib/ethon/loggable.rb +1 -1
- data/vendor/bundle/ruby/3.2.0/gems/ethon-0.19.1/lib/ethon/multi/operations.rb +472 -0
- data/vendor/bundle/ruby/3.2.0/gems/ethon-0.19.1/lib/ethon/multi/options.rb +219 -0
- data/vendor/bundle/ruby/3.2.0/gems/ethon-0.19.1/lib/ethon/multi/stack.rb +220 -0
- data/vendor/bundle/ruby/3.2.0/gems/{ethon-0.18.0 → ethon-0.19.1}/lib/ethon/multi.rb +51 -15
- data/vendor/bundle/ruby/3.2.0/gems/{ethon-0.18.0 → ethon-0.19.1}/lib/ethon/version.rb +1 -1
- data/vendor/bundle/ruby/3.2.0/gems/{ethon-0.18.0 → ethon-0.19.1}/lib/ethon.rb +8 -9
- data/vendor/bundle/ruby/3.2.0/gems/{io-console-0.9.4 → io-console-0.9.5}/ext/io/console/console.c +8 -3
- data/vendor/bundle/ruby/3.2.0/gems/{io-console-0.9.4 → io-console-0.9.5}/ext/io/console/extconf.rb +7 -3
- data/vendor/bundle/ruby/3.2.0/gems/io-console-0.9.5/lib/io/console.so +0 -0
- data/vendor/bundle/ruby/3.2.0/gems/{typhoeus-1.6.0 → typhoeus-1.7.1}/CHANGELOG.md +228 -1
- data/vendor/bundle/ruby/3.2.0/gems/typhoeus-1.7.1/README.md +766 -0
- data/vendor/bundle/ruby/3.2.0/gems/{typhoeus-1.6.0 → typhoeus-1.7.1}/UPGRADE.md +29 -0
- data/vendor/bundle/ruby/3.2.0/gems/typhoeus-1.7.1/lib/rack/typhoeus/middleware/params_decoder/helper.rb +129 -0
- data/vendor/bundle/ruby/3.2.0/gems/{typhoeus-1.6.0 → typhoeus-1.7.1}/lib/rack/typhoeus/middleware/params_decoder.rb +8 -19
- data/vendor/bundle/ruby/3.2.0/gems/{typhoeus-1.6.0 → typhoeus-1.7.1}/lib/rack/typhoeus.rb +2 -0
- data/vendor/bundle/ruby/3.2.0/gems/{typhoeus-1.6.0 → typhoeus-1.7.1}/lib/typhoeus/adapters/faraday.rb +89 -28
- data/vendor/bundle/ruby/3.2.0/gems/{typhoeus-1.6.0 → typhoeus-1.7.1}/lib/typhoeus/cache/dalli.rb +2 -0
- data/vendor/bundle/ruby/3.2.0/gems/{typhoeus-1.6.0 → typhoeus-1.7.1}/lib/typhoeus/cache/rails.rb +3 -1
- data/vendor/bundle/ruby/3.2.0/gems/{typhoeus-1.6.0 → typhoeus-1.7.1}/lib/typhoeus/cache/redis.rb +2 -0
- data/vendor/bundle/ruby/3.2.0/gems/{typhoeus-1.6.0 → typhoeus-1.7.1}/lib/typhoeus/config.rb +51 -7
- data/vendor/bundle/ruby/3.2.0/gems/{typhoeus-1.6.0 → typhoeus-1.7.1}/lib/typhoeus/easy_factory.rb +129 -23
- data/vendor/bundle/ruby/3.2.0/gems/typhoeus-1.7.1/lib/typhoeus/errors/invalid_option.rb +23 -0
- data/vendor/bundle/ruby/3.2.0/gems/typhoeus-1.7.1/lib/typhoeus/errors/no_response.rb +18 -0
- data/vendor/bundle/ruby/3.2.0/gems/{typhoeus-1.6.0 → typhoeus-1.7.1}/lib/typhoeus/errors/no_stub.rb +8 -1
- data/vendor/bundle/ruby/3.2.0/gems/{typhoeus-1.6.0 → typhoeus-1.7.1}/lib/typhoeus/errors/typhoeus_error.rb +2 -0
- data/vendor/bundle/ruby/3.2.0/gems/{typhoeus-1.6.0 → typhoeus-1.7.1}/lib/typhoeus/errors.rb +4 -0
- data/vendor/bundle/ruby/3.2.0/gems/{typhoeus-1.6.0 → typhoeus-1.7.1}/lib/typhoeus/expectation.rb +33 -1
- data/vendor/bundle/ruby/3.2.0/gems/{typhoeus-1.6.0 → typhoeus-1.7.1}/lib/typhoeus/hydra/queueable.rb +29 -4
- data/vendor/bundle/ruby/3.2.0/gems/typhoeus-1.7.1/lib/typhoeus/hydra.rb +423 -0
- data/vendor/bundle/ruby/3.2.0/gems/typhoeus-1.7.1/lib/typhoeus/pool.rb +133 -0
- data/vendor/bundle/ruby/3.2.0/gems/{typhoeus-1.6.0 → typhoeus-1.7.1}/lib/typhoeus/railtie.rb +4 -2
- data/vendor/bundle/ruby/3.2.0/gems/{typhoeus-1.6.0 → typhoeus-1.7.1}/lib/typhoeus/request/actions.rb +2 -0
- data/vendor/bundle/ruby/3.2.0/gems/{typhoeus-1.6.0 → typhoeus-1.7.1}/lib/typhoeus/request/callbacks.rb +11 -4
- data/vendor/bundle/ruby/3.2.0/gems/{typhoeus-1.6.0 → typhoeus-1.7.1}/lib/typhoeus/request/marshal.rb +5 -2
- data/vendor/bundle/ruby/3.2.0/gems/{typhoeus-1.6.0 → typhoeus-1.7.1}/lib/typhoeus/request/streamable.rb +2 -0
- data/vendor/bundle/ruby/3.2.0/gems/typhoeus-1.7.1/lib/typhoeus/request.rb +510 -0
- data/vendor/bundle/ruby/3.2.0/gems/{typhoeus-1.6.0 → typhoeus-1.7.1}/lib/typhoeus/response/cacheable.rb +2 -0
- data/vendor/bundle/ruby/3.2.0/gems/typhoeus-1.7.1/lib/typhoeus/response/header.rb +325 -0
- data/vendor/bundle/ruby/3.2.0/gems/{typhoeus-1.6.0 → typhoeus-1.7.1}/lib/typhoeus/response/informations.rb +75 -12
- data/vendor/bundle/ruby/3.2.0/gems/{typhoeus-1.6.0 → typhoeus-1.7.1}/lib/typhoeus/response/status.rb +4 -13
- data/vendor/bundle/ruby/3.2.0/gems/{typhoeus-1.6.0 → typhoeus-1.7.1}/lib/typhoeus/response.rb +35 -0
- data/vendor/bundle/ruby/3.2.0/gems/{typhoeus-1.6.0 → typhoeus-1.7.1}/lib/typhoeus/version.rb +3 -1
- data/vendor/bundle/ruby/3.2.0/gems/typhoeus-1.7.1/lib/typhoeus.rb +206 -0
- data/vendor/bundle/ruby/3.2.0/gems/{typhoeus-1.6.0 → typhoeus-1.7.1}/typhoeus.gemspec +15 -3
- data/vendor/bundle/ruby/3.2.0/specifications/{ethon-0.18.0.gemspec → ethon-0.19.1.gemspec} +4 -4
- data/vendor/bundle/ruby/3.2.0/specifications/{io-console-0.9.4.gemspec → io-console-0.9.5.gemspec} +3 -3
- data/vendor/bundle/ruby/3.2.0/specifications/{typhoeus-1.6.0.gemspec → typhoeus-1.7.1.gemspec} +5 -5
- metadata +156 -129
- data/vendor/bundle/ruby/3.2.0/cache/ethon-0.18.0.gem +0 -0
- data/vendor/bundle/ruby/3.2.0/cache/io-console-0.9.4.gem +0 -0
- data/vendor/bundle/ruby/3.2.0/cache/typhoeus-1.6.0.gem +0 -0
- data/vendor/bundle/ruby/3.2.0/extensions/x86_64-linux/3.2.0/io-console-0.9.4/io/console.so +0 -0
- data/vendor/bundle/ruby/3.2.0/gems/ethon-0.18.0/CHANGELOG.md +0 -417
- data/vendor/bundle/ruby/3.2.0/gems/ethon-0.18.0/README.md +0 -118
- data/vendor/bundle/ruby/3.2.0/gems/ethon-0.18.0/lib/ethon/curls/classes.rb +0 -65
- data/vendor/bundle/ruby/3.2.0/gems/ethon-0.18.0/lib/ethon/curls/functions.rb +0 -58
- data/vendor/bundle/ruby/3.2.0/gems/ethon-0.18.0/lib/ethon/curls/settings.rb +0 -12
- data/vendor/bundle/ruby/3.2.0/gems/ethon-0.18.0/lib/ethon/easy/callbacks.rb +0 -155
- data/vendor/bundle/ruby/3.2.0/gems/ethon-0.18.0/lib/ethon/easy/header.rb +0 -61
- data/vendor/bundle/ruby/3.2.0/gems/ethon-0.18.0/lib/ethon/easy/http/putable.rb +0 -25
- data/vendor/bundle/ruby/3.2.0/gems/ethon-0.18.0/lib/ethon/easy/mirror.rb +0 -36
- data/vendor/bundle/ruby/3.2.0/gems/ethon-0.18.0/lib/ethon/easy/operations.rb +0 -64
- data/vendor/bundle/ruby/3.2.0/gems/ethon-0.18.0/lib/ethon/easy/options.rb +0 -50
- data/vendor/bundle/ruby/3.2.0/gems/ethon-0.18.0/lib/ethon/easy/util.rb +0 -28
- data/vendor/bundle/ruby/3.2.0/gems/ethon-0.18.0/lib/ethon/errors/invalid_value.rb +0 -13
- data/vendor/bundle/ruby/3.2.0/gems/ethon-0.18.0/lib/ethon/libc.rb +0 -21
- data/vendor/bundle/ruby/3.2.0/gems/ethon-0.18.0/lib/ethon/multi/operations.rb +0 -228
- data/vendor/bundle/ruby/3.2.0/gems/ethon-0.18.0/lib/ethon/multi/options.rb +0 -117
- data/vendor/bundle/ruby/3.2.0/gems/ethon-0.18.0/lib/ethon/multi/stack.rb +0 -49
- data/vendor/bundle/ruby/3.2.0/gems/io-console-0.9.4/lib/io/console.so +0 -0
- data/vendor/bundle/ruby/3.2.0/gems/typhoeus-1.6.0/README.md +0 -588
- data/vendor/bundle/ruby/3.2.0/gems/typhoeus-1.6.0/lib/rack/typhoeus/middleware/params_decoder/helper.rb +0 -76
- data/vendor/bundle/ruby/3.2.0/gems/typhoeus-1.6.0/lib/typhoeus/hydra/addable.rb +0 -23
- data/vendor/bundle/ruby/3.2.0/gems/typhoeus-1.6.0/lib/typhoeus/hydra/before.rb +0 -31
- data/vendor/bundle/ruby/3.2.0/gems/typhoeus-1.6.0/lib/typhoeus/hydra/block_connection.rb +0 -35
- data/vendor/bundle/ruby/3.2.0/gems/typhoeus-1.6.0/lib/typhoeus/hydra/cacheable.rb +0 -15
- data/vendor/bundle/ruby/3.2.0/gems/typhoeus-1.6.0/lib/typhoeus/hydra/memoizable.rb +0 -56
- data/vendor/bundle/ruby/3.2.0/gems/typhoeus-1.6.0/lib/typhoeus/hydra/runnable.rb +0 -19
- data/vendor/bundle/ruby/3.2.0/gems/typhoeus-1.6.0/lib/typhoeus/hydra/stubbable.rb +0 -28
- data/vendor/bundle/ruby/3.2.0/gems/typhoeus-1.6.0/lib/typhoeus/hydra.rb +0 -95
- data/vendor/bundle/ruby/3.2.0/gems/typhoeus-1.6.0/lib/typhoeus/pool.rb +0 -70
- data/vendor/bundle/ruby/3.2.0/gems/typhoeus-1.6.0/lib/typhoeus/request/before.rb +0 -30
- data/vendor/bundle/ruby/3.2.0/gems/typhoeus-1.6.0/lib/typhoeus/request/block_connection.rb +0 -52
- data/vendor/bundle/ruby/3.2.0/gems/typhoeus-1.6.0/lib/typhoeus/request/cacheable.rb +0 -38
- data/vendor/bundle/ruby/3.2.0/gems/typhoeus-1.6.0/lib/typhoeus/request/memoizable.rb +0 -38
- data/vendor/bundle/ruby/3.2.0/gems/typhoeus-1.6.0/lib/typhoeus/request/operations.rb +0 -40
- data/vendor/bundle/ruby/3.2.0/gems/typhoeus-1.6.0/lib/typhoeus/request/responseable.rb +0 -29
- data/vendor/bundle/ruby/3.2.0/gems/typhoeus-1.6.0/lib/typhoeus/request/stubbable.rb +0 -30
- data/vendor/bundle/ruby/3.2.0/gems/typhoeus-1.6.0/lib/typhoeus/request.rb +0 -223
- data/vendor/bundle/ruby/3.2.0/gems/typhoeus-1.6.0/lib/typhoeus/response/header.rb +0 -105
- data/vendor/bundle/ruby/3.2.0/gems/typhoeus-1.6.0/lib/typhoeus.rb +0 -143
- /data/vendor/bundle/ruby/3.2.0/extensions/x86_64-linux/3.2.0/{io-console-0.9.4 → io-console-0.9.5}/gem.build_complete +0 -0
- /data/vendor/bundle/ruby/3.2.0/gems/{ethon-0.18.0 → ethon-0.19.1}/LICENSE +0 -0
- /data/vendor/bundle/ruby/3.2.0/gems/{ethon-0.18.0 → ethon-0.19.1}/ethon.gemspec +0 -0
- /data/vendor/bundle/ruby/3.2.0/gems/{ethon-0.18.0 → ethon-0.19.1}/lib/ethon/curls/messages.rb +0 -0
- /data/vendor/bundle/ruby/3.2.0/gems/{ethon-0.18.0 → ethon-0.19.1}/lib/ethon/easy/debug_info.rb +0 -0
- /data/vendor/bundle/ruby/3.2.0/gems/{ethon-0.18.0 → ethon-0.19.1}/lib/ethon/easy/http/custom.rb +0 -0
- /data/vendor/bundle/ruby/3.2.0/gems/{ethon-0.18.0 → ethon-0.19.1}/lib/ethon/easy/http/delete.rb +0 -0
- /data/vendor/bundle/ruby/3.2.0/gems/{ethon-0.18.0 → ethon-0.19.1}/lib/ethon/easy/http/head.rb +0 -0
- /data/vendor/bundle/ruby/3.2.0/gems/{ethon-0.18.0 → ethon-0.19.1}/lib/ethon/easy/http/options.rb +0 -0
- /data/vendor/bundle/ruby/3.2.0/gems/{ethon-0.18.0 → ethon-0.19.1}/lib/ethon/easy/http/patch.rb +0 -0
- /data/vendor/bundle/ruby/3.2.0/gems/{ethon-0.18.0 → ethon-0.19.1}/lib/ethon/easy/http/put.rb +0 -0
- /data/vendor/bundle/ruby/3.2.0/gems/{ethon-0.18.0 → ethon-0.19.1}/lib/ethon/easy/params.rb +0 -0
- /data/vendor/bundle/ruby/3.2.0/gems/{ethon-0.18.0 → ethon-0.19.1}/lib/ethon/errors/ethon_error.rb +0 -0
- /data/vendor/bundle/ruby/3.2.0/gems/{io-console-0.9.4 → io-console-0.9.5}/.document +0 -0
- /data/vendor/bundle/ruby/3.2.0/gems/{io-console-0.9.4 → io-console-0.9.5}/BSDL +0 -0
- /data/vendor/bundle/ruby/3.2.0/gems/{io-console-0.9.4 → io-console-0.9.5}/COPYING +0 -0
- /data/vendor/bundle/ruby/3.2.0/gems/{io-console-0.9.4 → io-console-0.9.5}/README.md +0 -0
- /data/vendor/bundle/ruby/3.2.0/gems/{io-console-0.9.4 → io-console-0.9.5}/ext/io/console/Makefile +0 -0
- /data/vendor/bundle/ruby/3.2.0/gems/{io-console-0.9.4 → io-console-0.9.5}/ext/io/console/win32_vk.inc +0 -0
- /data/vendor/bundle/ruby/3.2.0/gems/{io-console-0.9.4 → io-console-0.9.5}/lib/io/console/size.rb +0 -0
- /data/vendor/bundle/ruby/3.2.0/gems/{typhoeus-1.6.0 → typhoeus-1.7.1}/CONTRIBUTING.md +0 -0
- /data/vendor/bundle/ruby/3.2.0/gems/{typhoeus-1.6.0 → typhoeus-1.7.1}/LICENSE +0 -0
|
@@ -0,0 +1,472 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
module Ethon
|
|
3
|
+
class Multi # :nodoc
|
|
4
|
+
# This module contains logic to run a multi.
|
|
5
|
+
module Operations
|
|
6
|
+
STARTED_MULTI = "ETHON: started MULTI"
|
|
7
|
+
PERFORMED_MULTI = "ETHON: performed MULTI"
|
|
8
|
+
|
|
9
|
+
# Return the multi handle. Inititialize multi handle,
|
|
10
|
+
# in case it didn't happened already.
|
|
11
|
+
#
|
|
12
|
+
# @example Return multi handle.
|
|
13
|
+
# multi.handle
|
|
14
|
+
#
|
|
15
|
+
# @return [ FFI::Pointer ] The multi handle.
|
|
16
|
+
def handle
|
|
17
|
+
ensure_not_cleaned_up!
|
|
18
|
+
|
|
19
|
+
handle = @handle ||= begin
|
|
20
|
+
# Enforce fork safety before creating a handle for a Multi that was
|
|
21
|
+
# constructed before the fork but never touched.
|
|
22
|
+
Curl.check_pid!
|
|
23
|
+
pointer = Curl.multi_init
|
|
24
|
+
raise NoMemoryError, "curl_multi_init failed" if pointer.null?
|
|
25
|
+
Curl::MultiHandle.new(pointer)
|
|
26
|
+
end
|
|
27
|
+
handle.check_pid!
|
|
28
|
+
handle
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
# Clean up the multi.
|
|
32
|
+
#
|
|
33
|
+
# Removes all attached easy handles before freeing the native multi
|
|
34
|
+
# handle. Cleanup is terminal: the Multi cannot be used afterwards.
|
|
35
|
+
#
|
|
36
|
+
# @return [ nil ]
|
|
37
|
+
def cleanup
|
|
38
|
+
ensure_not_cleaned_up!
|
|
39
|
+
ensure_not_executing!
|
|
40
|
+
# A handle created before a fork must not be released in the child.
|
|
41
|
+
@handle.check_pid! if @handle
|
|
42
|
+
|
|
43
|
+
error = nil
|
|
44
|
+
begin
|
|
45
|
+
stack.dup.each do |easy|
|
|
46
|
+
begin
|
|
47
|
+
delete(easy)
|
|
48
|
+
rescue StandardError => e
|
|
49
|
+
# Keep detaching the other handles. A failed close or native
|
|
50
|
+
# detach must not strand every remaining handle on a Multi whose
|
|
51
|
+
# native handle is about to be freed.
|
|
52
|
+
error ||= e
|
|
53
|
+
end
|
|
54
|
+
end
|
|
55
|
+
ensure
|
|
56
|
+
# Cleanup is terminal. Release the native handle even when detaching
|
|
57
|
+
# one of the easy handles fails. Handles that could not be detached
|
|
58
|
+
# keep their multi ownership so they cannot be reused unsafely.
|
|
59
|
+
begin
|
|
60
|
+
@handle.free if @handle
|
|
61
|
+
ensure
|
|
62
|
+
stack.each do |easy|
|
|
63
|
+
begin
|
|
64
|
+
easy.finish_response_body_io
|
|
65
|
+
rescue StandardError
|
|
66
|
+
# Cleanup is best effort; keep tearing down the multi even if
|
|
67
|
+
# closing a streamed response fails.
|
|
68
|
+
end
|
|
69
|
+
end
|
|
70
|
+
stack.clear
|
|
71
|
+
@handle = nil
|
|
72
|
+
@running_count = nil
|
|
73
|
+
@assigned_sockets = nil
|
|
74
|
+
@procs = nil
|
|
75
|
+
@cleaned_up = true
|
|
76
|
+
end
|
|
77
|
+
end
|
|
78
|
+
raise error if error
|
|
79
|
+
end
|
|
80
|
+
|
|
81
|
+
# Initialize variables.
|
|
82
|
+
#
|
|
83
|
+
# @example Initialize variables.
|
|
84
|
+
# multi.init_vars
|
|
85
|
+
#
|
|
86
|
+
# @return [ void ]
|
|
87
|
+
def init_vars
|
|
88
|
+
if @execution_mode == :perform
|
|
89
|
+
@timeout = ::FFI::MemoryPointer.new(:long)
|
|
90
|
+
@running_count_pointer = ::FFI::MemoryPointer.new(:int)
|
|
91
|
+
@msgs_left = ::FFI::MemoryPointer.new(:int)
|
|
92
|
+
@wait_strategy = if Curl.respond_to?(:multi_poll)
|
|
93
|
+
:poll
|
|
94
|
+
elsif Curl.respond_to?(:multi_wait)
|
|
95
|
+
:wait
|
|
96
|
+
else
|
|
97
|
+
:select
|
|
98
|
+
end
|
|
99
|
+
|
|
100
|
+
if @wait_strategy == :select
|
|
101
|
+
@timeval = Curl::Timeval.new
|
|
102
|
+
@fd_read = Curl::FDSet.new
|
|
103
|
+
@fd_write = Curl::FDSet.new
|
|
104
|
+
@fd_excep = Curl::FDSet.new
|
|
105
|
+
@max_fd = ::FFI::MemoryPointer.new(:int)
|
|
106
|
+
end
|
|
107
|
+
elsif @execution_mode == :socket_action
|
|
108
|
+
@running_count_pointer = FFI::MemoryPointer.new(:int)
|
|
109
|
+
@msgs_left = FFI::MemoryPointer.new(:int)
|
|
110
|
+
end
|
|
111
|
+
end
|
|
112
|
+
|
|
113
|
+
# Perform multi.
|
|
114
|
+
#
|
|
115
|
+
# @return [ nil ]
|
|
116
|
+
#
|
|
117
|
+
# @example Perform multi.
|
|
118
|
+
# multi.perform
|
|
119
|
+
def perform
|
|
120
|
+
ensure_execution_mode(:perform)
|
|
121
|
+
ensure_not_cleaned_up!
|
|
122
|
+
ensure_not_executing!
|
|
123
|
+
|
|
124
|
+
Ethon.logger.debug(STARTED_MULTI)
|
|
125
|
+
@executing = true
|
|
126
|
+
begin
|
|
127
|
+
while ongoing?
|
|
128
|
+
run
|
|
129
|
+
timeout = get_timeout
|
|
130
|
+
next if timeout == 0
|
|
131
|
+
case @wait_strategy
|
|
132
|
+
when :poll
|
|
133
|
+
poll(timeout)
|
|
134
|
+
when :wait
|
|
135
|
+
wait(timeout)
|
|
136
|
+
else
|
|
137
|
+
reset_fds
|
|
138
|
+
set_fds(timeout)
|
|
139
|
+
end
|
|
140
|
+
end
|
|
141
|
+
ensure
|
|
142
|
+
@executing = false
|
|
143
|
+
end
|
|
144
|
+
Ethon.logger.debug(PERFORMED_MULTI)
|
|
145
|
+
nil
|
|
146
|
+
end
|
|
147
|
+
|
|
148
|
+
# Prepare multi.
|
|
149
|
+
#
|
|
150
|
+
# @return [ nil ]
|
|
151
|
+
#
|
|
152
|
+
# @example Prepare multi.
|
|
153
|
+
# multi.prepare
|
|
154
|
+
#
|
|
155
|
+
# @deprecated It is no longer necessary to call prepare.
|
|
156
|
+
def prepare
|
|
157
|
+
Ethon.logger.warn(
|
|
158
|
+
"ETHON: It is no longer necessary to call "+
|
|
159
|
+
"Multi#prepare. It's going to be removed "+
|
|
160
|
+
"in future versions."
|
|
161
|
+
)
|
|
162
|
+
end
|
|
163
|
+
|
|
164
|
+
# Wait for activity on the multi's sockets.
|
|
165
|
+
#
|
|
166
|
+
# @example Wait up to one second.
|
|
167
|
+
# multi.wait(1000)
|
|
168
|
+
#
|
|
169
|
+
# @param [ Integer ] timeout_ms Maximum time to wait in milliseconds.
|
|
170
|
+
#
|
|
171
|
+
# @return [ Integer ] Number of file descriptors with activity.
|
|
172
|
+
def wait(timeout_ms = 1000)
|
|
173
|
+
unless Curl.respond_to?(:multi_wait)
|
|
174
|
+
raise NotImplementedError, "curl_multi_wait is not supported by this libcurl"
|
|
175
|
+
end
|
|
176
|
+
|
|
177
|
+
numfds = (@numfds ||= ::FFI::MemoryPointer.new(:int))
|
|
178
|
+
code = Curl.multi_wait(handle, ::FFI::Pointer::NULL, 0, timeout_ms, numfds)
|
|
179
|
+
raise Errors::MultiWait.new(code) unless code == :ok
|
|
180
|
+
|
|
181
|
+
numfds.read_int
|
|
182
|
+
end
|
|
183
|
+
|
|
184
|
+
# Wait for activity using curl_multi_poll.
|
|
185
|
+
#
|
|
186
|
+
# @param [ Integer ] timeout_ms Maximum time to wait in milliseconds.
|
|
187
|
+
#
|
|
188
|
+
# @return [ Integer ] Number of file descriptors with activity.
|
|
189
|
+
def poll(timeout_ms = 1000)
|
|
190
|
+
unless Curl.respond_to?(:multi_poll)
|
|
191
|
+
raise NotImplementedError, "curl_multi_poll is not supported by this libcurl"
|
|
192
|
+
end
|
|
193
|
+
|
|
194
|
+
numfds = (@numfds ||= ::FFI::MemoryPointer.new(:int))
|
|
195
|
+
code = Curl.multi_poll(handle, ::FFI::Pointer::NULL, 0, timeout_ms, numfds)
|
|
196
|
+
raise Errors::MultiPoll.new(code) unless code == :ok
|
|
197
|
+
|
|
198
|
+
numfds.read_int
|
|
199
|
+
end
|
|
200
|
+
|
|
201
|
+
# Wake up a multi handle blocked in curl_multi_poll.
|
|
202
|
+
#
|
|
203
|
+
# @return [ Symbol ] The Curl multi return code.
|
|
204
|
+
def wakeup
|
|
205
|
+
unless Curl.respond_to?(:multi_wakeup)
|
|
206
|
+
raise NotImplementedError, "curl_multi_wakeup is not supported by this libcurl"
|
|
207
|
+
end
|
|
208
|
+
|
|
209
|
+
code = Curl.multi_wakeup(handle)
|
|
210
|
+
raise Errors::MultiWakeup.new(code) unless code == :ok
|
|
211
|
+
|
|
212
|
+
code
|
|
213
|
+
end
|
|
214
|
+
|
|
215
|
+
# Continue execution with an external IO loop.
|
|
216
|
+
#
|
|
217
|
+
# @example When no sockets are ready yet, or to begin.
|
|
218
|
+
# multi.socket_action
|
|
219
|
+
#
|
|
220
|
+
# @example When a socket is readable
|
|
221
|
+
# multi.socket_action(io_object, [:in])
|
|
222
|
+
#
|
|
223
|
+
# @example When a socket is readable and writable
|
|
224
|
+
# multi.socket_action(io_object, [:in, :out])
|
|
225
|
+
#
|
|
226
|
+
# @param [ IO, Integer, nil ] io The socket to act on, or nil for the
|
|
227
|
+
# timeout case.
|
|
228
|
+
# @param [ Integer, Symbol, Array ] readiness CURL_CSELECT_* readiness
|
|
229
|
+
# bits, either as a number or as symbols such as :in and :out.
|
|
230
|
+
#
|
|
231
|
+
# @return [ Symbol ] The Curl.multi_socket_action return code.
|
|
232
|
+
def socket_action(io = nil, readiness = 0)
|
|
233
|
+
ensure_execution_mode(:socket_action)
|
|
234
|
+
ensure_not_cleaned_up!
|
|
235
|
+
ensure_not_executing!
|
|
236
|
+
|
|
237
|
+
fd = if io.nil?
|
|
238
|
+
::Ethon::Curl::SOCKET_TIMEOUT
|
|
239
|
+
elsif io.is_a?(Integer)
|
|
240
|
+
io
|
|
241
|
+
else
|
|
242
|
+
io.fileno
|
|
243
|
+
end
|
|
244
|
+
|
|
245
|
+
@executing = true
|
|
246
|
+
begin
|
|
247
|
+
code = Curl.multi_socket_action(handle, fd, readiness, @running_count_pointer)
|
|
248
|
+
@running_count = @running_count_pointer.read_int
|
|
249
|
+
|
|
250
|
+
check
|
|
251
|
+
|
|
252
|
+
code
|
|
253
|
+
ensure
|
|
254
|
+
@executing = false
|
|
255
|
+
end
|
|
256
|
+
end
|
|
257
|
+
|
|
258
|
+
# Return whether the multi still contains requests or not.
|
|
259
|
+
#
|
|
260
|
+
# @example Return if ongoing.
|
|
261
|
+
# multi.ongoing?
|
|
262
|
+
#
|
|
263
|
+
# @return [ Boolean ] True if ongoing, else false.
|
|
264
|
+
def ongoing?
|
|
265
|
+
stack.size > 0 || (running_count || 0) > 0
|
|
266
|
+
end
|
|
267
|
+
|
|
268
|
+
# Associate an arbitrary pointer with a socket in the multi handle.
|
|
269
|
+
#
|
|
270
|
+
# @param [ Integer, IO ] io The socket descriptor.
|
|
271
|
+
# @param [ FFI::Pointer, nil ] pointer The pointer to associate, or nil
|
|
272
|
+
# to clear it.
|
|
273
|
+
#
|
|
274
|
+
# @return [ Symbol ] The Curl multi return code.
|
|
275
|
+
def assign(io, pointer)
|
|
276
|
+
unless pointer.nil? || pointer.is_a?(::FFI::Pointer)
|
|
277
|
+
raise Errors::InvalidValue.new(:assign, pointer)
|
|
278
|
+
end
|
|
279
|
+
# A freed wrapper still looks like a pointer, but libcurl would keep
|
|
280
|
+
# the dangling address.
|
|
281
|
+
if pointer.is_a?(Ethon::Curl::OwnedPointer)
|
|
282
|
+
pointer.check_pid!
|
|
283
|
+
end
|
|
284
|
+
|
|
285
|
+
socket = io.respond_to?(:fileno) ? io.fileno : io
|
|
286
|
+
# FFI would reject a non-integer descriptor with a TypeError instead
|
|
287
|
+
# of the error Ethon uses for invalid option values.
|
|
288
|
+
unless socket.is_a?(Integer)
|
|
289
|
+
raise Errors::InvalidValue.new(:assign, io)
|
|
290
|
+
end
|
|
291
|
+
code = Curl.multi_assign(handle, socket, pointer)
|
|
292
|
+
raise Errors::MultiAssign.new(code) unless code == :ok
|
|
293
|
+
|
|
294
|
+
# libcurl keeps the pointer until the socket is removed or assigned
|
|
295
|
+
# again, so keep it alive from Ruby as well.
|
|
296
|
+
if pointer.nil? || pointer.null?
|
|
297
|
+
(@assigned_sockets ||= {}).delete(socket)
|
|
298
|
+
else
|
|
299
|
+
(@assigned_sockets ||= {})[socket] = pointer
|
|
300
|
+
end
|
|
301
|
+
|
|
302
|
+
code
|
|
303
|
+
end
|
|
304
|
+
|
|
305
|
+
# Return the easy handles currently attached natively.
|
|
306
|
+
#
|
|
307
|
+
# @return [ Array<FFI::Pointer> ] Native easy handles.
|
|
308
|
+
def native_handles
|
|
309
|
+
unless Curl.respond_to?(:multi_get_handles)
|
|
310
|
+
raise NotImplementedError, "curl_multi_get_handles is not supported by this libcurl"
|
|
311
|
+
end
|
|
312
|
+
|
|
313
|
+
pointer = Curl.multi_get_handles(handle)
|
|
314
|
+
raise NoMemoryError, "curl_multi_get_handles failed" if pointer.null?
|
|
315
|
+
|
|
316
|
+
begin
|
|
317
|
+
handles = []
|
|
318
|
+
offset = 0
|
|
319
|
+
loop do
|
|
320
|
+
easy = pointer.get_pointer(offset)
|
|
321
|
+
break if easy.null?
|
|
322
|
+
|
|
323
|
+
handles << easy
|
|
324
|
+
offset += ::FFI.type_size(:pointer)
|
|
325
|
+
end
|
|
326
|
+
handles
|
|
327
|
+
ensure
|
|
328
|
+
Curl.free(pointer)
|
|
329
|
+
end
|
|
330
|
+
end
|
|
331
|
+
|
|
332
|
+
private
|
|
333
|
+
|
|
334
|
+
def ensure_not_cleaned_up!
|
|
335
|
+
return unless @cleaned_up
|
|
336
|
+
raise Errors::EthonError, "Multi has been cleaned up"
|
|
337
|
+
end
|
|
338
|
+
|
|
339
|
+
def ensure_not_executing!
|
|
340
|
+
return unless @executing
|
|
341
|
+
|
|
342
|
+
raise Errors::EthonError, "Multi is currently executing; wait for it to finish"
|
|
343
|
+
end
|
|
344
|
+
|
|
345
|
+
# Get timeout.
|
|
346
|
+
#
|
|
347
|
+
# @example Get timeout.
|
|
348
|
+
# multi.get_timeout
|
|
349
|
+
#
|
|
350
|
+
# @return [ Integer ] The timeout.
|
|
351
|
+
#
|
|
352
|
+
# @raise [ Ethon::Errors::MultiTimeout ] If getting the timeout fails.
|
|
353
|
+
def get_timeout
|
|
354
|
+
code = Curl.multi_timeout(handle, @timeout)
|
|
355
|
+
raise Errors::MultiTimeout.new(code) unless code == :ok
|
|
356
|
+
timeout = @timeout.read_long
|
|
357
|
+
timeout = 1 if timeout < 0
|
|
358
|
+
timeout
|
|
359
|
+
end
|
|
360
|
+
|
|
361
|
+
# Reset file describtors.
|
|
362
|
+
#
|
|
363
|
+
# @example Reset fds.
|
|
364
|
+
# multi.reset_fds
|
|
365
|
+
#
|
|
366
|
+
# @return [ void ]
|
|
367
|
+
def reset_fds
|
|
368
|
+
@fd_read.clear
|
|
369
|
+
@fd_write.clear
|
|
370
|
+
@fd_excep.clear
|
|
371
|
+
end
|
|
372
|
+
|
|
373
|
+
# Set fds.
|
|
374
|
+
#
|
|
375
|
+
# @example Set fds.
|
|
376
|
+
# multi.set_fds
|
|
377
|
+
#
|
|
378
|
+
# @return [ void ]
|
|
379
|
+
#
|
|
380
|
+
# @raise [ Ethon::Errors::MultiFdset ] If setting the file descriptors fails.
|
|
381
|
+
# @raise [ Ethon::Errors::Select ] If select fails.
|
|
382
|
+
def set_fds(timeout)
|
|
383
|
+
code = Curl.multi_fdset(handle, @fd_read, @fd_write, @fd_excep, @max_fd)
|
|
384
|
+
raise Errors::MultiFdset.new(code) unless code == :ok
|
|
385
|
+
max_fd = @max_fd.read_int
|
|
386
|
+
if max_fd == -1
|
|
387
|
+
# No sockets are ready; wait for the timer instead of spinning.
|
|
388
|
+
sleep(timeout / 1000.0)
|
|
389
|
+
else
|
|
390
|
+
@timeval[:sec] = timeout / 1000
|
|
391
|
+
@timeval[:usec] = (timeout * 1000) % 1000000
|
|
392
|
+
loop do
|
|
393
|
+
code = Curl.select(max_fd + 1, @fd_read, @fd_write, @fd_excep, @timeval)
|
|
394
|
+
break unless code < 0 && ::FFI.errno == Errno::EINTR::Errno
|
|
395
|
+
end
|
|
396
|
+
raise Errors::Select.new(::FFI.errno) if code < 0
|
|
397
|
+
end
|
|
398
|
+
end
|
|
399
|
+
|
|
400
|
+
# Check.
|
|
401
|
+
#
|
|
402
|
+
# @example Check.
|
|
403
|
+
# multi.check
|
|
404
|
+
#
|
|
405
|
+
# @return [ void ]
|
|
406
|
+
def check
|
|
407
|
+
msgs_left = (@msgs_left ||= ::FFI::MemoryPointer.new(:int))
|
|
408
|
+
while true
|
|
409
|
+
msg = Curl.multi_info_read(handle, msgs_left)
|
|
410
|
+
break if msg.null?
|
|
411
|
+
next if msg[:code] != :done
|
|
412
|
+
easy = stack.find{ |e| e.handle == msg[:easy_handle] }
|
|
413
|
+
# The handle may have been removed between the transfer finishing and
|
|
414
|
+
# the completion message being read.
|
|
415
|
+
next unless easy
|
|
416
|
+
easy.return_code = msg[:data][:code]
|
|
417
|
+
Ethon.logger.debug { "ETHON: performed #{easy.log_inspect}" }
|
|
418
|
+
# delete finishes the transfer's response stream. A failed close or
|
|
419
|
+
# flush must not keep on_complete from running; raise it afterwards.
|
|
420
|
+
teardown_error = nil
|
|
421
|
+
begin
|
|
422
|
+
delete(easy)
|
|
423
|
+
rescue Exception => exception
|
|
424
|
+
# A handle that libcurl still owns must stay tracked for cleanup.
|
|
425
|
+
raise if stack.include?(easy)
|
|
426
|
+
|
|
427
|
+
teardown_error = exception
|
|
428
|
+
end
|
|
429
|
+
easy.complete
|
|
430
|
+
easy.raise_callback_error
|
|
431
|
+
raise teardown_error if teardown_error
|
|
432
|
+
end
|
|
433
|
+
end
|
|
434
|
+
|
|
435
|
+
# Run.
|
|
436
|
+
#
|
|
437
|
+
# @example Run
|
|
438
|
+
# multi.run
|
|
439
|
+
#
|
|
440
|
+
# @return [ void ]
|
|
441
|
+
def run
|
|
442
|
+
running_count_pointer = (@running_count_pointer ||= ::FFI::MemoryPointer.new(:int))
|
|
443
|
+
begin code = trigger(running_count_pointer) end while code == :call_multi_perform
|
|
444
|
+
raise Errors::MultiPerform.new(code) unless code == :ok
|
|
445
|
+
|
|
446
|
+
check
|
|
447
|
+
end
|
|
448
|
+
|
|
449
|
+
# Trigger.
|
|
450
|
+
#
|
|
451
|
+
# @example Trigger.
|
|
452
|
+
# multi.trigger
|
|
453
|
+
#
|
|
454
|
+
# @return [ Symbol ] The Curl.multi_perform return code.
|
|
455
|
+
def trigger(running_count_pointer)
|
|
456
|
+
code = Curl.multi_perform(handle, running_count_pointer)
|
|
457
|
+
@running_count = running_count_pointer.read_int
|
|
458
|
+
code
|
|
459
|
+
end
|
|
460
|
+
|
|
461
|
+
# Return number of running requests.
|
|
462
|
+
#
|
|
463
|
+
# @example Return count.
|
|
464
|
+
# multi.running_count
|
|
465
|
+
#
|
|
466
|
+
# @return [ Integer ] Number running requests.
|
|
467
|
+
def running_count
|
|
468
|
+
@running_count
|
|
469
|
+
end
|
|
470
|
+
end
|
|
471
|
+
end
|
|
472
|
+
end
|
|
@@ -0,0 +1,219 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
module Ethon
|
|
3
|
+
class Multi
|
|
4
|
+
|
|
5
|
+
# This module contains the logic and knowledge about the
|
|
6
|
+
# available options on multi.
|
|
7
|
+
module Options
|
|
8
|
+
|
|
9
|
+
# Sets max_total_connections option.
|
|
10
|
+
#
|
|
11
|
+
# @example Set max_total_connections option.
|
|
12
|
+
# multi.max_total_connections = $value
|
|
13
|
+
#
|
|
14
|
+
# @param [ Integer ] value The value to set.
|
|
15
|
+
#
|
|
16
|
+
# @return [ void ]
|
|
17
|
+
def max_total_connections=(value)
|
|
18
|
+
Curl.set_option(:max_total_connections, value_for(value, :int, :max_total_connections), handle, :multi)
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
# Sets max_concurrent_streams option.
|
|
22
|
+
#
|
|
23
|
+
# @example Set max_concurrent_streams option.
|
|
24
|
+
# multi.max_concurrent_streams = $value
|
|
25
|
+
#
|
|
26
|
+
# @param [ Integer ] value The value to set.
|
|
27
|
+
#
|
|
28
|
+
# @return [ void ]
|
|
29
|
+
def max_concurrent_streams=(value)
|
|
30
|
+
Curl.set_option(:max_concurrent_streams, value_for(value, :int, :max_concurrent_streams), handle, :multi)
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
# Sets maxconnects option.
|
|
34
|
+
#
|
|
35
|
+
# An explicit value also disables the automatic sizing described in
|
|
36
|
+
# #raise_default_maxconnects.
|
|
37
|
+
#
|
|
38
|
+
# @example Set maxconnects option.
|
|
39
|
+
# multi.maxconnects = $value
|
|
40
|
+
#
|
|
41
|
+
# @param [ Integer ] value The value to set.
|
|
42
|
+
#
|
|
43
|
+
# @return [ void ]
|
|
44
|
+
def maxconnects=(value)
|
|
45
|
+
@maxconnects_configured = true unless value.nil?
|
|
46
|
+
set_maxconnects(value)
|
|
47
|
+
end
|
|
48
|
+
|
|
49
|
+
# Sets max_host_connections option.
|
|
50
|
+
#
|
|
51
|
+
# @example Set max_host_connections option.
|
|
52
|
+
# multi.max_host_connections = $value
|
|
53
|
+
#
|
|
54
|
+
# @param [ Integer ] value The value to set.
|
|
55
|
+
#
|
|
56
|
+
# @return [ void ]
|
|
57
|
+
def max_host_connections=(value)
|
|
58
|
+
Curl.set_option(:max_host_connections, value_for(value, :int, :max_host_connections), handle, :multi)
|
|
59
|
+
end
|
|
60
|
+
|
|
61
|
+
# Sets max_pipeline_length option.
|
|
62
|
+
#
|
|
63
|
+
# @example Set max_pipeline_length option.
|
|
64
|
+
# multi.max_pipeline_length = $value
|
|
65
|
+
#
|
|
66
|
+
# @param [ Integer ] value The value to set.
|
|
67
|
+
#
|
|
68
|
+
# @return [ void ]
|
|
69
|
+
def max_pipeline_length=(value)
|
|
70
|
+
Curl.set_option(:max_pipeline_length, value_for(value, :int, :max_pipeline_length), handle, :multi)
|
|
71
|
+
end
|
|
72
|
+
|
|
73
|
+
# Sets content_length_penalty_size option.
|
|
74
|
+
#
|
|
75
|
+
# @example Set content_length_penalty_size option.
|
|
76
|
+
# multi.content_length_penalty_size = $value
|
|
77
|
+
#
|
|
78
|
+
# @param [ Integer ] value The value to set.
|
|
79
|
+
#
|
|
80
|
+
# @return [ void ]
|
|
81
|
+
def content_length_penalty_size=(value)
|
|
82
|
+
Curl.set_option(:content_length_penalty_size, value, handle, :multi)
|
|
83
|
+
end
|
|
84
|
+
|
|
85
|
+
# Sets chunk_length_penalty_size option.
|
|
86
|
+
#
|
|
87
|
+
# @example Set chunk_length_penalty_size option.
|
|
88
|
+
# multi.chunk_length_penalty_size = $value
|
|
89
|
+
#
|
|
90
|
+
# @param [ Integer ] value The value to set.
|
|
91
|
+
#
|
|
92
|
+
# @return [ void ]
|
|
93
|
+
def chunk_length_penalty_size=(value)
|
|
94
|
+
Curl.set_option(:chunk_length_penalty_size, value, handle, :multi)
|
|
95
|
+
end
|
|
96
|
+
|
|
97
|
+
# Sets pipelining option.
|
|
98
|
+
#
|
|
99
|
+
# @example Set pipelining option.
|
|
100
|
+
# multi.pipelining = $value
|
|
101
|
+
#
|
|
102
|
+
# @param [ Integer ] value The value to set.
|
|
103
|
+
#
|
|
104
|
+
# @return [ void ]
|
|
105
|
+
def pipelining=(value)
|
|
106
|
+
Curl.set_option(:pipelining, value_for(value, :int, :pipelining), handle, :multi)
|
|
107
|
+
end
|
|
108
|
+
|
|
109
|
+
# Sets socketdata option.
|
|
110
|
+
#
|
|
111
|
+
# @example Set socketdata option.
|
|
112
|
+
# multi.socketdata = $value
|
|
113
|
+
#
|
|
114
|
+
# @param [ FFI::Pointer, nil ] value The value to set.
|
|
115
|
+
#
|
|
116
|
+
# @return [ void ]
|
|
117
|
+
def socketdata=(value)
|
|
118
|
+
Curl.set_option(:socketdata, value_for(value, :string), handle, :multi)
|
|
119
|
+
end
|
|
120
|
+
|
|
121
|
+
# Sets socketfunction option.
|
|
122
|
+
#
|
|
123
|
+
# @example Set socketfunction option.
|
|
124
|
+
# multi.socketfunction = $value
|
|
125
|
+
#
|
|
126
|
+
# @param [ Proc, nil ] value The value to set.
|
|
127
|
+
#
|
|
128
|
+
# @return [ void ]
|
|
129
|
+
def socketfunction=(value)
|
|
130
|
+
Curl.set_option(:socketfunction, value_for(value, :string), handle, :multi)
|
|
131
|
+
retain_callback(:socketfunction, value)
|
|
132
|
+
value
|
|
133
|
+
end
|
|
134
|
+
|
|
135
|
+
# Sets timerdata option.
|
|
136
|
+
#
|
|
137
|
+
# @example Set timerdata option.
|
|
138
|
+
# multi.timerdata = $value
|
|
139
|
+
#
|
|
140
|
+
# @param [ FFI::Pointer, nil ] value The value to set.
|
|
141
|
+
#
|
|
142
|
+
# @return [ void ]
|
|
143
|
+
def timerdata=(value)
|
|
144
|
+
Curl.set_option(:timerdata, value_for(value, :string), handle, :multi)
|
|
145
|
+
end
|
|
146
|
+
|
|
147
|
+
# Sets timerfunction option.
|
|
148
|
+
#
|
|
149
|
+
# @example Set timerfunction option.
|
|
150
|
+
# multi.timerfunction = $value
|
|
151
|
+
#
|
|
152
|
+
# @param [ Proc, nil ] value The value to set.
|
|
153
|
+
#
|
|
154
|
+
# @return [ void ]
|
|
155
|
+
def timerfunction=(value)
|
|
156
|
+
Curl.set_option(:timerfunction, value_for(value, :string), handle, :multi)
|
|
157
|
+
retain_callback(:timerfunction, value)
|
|
158
|
+
value
|
|
159
|
+
end
|
|
160
|
+
|
|
161
|
+
private
|
|
162
|
+
|
|
163
|
+
# Raise the default connection cache size to twice the largest number
|
|
164
|
+
# of easy handles ever attached at once.
|
|
165
|
+
#
|
|
166
|
+
# libcurl derives its default from the number of handles attached when
|
|
167
|
+
# a connection is returned. Ethon detaches each handle as soon as its
|
|
168
|
+
# transfer finishes, so that number falls during a run and libcurl
|
|
169
|
+
# closes connections that later requests could have reused.
|
|
170
|
+
#
|
|
171
|
+
# @param [ Integer ] count The number of attached handles after the
|
|
172
|
+
# pending add.
|
|
173
|
+
#
|
|
174
|
+
# @return [ void ]
|
|
175
|
+
def raise_default_maxconnects(count)
|
|
176
|
+
return if @maxconnects_configured
|
|
177
|
+
return if count <= (@maxconnects_high_water ||= 0)
|
|
178
|
+
|
|
179
|
+
@maxconnects_high_water = count
|
|
180
|
+
set_maxconnects(2 * count)
|
|
181
|
+
end
|
|
182
|
+
|
|
183
|
+
def set_maxconnects(value)
|
|
184
|
+
Curl.set_option(:maxconnects, value_for(value, :int, :maxconnects), handle, :multi)
|
|
185
|
+
end
|
|
186
|
+
|
|
187
|
+
def retain_callback(option, callback)
|
|
188
|
+
if callback.nil?
|
|
189
|
+
@procs.delete(option) if @procs
|
|
190
|
+
else
|
|
191
|
+
(@procs ||= {})[option] = callback
|
|
192
|
+
end
|
|
193
|
+
Curl::MultiHandle.retain_callback(handle, option, callback)
|
|
194
|
+
end
|
|
195
|
+
|
|
196
|
+
# Return the value to set to multi handle. It is converted with the help
|
|
197
|
+
# of bool_options, enum_options and int_options.
|
|
198
|
+
#
|
|
199
|
+
# @example Return casted the value.
|
|
200
|
+
# multi.value_for(:verbose)
|
|
201
|
+
#
|
|
202
|
+
# @return [ Object ] The casted value.
|
|
203
|
+
def value_for(value, type, option = nil)
|
|
204
|
+
return nil if value.nil?
|
|
205
|
+
|
|
206
|
+
if type == :bool
|
|
207
|
+
value ? 1 : 0
|
|
208
|
+
elsif type == :int
|
|
209
|
+
Ethon::Curls::Options.integer_value(option, value)
|
|
210
|
+
elsif value.is_a?(String)
|
|
211
|
+
Ethon::Easy::Util.escape_zero_byte(value)
|
|
212
|
+
else
|
|
213
|
+
value
|
|
214
|
+
end
|
|
215
|
+
end
|
|
216
|
+
|
|
217
|
+
end
|
|
218
|
+
end
|
|
219
|
+
end
|