Skip to content

Instantly share code, notes, and snippets.

@fw42
Last active August 29, 2015 14:08
Show Gist options
  • Save fw42/93727d046b827fab4751 to your computer and use it in GitHub Desktop.
Save fw42/93727d046b827fab4751 to your computer and use it in GitHub Desktop.
Module#prepend with C extensions
#!/usr/bin/env ruby
require 'socket'
require 'openssl'
module Foo
end
OpenSSL::SSL::SSLSocket.prepend(Foo)
# This line crashes with the prepend() but works without it
# `initialize': wrong number of arguments (0 for 1..2) (ArgumentError)
OpenSSL::SSL::SSLSocket.new(TCPSocket.new('google.com', 443), OpenSSL::SSL::SSLContext.new)
@fw42
Copy link
Author

fw42 commented Oct 29, 2014

Also segfaults on 2.0.0 (p247)

@arthurnn
Copy link

Did we filed a bug report? is this fixed on 2.1.5 ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment