Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix timeout and timeout_ms to handle floats and negative numbers (#361)
* fix timeout and timeout_ms to handle floats and negative numbers The setter used `CURB_IMMED_SETTER` macro and it casts value to `long` and loses precision if float was passed. C will round down as part of the conversion and if it converts to 0 then the IMMED_GETTER will return nil. This results in a confusing output described in #355. This commit deperecates `CURLOPT_TIMEOUT` option and the code will rely exclusively on `timeout_ms` (and `CURLOPT_TIMEOUT_MS` accordingly). There are minor user-facing changes: * timeout and timeout_ms will not return nil anymore * change of timeout will now also change timeout_ms respectively * timeout will return numeric rather than fixnum Otherwise everything should be working as expected. * remove unnecessary code to handle timeout and timeout_ms This is being handled in the setters now and the condition will never evaluate to true so it's good to remove.
- Loading branch information
Showing
2 changed files
with
90 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters