Project

General

Profile

Actions

Feature #12077

open

Consolidate SSLSocket interface with TCPSocket

Added by tonci (Tonči Damjanić) almost 6 years ago. Updated over 5 years ago.

Status:
Open
Priority:
Normal
Assignee:
-
Target version:
-
[ruby-core:73840]

Description

Hello,

Is there a reason why SSLSocket#read doesn't work the same as SSLSocket#sysread and why there is no SSLSocket#recv?

Right now it is impossible to have code agnostic in regards to the socket type.

One solution is to monkey-patch OpenSSL::SSL::SSLSocket (see lower) to share the same interface as TCPSocket, but given the generic names of monkey-patched functions, I'm not sure if they could result with some leaks or strange behavior.

class OpenSSL::SSL::SSLSocket
  def read(*args)
    sysread(*args)
  end

  def write(*args)
    syswrite(*args)
  end

  def close
    sysclose
  end
end

Thoughts?


Related issues

Is duplicate of Ruby master - Feature #8126: OpenSSL::SSL::SSLSocket does not define #recv and #send messagesAssignedrhenium (Kazuki Yamaguchi)Actions
Actions

Also available in: Atom PDF