-
Notifications
You must be signed in to change notification settings - Fork 172
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add SSLSocket#getbyte #438
Conversation
Can we get some tests too? |
That's good to have. However, IO#getbyte returns CI is failing because String#unpack1 does not exist in Ruby 2.3. It will be dropped sooner or later anyway, but I guess we can simply work around. |
Just been taking a look at the ruby openssl source code for the first time. Does this belong in lib/openssl/buffering.rb? |
I'll add a test for it.
Ah, makes sense. I'll add a work around too. |
Normal sockets respond to `getbyte`, so we should make SSLSocket respond to `getbyte` as well. This way we can substitute SSLSockets for regular sockets.
I added a test for returning nil on EOF. Also moved the IO function to buffering.rb. Thanks @njh for pointing that out! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice work. Good specs. I wonder if we should have direct unit tests against Buffering
.
Thanks! |
This backports the getbyte method which was added in this PR: ruby/openssl#438 We only add the method to SSLSocket if the method isn't already defined. I was able to test this with the following program: ```ruby require 'rubygems' require 'mqtt' client = MQTT::Client.connect( host: "test.mosquitto.org", port: 8883, ssl: true ) client.get ``` Fixes njh#135
This backports the getbyte method which was added in this PR: ruby/openssl#438 We only add the method to SSLSocket if the method isn't already defined. I was able to test this with the following program: ```ruby require 'rubygems' require 'mqtt' client = MQTT::Client.connect( host: "test.mosquitto.org", port: 8883, ssl: true ) client.get ``` Fixes njh#135
This backports the getbyte method which was added in this PR: ruby/openssl#438 We only add the method to SSLSocket if the method isn't already defined. I was able to test this with the following program: ```ruby require 'rubygems' require 'mqtt' client = MQTT::Client.connect( host: "test.mosquitto.org", port: 8883, ssl: true ) client.get ``` Fixes #135
Companion to getbyte but raise EOFError Similar to ruby#438
Companion to getbyte but raise EOFError Similar to ruby/openssl#438 ruby/openssl@c40f70711a
Normal sockets respond to
getbyte
, so we should make SSLSocket respondto
getbyte
as well. This way we can substitute SSLSockets for regularsockets.