openssl
openssl copied to clipboard
Implement `chomp:` option for `gets`, `readline`, `readlines`, `each_line`
It was added to IO methods in Ruby 2.4, but OpenSSL sockets don't have them, so any code accepting SSL sockets can't make use of it.
Ref: https://github.com/ruby/ruby/commit/a2144bd72aad7c25e160cf283f957d59fe7c90b2
cc @nobu since you implemented this in IO
.
On another note, this led me to notice that SSLSocket#gets(nil)
and SSLSocket#gets("")
aren't supported either.
Seems fine. The failure on mswin should be fixed by rebase.
Thanks for working on this! This is indeed overlooked and should be implemented.
Unlike IO#gets
, OpenSSL::Buffering
/OpenSSL::SSL::SSLSocket#gets
accepts a Regexp as the eol
parameter. Should this be made compatible with chomp
option too? Or perhaps it can simply be documented as unsupported... I didn't know #gets
took a Regexp at all.
On another note, this led me to notice that SSLSocket#gets(nil) and SSLSocket#gets("") aren't supported either.
I think that should be aligned with IO too, as these currently don't give any useful return value.
Unlike
IO#gets
,OpenSSL::Buffering
/OpenSSL::SSL::SSLSocket#gets
accepts a Regexp as theeol
parameter. Should this be made compatible withchomp
option too?
um, so we'd need to chomp whatever the regexp matched? Seems tricky.