Class: Puma::MiniSSL::Socket

### Home Classes Methods

### In Files

- lib/puma/minissl.rb

### Parent

Object

### Methods

- ::new
- #close
- #engine_read_all
- #flush
- #peeraddr
- #peercert
- #read_nonblock
- #readpartial
- #syswrite
- #to_io
- #write

### Files

- Manifest.txt

### Class/Module Index

Quicksearch

- Puma
- Puma::App
- Puma::App::Status
- Puma::Binder
- Puma::CLI
- Puma::Client
- Puma::Cluster
- Puma::Cluster::Worker
- Puma::CommonLogger
- Puma::ConfigDefault
- Puma::Configuration
- Puma::Configuration::ConfigMiddleware
- Puma::ConnectionError
- Puma::Const
- Puma::ControlCLI
- Puma::DSL
- Puma::Delegation
- Puma::Events
- Puma::Events::DefaultFormatter
- Puma::Events::PidFormatter
- Puma::IOBuffer
- Puma::JRubyRestart
- Puma::JavaIOBuffer
- Puma::MiniSSL
- Puma::MiniSSL::Context
- Puma::MiniSSL::SSLError
- Puma::MiniSSL::Server
- Puma::MiniSSL::Socket
- Puma::NullIO
- Puma::Rack
- Puma::Rack::Builder
- Puma::Rack::Options
- Puma::Rack::URLMap
- Puma::Reactor
- Puma::Runner
- Puma::Server
- Puma::Single
- Puma::TCPLogger
- Puma::ThreadPool
- Puma::ThreadPool::AutoTrim
- Puma::ThreadPool::Reaper
- Puma::UnsupportedOption
- Puma::Util
- Puma::Util::HeaderHash
- OpenSSL
- OpenSSL::SSL
- OpenSSL::SSL::SSLServer
- Rack
- Rack::Handler
- Rack::Handler::Puma
- IO
- IO::WaitReadable
- Object
- Process
- String

No matching classes.

# Puma::MiniSSL::Socket

### Public Class Methods

new(socket, engine) click to toggle source

    # File lib/puma/minissl.rb, line 4
    def initialize(socket, engine)
      @socket = socket
      @engine = engine
      @peercert = nil
    end

### Public Instance Methods

close() click to toggle source

    # File lib/puma/minissl.rb, line 83
    def close
      @socket.close
    end

engine_read_all() click to toggle source

    # File lib/puma/minissl.rb, line 31
    def engine_read_all
      output = @engine.read
      while output and additional_output = @engine.read
        output << additional_output
      end
      output
    end

flush() click to toggle source

    # File lib/puma/minissl.rb, line 79
    def flush
      @socket.flush
    end

peeraddr() click to toggle source

    # File lib/puma/minissl.rb, line 87
    def peeraddr
      @socket.peeraddr
    end

peercert() click to toggle source

    # File lib/puma/minissl.rb, line 91
    def peercert
      return @peercert if @peercert

      raw = @engine.peercert
      return nil unless raw

      @peercert = OpenSSL::X509::Certificate.new raw
    end

read_nonblock(size) click to toggle source

    # File lib/puma/minissl.rb, line 39
    def read_nonblock(size)
      while true
        output = engine_read_all
        return output if output

        data = @socket.read_nonblock(size)

        @engine.inject(data)
        output = engine_read_all

        return output if output

        while neg_data = @engine.extract
          @socket.write neg_data
        end
      end
    end

readpartial(size) click to toggle source

    # File lib/puma/minissl.rb, line 14
    def readpartial(size)
      while true
        output = @engine.read
        return output if output

        data = @socket.readpartial(size)
        @engine.inject(data)
        output = @engine.read

        return output if output

        while neg_data = @engine.extract
          @socket.write neg_data
        end
      end
    end

syswrite(data) click to toggle source
Alias for: write
to_io() click to toggle source

    # File lib/puma/minissl.rb, line 10
    def to_io
      @socket
    end

write(data) click to toggle source

    # File lib/puma/minissl.rb, line 57
    def write(data)
      need = data.bytesize

      while true
        wrote = @engine.write data
        enc = @engine.extract

        while enc
          @socket.write enc
          enc = @engine.extract
        end

        need -= wrote

        return data.bytesize if need == 0

        data = data[wrote..-1]
      end
    end

Also aliased as: syswrite

[Validate]

Generated with the Darkfish Rdoc Generator 2.