Class: Baykit::BayServer::Docker::Ajp::AjpWarpHandler
- Inherits:
-
AjpProtocolHandler
- Object
- Protocol::ProtocolHandler
- AjpProtocolHandler
- Baykit::BayServer::Docker::Ajp::AjpWarpHandler
show all
- Includes:
- Agent, Command, Warp, Warp::WarpHandler, Protocol, Tours, Util
- Defined in:
- lib/baykit/bayserver/docker/ajp/ajp_warp_handler.rb
Defined Under Namespace
Classes: WarpProtocolHandlerFactory
Constant Summary
collapse
- FIXED_WARP_ID =
1
1
- STATE_READ_CONTENT =
2
Instance Attribute Summary collapse
Instance Method Summary
collapse
#max_req_packet_data_size, #max_res_packet_data_size, #protocol
Constructor Details
Returns a new instance of AjpWarpHandler.
41
42
43
44
|
# File 'lib/baykit/bayserver/docker/ajp/ajp_warp_handler.rb', line 41
def initialize(pkt_store)
super(pkt_store, false)
reset()
end
|
Instance Attribute Details
#cont_read_len ⇒ Object
Returns the value of attribute cont_read_len.
39
40
41
|
# File 'lib/baykit/bayserver/docker/ajp/ajp_warp_handler.rb', line 39
def cont_read_len
@cont_read_len
end
|
#state ⇒ Object
Returns the value of attribute state.
37
38
39
|
# File 'lib/baykit/bayserver/docker/ajp/ajp_warp_handler.rb', line 37
def state
@state
end
|
Instance Method Details
#handle_data(cmd) ⇒ Object
Implements AjpCommandHandler
84
85
86
|
# File 'lib/baykit/bayserver/docker/ajp/ajp_warp_handler.rb', line 84
def handle_data(cmd)
raise ProtocolException.new("Invalid AJP command: %d", cmd.type)
end
|
#handle_end_response(cmd) ⇒ Object
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
|
# File 'lib/baykit/bayserver/docker/ajp/ajp_warp_handler.rb', line 88
def handle_end_response(cmd)
BayLog.debug("%s handle_end_response reuse=%s", @ship, cmd.reuse)
tur = @ship.get_tour(FIXED_WARP_ID)
if @state == STATE_READ_HEADER
(tur)
end
end_res_content(tur)
if cmd.reuse
return NextSocketAction::CONTINUE
else
return NextSocketAction::CLOSE
end
end
|
#handle_eof ⇒ Object
172
173
174
|
# File 'lib/baykit/bayserver/docker/ajp/ajp_warp_handler.rb', line 172
def handle_eof
raise EOFError.new()
end
|
#handle_forward_request(cmd) ⇒ Object
105
106
107
|
# File 'lib/baykit/bayserver/docker/ajp/ajp_warp_handler.rb', line 105
def handle_forward_request(cmd)
raise ProtocolException.new("Invalid AJP command: #{cmd.type}")
end
|
#handle_get_body_chunk(cmd) ⇒ Object
167
168
169
170
|
# File 'lib/baykit/bayserver/docker/ajp/ajp_warp_handler.rb', line 167
def handle_get_body_chunk(cmd)
BayLog.debug("%s handle_get_body_chunk", self)
return NextSocketAction::CONTINUE
end
|
#handle_send_body_chunk(cmd) ⇒ Object
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
|
# File 'lib/baykit/bayserver/docker/ajp/ajp_warp_handler.rb', line 109
def handle_send_body_chunk(cmd)
BayLog.debug("%s handle_send_body_chunk: len=%d", @ship, cmd.length)
tur = @ship.get_tour(FIXED_WARP_ID)
if @state == STATE_READ_HEADER
sid = @ship.ship_id
tur.res.set_consume_listener do |len, resume|
if resume
@ship.resume(sid)
end
end
(tur)
end
available = tur.res.send_content(tur.tour_id, cmd.chunk, 0, cmd.length)
@cont_read_len += cmd.length
if available
return NextSocketAction::CONTINUE
else
return NextSocketAction::SUSPEND
end
end
|
#handle_send_headers(cmd) ⇒ Object
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
|
# File 'lib/baykit/bayserver/docker/ajp/ajp_warp_handler.rb', line 135
def handle_send_headers(cmd)
BayLog.debug("%s handle_send_headers", @ship)
tur = @ship.get_tour(FIXED_WARP_ID)
if @state != STATE_READ_HEADER
raise ProtocolException.new("Invalid AJP command: %d state=%s", cmd.type, @state)
end
wdat = WarpData.get(tur)
if BayServer.harbor.
BayLog.info("%s recv res status: %d", wdat, cmd.status)
end
wdat..status = cmd.status
cmd..keys.each do |name|
cmd.[name].each do |value|
if BayServer.harbor.
BayLog.info("%s recv res header: %s=%s", wdat, name, value)
end
wdat..add(name, value)
end
end
return NextSocketAction::CONTINUE
end
|
#handle_shutdown(cmd) ⇒ Object
163
164
165
|
# File 'lib/baykit/bayserver/docker/ajp/ajp_warp_handler.rb', line 163
def handle_shutdown(cmd)
raise ProtocolException.new("Invalid AJP command: %d", cmd.type)
end
|
#need_data ⇒ Object
176
177
178
|
# File 'lib/baykit/bayserver/docker/ajp/ajp_warp_handler.rb', line 176
def need_data
return false
end
|
#new_warp_data(warp_id) ⇒ Object
63
64
65
|
# File 'lib/baykit/bayserver/docker/ajp/ajp_warp_handler.rb', line 63
def new_warp_data(warp_id)
return WarpData.new(ship, warp_id)
end
|
#next_warp_id ⇒ Object
59
60
61
|
# File 'lib/baykit/bayserver/docker/ajp/ajp_warp_handler.rb', line 59
def next_warp_id()
return 1
end
|
#post_warp_contents(tur, buf, start, len, &callback) ⇒ Object
71
72
73
|
# File 'lib/baykit/bayserver/docker/ajp/ajp_warp_handler.rb', line 71
def post_warp_contents(tur, buf, start, len, &callback)
send_data(tur, buf, start, len, &callback)
end
|
#post_warp_end(tur) ⇒ Object
75
76
|
# File 'lib/baykit/bayserver/docker/ajp/ajp_warp_handler.rb', line 75
def post_warp_end(tur)
end
|
67
68
69
|
# File 'lib/baykit/bayserver/docker/ajp/ajp_warp_handler.rb', line 67
def (tur)
send_forward_request(tur)
end
|
#reset ⇒ Object
46
47
48
49
50
|
# File 'lib/baykit/bayserver/docker/ajp/ajp_warp_handler.rb', line 46
def reset()
super
reset_state()
@cont_read_len = 0
end
|
#to_s ⇒ Object
52
53
54
|
# File 'lib/baykit/bayserver/docker/ajp/ajp_warp_handler.rb', line 52
def to_s()
return ship().to_s()
end
|
#verify_protocol(proto) ⇒ Object
78
79
|
# File 'lib/baykit/bayserver/docker/ajp/ajp_warp_handler.rb', line 78
def verify_protocol(proto)
end
|