Skip to content
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

Intercept reads/writes to underlying TCPSocket #235

Open
ertygiq opened this issue Sep 9, 2021 · 0 comments
Open

Intercept reads/writes to underlying TCPSocket #235

ertygiq opened this issue Sep 9, 2021 · 0 comments

Comments

@ertygiq
Copy link

ertygiq commented Sep 9, 2021

Is there a way to intercept reads and writes SSLSocket does into underlying TCPSocket?
I tried the following way, but overridden methods were not invoked:

class TCPSocket
    def write(*args)
        p "write"
        super *args
    end
    def read(*args)
        p "read"
        super *args
    end
end

Tcp_socket = TCPSocket.open '127.0.0.1', 80
ssl_context = OpenSSL::SSL::SSLContext.new
socket = OpenSSL::SSL::SSLSocket.new(Tcp_socket, ssl_context)
socket.connect
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant