Project

General

Profile

Actions

Feature #12077

open

Consolidate SSLSocket interface with TCPSocket

Added by tonci (Tonči Damjanić) about 8 years ago. Updated almost 8 years ago.

Status:
Open
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 1 (1 open0 closed)

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

Updated by tonci (Tonči Damjanić) about 8 years ago

  • Description updated (diff)

Updated by tonci (Tonči Damjanić) about 8 years ago

  • Description updated (diff)

Updated by tonci (Tonči Damjanić) about 8 years ago

  • Assignee set to core

Updated by normalperson (Eric Wong) about 8 years ago

wrote:

Is there a reason why SSLSocket#read doesn't work the same
as SSLSocket#sysread

Because IO#read and IO#sysread are different, too. The former
is read-in-full behavior (outside of EOF) while sysread matches
the low-level C interface and allows for partial reads.

Likewise with write vs syswrite regarding write-in-full
behavior.

and why there is no SSLSocket#recv?

Currently, OpenSSL does not provide an interface to recv(2)
which handles flag arguments :<

I too wish for recv(2) and send(2) interfaces which lets me
use MSG_MORE|MSG_DONTWAIT flags.

Actions #5

Updated by naruse (Yui NARUSE) almost 8 years ago

  • Assignee deleted (core)
Actions #6

Updated by naruse (Yui NARUSE) almost 7 years ago

  • Is duplicate of Feature #8126: OpenSSL::SSL::SSLSocket does not define #recv and #send messages added
Actions

Also available in: Atom PDF

Like0
Like0Like0Like0Like0Like0Like0