Class: Baykit::BayServer::Docker::Fcgi::Command::CmdBeginRequest

Inherits:
FcgCommand
  • Object
show all
Includes:
Baykit::BayServer::Docker::Fcgi
Defined in:
lib/baykit/bayserver/docker/fcgi/command/cmd_begin_request.rb

Constant Summary collapse

FCGI_KEEP_CONN =
1
FCGI_RESPONDER =
1
FCGI_AUTHORIZER =
2
FCGI_FILTER =
3

Instance Attribute Summary collapse

Attributes inherited from FcgCommand

#req_id

Instance Method Summary collapse

Methods inherited from FcgCommand

#pack_header

Constructor Details

#initialize(req_id) ⇒ CmdBeginRequest

Returns a new instance of CmdBeginRequest.



32
33
34
# File 'lib/baykit/bayserver/docker/fcgi/command/cmd_begin_request.rb', line 32

def initialize(req_id)
  super(FcgType::BEGIN_REQUEST, req_id)
end

Instance Attribute Details

#keep_connObject

Returns the value of attribute keep_conn.



30
31
32
# File 'lib/baykit/bayserver/docker/fcgi/command/cmd_begin_request.rb', line 30

def keep_conn
  @keep_conn
end

#roleObject

Returns the value of attribute role.



29
30
31
# File 'lib/baykit/bayserver/docker/fcgi/command/cmd_begin_request.rb', line 29

def role
  @role
end

Instance Method Details

#handle(cmd_handler) ⇒ Object



56
57
58
# File 'lib/baykit/bayserver/docker/fcgi/command/cmd_begin_request.rb', line 56

def handle(cmd_handler)
  return cmd_handler.handle_begin_request(self)
end

#pack(pkt) ⇒ Object



45
46
47
48
49
50
51
52
53
54
# File 'lib/baykit/bayserver/docker/fcgi/command/cmd_begin_request.rb', line 45

def pack(pkt)
  acc = pkt.new_data_accessor
  acc.put_short(@role)
  acc.put_byte(@keep_conn ? 1 : 0)
  reserved = " " * 5
  acc.put_bytes(reserved)

  # must be called from last line
  super
end

#unpack(pkt) ⇒ Object



36
37
38
39
40
41
42
43
# File 'lib/baykit/bayserver/docker/fcgi/command/cmd_begin_request.rb', line 36

def unpack(pkt)
  super

  acc = pkt.new_data_accessor
  @role = acc.get_short
  flags = acc.get_byte
  @keep_conn = (flags & FCGI_KEEP_CONN) != 0
end