Class: FCGI::FastCGISocket
- Inherits:
-
Object
- Object
- FCGI::FastCGISocket
- Defined in:
- lib/cgialt/fcgi/core.rb
Instance Method Summary collapse
-
#initialize(sock) ⇒ FastCGISocket
constructor
A new instance of FastCGISocket.
- #read_record ⇒ Object
- #send_record(rec) ⇒ Object
Constructor Details
#initialize(sock) ⇒ FastCGISocket
Returns a new instance of FastCGISocket.
188 189 190 |
# File 'lib/cgialt/fcgi/core.rb', line 188 def initialize(sock) @socket = sock end |
Instance Method Details
#read_record ⇒ Object
192 193 194 195 196 197 |
# File 'lib/cgialt/fcgi/core.rb', line 192 def read_record header = @socket.read(Record::HEADER_LENGTH) or return nil return nil unless header.size == Record::HEADER_LENGTH version, type, reqid, clen, padlen, reserved = *Record.parse_header(header) Record.class_for(type).parse(reqid, read_record_body(clen, padlen)) end |
#send_record(rec) ⇒ Object
209 210 211 212 |
# File 'lib/cgialt/fcgi/core.rb', line 209 def send_record(rec) @socket.write rec.serialize @socket.flush end |