bayserver-docker-ajp 2.3.2 → 3.0.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e0090276f8832b12e28f8b161bdbb7798897c6a2ded5c85ad73117ea7dc83eed
4
- data.tar.gz: 01a5e73fce978d0e5885ef76cbb67c0c024e54ed2c257582d4d1ab401c517e1c
3
+ metadata.gz: 30ab4e8d79a5923f9ea6966dfe181914b91b84689fd882fdee087410ac2dff49
4
+ data.tar.gz: a12f0f026ff69ee6cc30b7e87375d1fa920f53f304c9f62e4b6336025c4cb8f2
5
5
  SHA512:
6
- metadata.gz: 50bb1fc29595167c73f0975a5935f36764ce59dc17a15300548c2f41c53525d2d5c5a6b348254e71ea8c6693daaf1a4a44174a7067569c8995ee260950424794
7
- data.tar.gz: a3a81ae8503085d2046e7bc9d172cfbafe4f28a2d72eb479c1cbfc4f471c543acbf43a665b3f78362d82ee072e18041bef79425d74557b2de2b75d565afa14d9
6
+ metadata.gz: d8974095d7f61f7fb5a37e5fb79ec8f09fd2943e50de38abe0408ead09ab32dcadc3dd07275d3bc5d541a56b4d76726aaba93bedce0dc7fa9a94bafa9b8aceb0
7
+ data.tar.gz: aa0e3db7f26a6885da95615c1a8c4f8ec07fd301ced14f81db6b31ad5153b6dbdf99754fcdbff90531ede059f199fb48a2eb2823caea03d3a26a4481487edbd4
@@ -7,17 +7,37 @@ module Baykit
7
7
  module AjpCommandHandler
8
8
  include Baykit::BayServer::Protocol::CommandHandler # implements
9
9
 
10
- # abstract method
11
- #
12
- # handle_data(cmd)
13
- # handle_end_response(cmd)
14
- # handle_forward_request(cmd)
15
- # handle_send_body_chunk(cmd)
16
- # handle_send_headers(cmd)
17
- # handle_shutdown(cmd)
18
- # handle_get_body_chunk(cmd)
19
- # need_data()
20
- #
10
+ def handle_data(cmd)
11
+ raise NotImplementedError.new
12
+ end
13
+
14
+ def handle_end_response(cmd)
15
+ raise NotImplementedError.new
16
+ end
17
+
18
+ def handle_forward_request(cmd)
19
+ raise NotImplementedError.new
20
+ end
21
+
22
+ def handle_send_body_chunk(cmd)
23
+ raise NotImplementedError.new
24
+ end
25
+
26
+ def handle_send_headers(cmd)
27
+ raise NotImplementedError.new
28
+ end
29
+
30
+ def handle_shutdown(cmd)
31
+ raise NotImplementedError.new
32
+ end
33
+
34
+ def handle_get_body_chunk(cmd)
35
+ raise NotImplementedError.new
36
+ end
37
+
38
+ def need_data()
39
+ raise NotImplementedError.new
40
+ end
21
41
  end
22
42
  end
23
43
  end
@@ -0,0 +1,14 @@
1
+
2
+ module Baykit
3
+ module BayServer
4
+ module Docker
5
+ module Ajp
6
+ module AjpHandler # interface
7
+ def on_protocol_error(e)
8
+ raise NotImplementedError.new
9
+ end
10
+ end
11
+ end
12
+ end
13
+ end
14
+ end
@@ -1,26 +1,38 @@
1
- require 'baykit/bayserver/docker/base/inbound_handler'
1
+ require 'baykit/bayserver/common/inbound_handler'
2
2
  require 'baykit/bayserver/tours/req_content_handler'
3
3
 
4
4
  require 'baykit/bayserver/util/string_util'
5
5
  require 'baykit/bayserver/util/http_util'
6
6
  require 'baykit/bayserver/docker/ajp/ajp_protocol_handler'
7
+ require 'baykit/bayserver/docker/ajp/ajp_handler'
7
8
  require 'baykit/bayserver/docker/ajp/command/package'
8
9
 
9
10
  module Baykit
10
11
  module BayServer
11
12
  module Docker
12
13
  module Ajp
13
- class AjpInboundHandler < Baykit::BayServer::Docker::Ajp::AjpProtocolHandler
14
+ class AjpInboundHandler
14
15
 
15
16
  class InboundProtocolHandlerFactory
16
17
  include Baykit::BayServer::Protocol::ProtocolHandlerFactory # implements
18
+ include Baykit::BayServer::Protocol
17
19
 
18
20
  def create_protocol_handler(pkt_store)
19
- return AjpInboundHandler.new(pkt_store)
21
+ ib_handler = AjpInboundHandler.new
22
+ cmd_unpacker = AjpCommandUnPacker.new(ib_handler)
23
+ pkt_unpacker = AjpPacketUnPacker.new(pkt_store, cmd_unpacker)
24
+ pkt_packer = PacketPacker.new()
25
+ cmd_packer = CommandPacker.new(pkt_packer, pkt_store)
26
+
27
+ proto_handler = AjpProtocolHandler.new(ib_handler, pkt_unpacker, pkt_packer, cmd_unpacker, cmd_packer, true)
28
+ ib_handler.init(proto_handler)
29
+ return proto_handler
20
30
  end
21
31
  end
22
32
 
23
- include Baykit::BayServer::Docker::Base::InboundHandler # implements
33
+ include Baykit::BayServer::Common::InboundHandler # implements
34
+ include Baykit::BayServer::Docker::Ajp::AjpHandler # implements
35
+
24
36
  include Baykit::BayServer::Util
25
37
  include Baykit::BayServer::Agent
26
38
  include Baykit::BayServer::Protocol
@@ -33,20 +45,23 @@ module Baykit
33
45
  DUMMY_KEY = 1
34
46
  attr :cur_tour_id
35
47
  attr :req_command
48
+ attr :protocol_handler
36
49
 
37
50
  attr :state
38
51
  attr :keeping
39
52
 
40
- def initialize(pkt_store)
41
- super(pkt_store, true)
42
- reset_state()
53
+ def initialize
54
+ reset
55
+ end
56
+
57
+ def init(proto_handler)
58
+ @protocol_handler = proto_handler
43
59
  end
44
60
 
45
61
  ######################################################
46
62
  # implements Reusable
47
63
  ######################################################
48
- def reset()
49
- super
64
+ def reset
50
65
  reset_state()
51
66
  @req_command = nil
52
67
  @keeping = false
@@ -65,29 +80,29 @@ module Baykit
65
80
  end
66
81
  end
67
82
  cmd.status = tur.res.headers.status
68
- command_packer.post(@ship, cmd)
83
+ @protocol_handler.post(cmd)
69
84
 
70
85
  BayLog.debug("%s send header: content-length=%d", self, tur.res.headers.content_length())
71
86
  end
72
87
 
73
88
  def send_res_content(tur, bytes, ofs, len, &lis)
74
89
  cmd = CmdSendBodyChunk.new(bytes, ofs, len);
75
- @command_packer.post(ship, cmd, &lis);
90
+ @protocol_handler.post(cmd, &lis);
76
91
  end
77
92
 
78
93
  def send_end_tour(tur, keep_alive, &callback)
79
- BayLog.debug("%s endTour: tur=%s keep=%s", @ship, tur, keep_alive)
94
+ BayLog.debug("%s endTour: tur=%s keep=%s", ship, tur, keep_alive)
80
95
  cmd = CmdEndResponse.new()
81
96
  cmd.reuse = keep_alive
82
97
 
83
98
  ensure_func = lambda do
84
99
  if !keep_alive
85
- command_packer.end(@ship)
100
+ ship.post_close
86
101
  end
87
102
  end
88
103
 
89
104
  begin
90
- command_packer.post(@ship, cmd) do
105
+ @protocol_handler.post(cmd) do
91
106
  BayLog.debug("%s call back in sendEndTour: tur=%s keep=%s", self, tur, keep_alive)
92
107
  ensure_func.call()
93
108
  callback.call()
@@ -99,8 +114,8 @@ module Baykit
99
114
  end
100
115
  end
101
116
 
102
- def send_req_protocol_error(e)
103
- tur = @ship.get_error_tour()
117
+ def on_protocol_error(e)
118
+ tur = ship.get_error_tour()
104
119
  tur.res.send_error(Tour::TOUR_ID_NOCHECK, HttpStatus::BAD_REQUEST, e.message, e)
105
120
  return true
106
121
  end
@@ -110,17 +125,17 @@ module Baykit
110
125
  # implements AjpCommandHandler
111
126
  ######################################################
112
127
  def handle_forward_request(cmd)
113
- BayLog.debug("%s handleForwardRequest method=%s uri=%s", @ship, cmd.method, cmd.req_uri)
128
+ BayLog.debug("%s handleForwardRequest method=%s uri=%s", ship, cmd.method, cmd.req_uri)
114
129
  if @state != STATE_READ_FORWARD_REQUEST
115
130
  raise ProtocolException.new("Invalid AJP command: #{cmd.type}")
116
131
  end
117
132
 
118
133
  @keeping = false
119
134
  @req_command = cmd
120
- tur = @ship.get_tour(DUMMY_KEY)
135
+ tur = ship.get_tour(DUMMY_KEY)
121
136
  if tur == nil
122
137
  BayLog.error(BayMessage.get(:INT_NO_MORE_TOURS))
123
- tur = @ship.get_tour(AjpInboundHandler::DUMMY_KEY, true)
138
+ tur = ship.get_tour(AjpInboundHandler::DUMMY_KEY, true)
124
139
  tur.res.send_error(Tour::TOUR_ID_NOCHECK, HttpStatus::SERVICE_UNAVAILABLE, "No available tours")
125
140
  tur.res.end_content(Tour::TOUR_ID_NOCHECK)
126
141
  return NextSocketAction::CONTINUE
@@ -140,7 +155,7 @@ module Baykit
140
155
  BayLog.debug("%s read header method=%s protocol=%s uri=%s contlen=%d",
141
156
  tur, tur.req.method, tur.req.protocol, tur.req.uri, tur.req.headers.content_length)
142
157
 
143
- if BayServer.harbor.trace_header?
158
+ if BayServer.harbor.trace_header
144
159
  cmd.headers.names.each do |name|
145
160
  cmd.headers.values(name).each do |value|
146
161
  BayLog.info("%s header: %s=%s", tur, name, value)
@@ -150,12 +165,7 @@ module Baykit
150
165
 
151
166
  req_cont_len = cmd.headers.content_length
152
167
  if req_cont_len > 0
153
- sid = @ship.ship_id
154
- tur.req.set_consume_listener(req_cont_len) do |len, resume|
155
- if resume
156
- @ship.resume(sid)
157
- end
158
- end
168
+ tur.req.set_limit(req_cont_len)
159
169
  end
160
170
 
161
171
  begin
@@ -184,46 +194,55 @@ module Baykit
184
194
  end
185
195
 
186
196
  def handle_data(cmd)
187
- BayLog.debug("%s handleData len=%s", @ship, cmd.length)
197
+ BayLog.debug("%s handleData len=%s", ship, cmd.length)
188
198
 
189
199
  if @state != STATE_READ_DATA
190
200
  raise RuntimeError.new("Invalid AJP command: #{cmd.type} state=#{@state}")
191
201
  end
192
202
 
193
- tur = @ship.get_tour(DUMMY_KEY)
194
- success = tur.req.post_content(Tour::TOUR_ID_NOCHECK, cmd.data, cmd.start, cmd.length)
203
+ tur = ship.get_tour(DUMMY_KEY)
195
204
 
196
- if tur.req.bytes_posted == tur.req.bytes_limit
197
- # request content completed
205
+ begin
206
+ sid = ship.ship_id
207
+ success = tur.req.post_req_content(Tour::TOUR_ID_NOCHECK, cmd.data, cmd.start, cmd.length) do |len, resume|
208
+ if resume
209
+ ship.resume(sid)
210
+ end
211
+ end
198
212
 
199
- if tur.error != nil
200
- tur.res.send_http_exception(Tour::TOUR_ID_NOCHECK, tur.error)
201
- reset_state()
202
- return NextSocketAction::WRITE
203
- else
204
- begin
205
- end_req_content(tur)
206
- return NextSocketAction::CONTINUE
207
- rescue HttpException => e
208
- tur.res.send_http_exception(Tour::TOUR_ID_NOCHECK, e)
213
+ if tur.req.bytes_posted == tur.req.bytes_limit
214
+ # request content completed
215
+
216
+ if tur.error != nil
217
+ tur.res.send_http_exception(Tour::TOUR_ID_NOCHECK, tur.error)
209
218
  reset_state()
210
219
  return NextSocketAction::WRITE
220
+ else
221
+ end_req_content(tur)
222
+ return NextSocketAction::CONTINUE
211
223
  end
212
- end
213
- else
214
- bch = CmdGetBodyChunk.new()
215
- bch.req_len = tur.req.bytes_limit - tur.req.bytes_posted
216
- if bch.req_len > AjpPacket::MAX_DATA_LEN
217
- bch.req_len = AjpPacket::MAX_DATA_LEN
218
- end
219
- command_packer.post(@ship, bch)
220
-
221
- if !success
222
- return NextSocketAction::SUSPEND
223
224
  else
224
- return NextSocketAction::CONTINUE
225
+ bch = CmdGetBodyChunk.new()
226
+ bch.req_len = tur.req.bytes_limit - tur.req.bytes_posted
227
+ if bch.req_len > AjpPacket::MAX_DATA_LEN
228
+ bch.req_len = AjpPacket::MAX_DATA_LEN
229
+ end
230
+ @protocol_handler.post(bch)
231
+
232
+ if !success
233
+ return NextSocketAction::SUSPEND
234
+ else
235
+ return NextSocketAction::CONTINUE
236
+ end
225
237
  end
238
+
239
+ rescue HttpException => e
240
+ tur.req.abort
241
+ tur.res.send_http_exception(Tour::TOUR_ID_NOCHECK, e)
242
+ reset_state()
243
+ return NextSocketAction::WRITE
226
244
  end
245
+
227
246
  end
228
247
 
229
248
  def handle_send_body_chunk(cmd)
@@ -235,7 +254,7 @@ module Baykit
235
254
  end
236
255
 
237
256
  def handle_shutdown(cmd)
238
- BayLog.info("%s handle_shutdown", @ship)
257
+ BayLog.info("%s handle_shutdown", ship)
239
258
  BayServer.shutdown
240
259
  NextSocketAction::CLOSE
241
260
  end
@@ -253,6 +272,11 @@ module Baykit
253
272
  end
254
273
 
255
274
  private
275
+
276
+ def ship
277
+ return @protocol_handler.ship
278
+ end
279
+
256
280
  def reset_state
257
281
  change_state(STATE_READ_FORWARD_REQUEST)
258
282
  end
@@ -262,7 +286,7 @@ module Baykit
262
286
  end
263
287
 
264
288
  def end_req_content(tur)
265
- tur.req.end_content(Tour::TOUR_ID_NOCHECK)
289
+ tur.req.end_req_content(Tour::TOUR_ID_NOCHECK)
266
290
  reset_state()
267
291
  end
268
292
 
@@ -270,7 +294,7 @@ module Baykit
270
294
  HttpUtil.parse_host_port(tur, @req_command.is_ssl ? 443 : 80)
271
295
  HttpUtil.parse_authorization(tur)
272
296
 
273
- skt = @ship.socket
297
+ skt = ship.rudder.io
274
298
  tur.req.remote_port = nil
275
299
  tur.req.remote_address = @req_command.remote_addr
276
300
  tur.req.remote_host_func = lambda { @req_command.remote_host }
@@ -1,7 +1,4 @@
1
1
  require 'baykit/bayserver/protocol/protocol_handler'
2
- require 'baykit/bayserver/protocol/packet_store'
3
- require 'baykit/bayserver/util/http_status'
4
- require 'baykit/bayserver/tours/package'
5
2
  require 'baykit/bayserver/docker/ajp/package'
6
3
  require 'baykit/bayserver/docker/ajp/command/package'
7
4
 
@@ -14,16 +11,11 @@ module Baykit
14
11
 
15
12
  include Baykit::BayServer::Protocol
16
13
  include Baykit::BayServer::Agent
17
- include Baykit::BayServer::Util
18
14
  include Baykit::BayServer::Docker::Ajp::Command
19
15
 
20
16
 
21
- def initialize(pkt_store, svr_mode)
22
- @command_unpacker = AjpCommandUnPacker.new(self)
23
- @packet_unpacker = AjpPacketUnPacker.new(pkt_store, @command_unpacker)
24
- @packet_packer = PacketPacker.new()
25
- @command_packer = CommandPacker.new(@packet_packer, pkt_store)
26
- @server_mode = svr_mode
17
+ def initialize(ajp_handler, pkt_unpacker, pkt_packer, cmd_unpacker, cmd_packer, svr_mode)
18
+ super(pkt_unpacker, pkt_packer, cmd_unpacker, cmd_packer, ajp_handler, svr_mode)
27
19
  end
28
20
 
29
21
  def to_s
@@ -1,18 +1,20 @@
1
- require 'baykit/bayserver/docker/warp/warp_docker'
1
+ require 'baykit/bayserver/docker/base/warp_base'
2
2
  require 'baykit/bayserver/docker/ajp/package'
3
- require 'baykit/bayserver/agent/transporter/plain_transporter'
3
+ require 'baykit/bayserver/agent/multiplexer/plain_transporter'
4
+ require 'baykit/bayserver/util/io_util'
4
5
  require 'baykit/bayserver/protocol/packet_store'
5
6
 
6
7
  module Baykit
7
8
  module BayServer
8
9
  module Docker
9
10
  module Ajp
10
- class AjpWarpDocker < Baykit::BayServer::Docker::Warp::WarpDocker
11
+ class AjpWarpDocker < Baykit::BayServer::Docker::Base::WarpBase
11
12
  include Baykit::BayServer::Docker::Ajp::AjpDocker # implements
12
13
 
13
14
  include Baykit::BayServer::Agent
15
+ include Baykit::BayServer::Agent::Multiplexer
14
16
  include Baykit::BayServer::Protocol
15
- include Baykit::BayServer::Agent::Transporter
17
+ include Baykit::BayServer::Util
16
18
 
17
19
  ######################################################
18
20
  # Implements WarpDocker
@@ -29,8 +31,10 @@ module Baykit
29
31
  return PROTO_NAME
30
32
  end
31
33
 
32
- def new_transporter(agt, skt)
33
- PlainTransporter.new(false, IOUtil.get_sock_recv_buf_size(skt))
34
+ def new_transporter(agt, rd, sip)
35
+ tp = PlainTransporter.new(agt.net_multiplexer, sip, false, IOUtil.get_sock_recv_buf_size(rd.io), false)
36
+ tp.init
37
+ return tp
34
38
  end
35
39
 
36
40
  ######################################################
@@ -1,8 +1,10 @@
1
1
  require 'baykit/bayserver/agent/next_socket_action'
2
2
  require 'baykit/bayserver/protocol/protocol_exception'
3
+ require 'baykit/bayserver/common/warp_data'
3
4
  require 'baykit/bayserver/docker/ajp/command/package'
4
5
  require 'baykit/bayserver/util/string_util'
5
6
 
7
+ require 'baykit/bayserver/docker/ajp/ajp_handler'
6
8
  require 'baykit/bayserver/docker/ajp/ajp_protocol_handler'
7
9
 
8
10
 
@@ -10,14 +12,24 @@ module Baykit
10
12
  module BayServer
11
13
  module Docker
12
14
  module Ajp
13
- class AjpWarpHandler < Baykit::BayServer::Docker::Ajp::AjpProtocolHandler
14
- include Baykit::BayServer::Docker::Warp::WarpHandler # implements
15
+ class AjpWarpHandler
16
+ include Baykit::BayServer::Common::WarpHandler # implements
17
+ include AjpHandler # implements
15
18
 
16
19
  class WarpProtocolHandlerFactory
17
20
  include Baykit::BayServer::Protocol::ProtocolHandlerFactory # implements
21
+ include Baykit::BayServer::Protocol
18
22
 
19
23
  def create_protocol_handler(pkt_store)
20
- return AjpWarpHandler.new(pkt_store)
24
+ ib_handler = AjpWarpHandler.new
25
+ cmd_unpacker = AjpCommandUnPacker.new(ib_handler)
26
+ pkt_unpacker = AjpPacketUnPacker.new(pkt_store, cmd_unpacker)
27
+ pkt_packer = PacketPacker.new()
28
+ cmd_packer = CommandPacker.new(pkt_packer, pkt_store)
29
+
30
+ proto_handler = AjpProtocolHandler.new(ib_handler, pkt_unpacker, pkt_packer, cmd_unpacker, cmd_packer, false)
31
+ ib_handler.init(proto_handler)
32
+ return proto_handler
21
33
  end
22
34
  end
23
35
 
@@ -25,9 +37,9 @@ module Baykit
25
37
  include Baykit::BayServer::Agent
26
38
  include Baykit::BayServer::Protocol
27
39
  include Baykit::BayServer::Tours
28
- include Baykit::BayServer::Docker::Warp
29
40
  include Baykit::BayServer::Docker::Ajp::Command
30
41
  include Baykit::BayServer::Util
42
+ include Baykit::BayServer::Common
31
43
 
32
44
  FIXED_WARP_ID = 1
33
45
 
@@ -38,13 +50,15 @@ module Baykit
38
50
 
39
51
  attr :cont_read_len
40
52
 
41
- def initialize(pkt_store)
42
- super(pkt_store, false)
53
+ def initialize
43
54
  reset()
44
55
  end
45
56
 
57
+ def init(proto_handler)
58
+ @protocol_handler = proto_handler
59
+ end
60
+
46
61
  def reset()
47
- super
48
62
  reset_state()
49
63
  @cont_read_len = 0
50
64
  end
@@ -54,31 +68,37 @@ module Baykit
54
68
  end
55
69
 
56
70
  ######################################################
57
- # Implements WarpHandler
71
+ # Implements TourHandler
58
72
  ######################################################
59
- def next_warp_id()
60
- return 1
73
+
74
+ def send_res_headers(tur)
75
+ send_forward_request(tur)
61
76
  end
62
77
 
63
- def new_warp_data(warp_id)
64
- return WarpData.new(ship, warp_id)
78
+ def send_res_content(tur, buf, start, len, &lis)
79
+ send_data(tur, buf, start, len, &lis)
65
80
  end
66
81
 
67
- def post_warp_headers(tur)
68
- send_forward_request(tur)
82
+ def send_end_tour(tur, keep_alive, &lis)
83
+ ship.post(nil, &lis)
69
84
  end
70
85
 
71
- def post_warp_contents(tur, buf, start, len, &callback)
72
- send_data(tur, buf, start, len, &callback)
86
+ def on_protocol_error(e)
87
+ raise Sink.new
73
88
  end
74
89
 
75
- def post_warp_end(tur)
76
- callback = lambda do
77
- @ship.agent.non_blocking_handler.ask_to_read(@ship.socket)
78
- end
79
- @ship.post(nil, callback)
90
+ ######################################################
91
+ # Implements WarpHandler
92
+ ######################################################
93
+ def next_warp_id()
94
+ return 1
95
+ end
96
+
97
+ def new_warp_data(warp_id)
98
+ return WarpData.new(ship, warp_id)
80
99
  end
81
100
 
101
+
82
102
  def verify_protocol(proto)
83
103
  end
84
104
 
@@ -90,8 +110,8 @@ module Baykit
90
110
  end
91
111
 
92
112
  def handle_end_response(cmd)
93
- BayLog.debug("%s handle_end_response reuse=%s", @ship, cmd.reuse)
94
- tur = @ship.get_tour(FIXED_WARP_ID)
113
+ BayLog.debug("%s handle_end_response reuse=%s st=%d", ship, cmd.reuse, @state)
114
+ tur = ship.get_tour(FIXED_WARP_ID)
95
115
 
96
116
  if @state == STATE_READ_HEADER
97
117
  end_res_header(tur)
@@ -111,22 +131,22 @@ module Baykit
111
131
  end
112
132
 
113
133
  def handle_send_body_chunk(cmd)
114
- BayLog.debug("%s handle_send_body_chunk: len=%d", @ship, cmd.length)
115
- tur = @ship.get_tour(FIXED_WARP_ID)
134
+ BayLog.debug("%s handle_send_body_chunk: len=%d st=%d", ship, cmd.length, @state)
135
+ tur = ship.get_tour(FIXED_WARP_ID)
116
136
 
117
137
  if @state == STATE_READ_HEADER
118
138
 
119
- sid = @ship.ship_id
139
+ sid = ship.ship_id
120
140
  tur.res.set_consume_listener do |len, resume|
121
141
  if resume
122
- @ship.resume(sid)
142
+ ship.resume_read(sid)
123
143
  end
124
144
  end
125
145
 
126
146
  end_res_header(tur)
127
147
  end
128
148
 
129
- available = tur.res.send_content(tur.tour_id, cmd.chunk, 0, cmd.length)
149
+ available = tur.res.send_res_content(tur.tour_id, cmd.chunk, 0, cmd.length)
130
150
  @cont_read_len += cmd.length
131
151
 
132
152
  if available
@@ -137,9 +157,9 @@ module Baykit
137
157
  end
138
158
 
139
159
  def handle_send_headers(cmd)
140
- BayLog.debug("%s handle_send_headers", @ship)
160
+ BayLog.debug("%s handle_send_headers", ship)
141
161
 
142
- tur = @ship.get_tour(FIXED_WARP_ID)
162
+ tur = ship.get_tour(FIXED_WARP_ID)
143
163
 
144
164
  if @state != STATE_READ_HEADER
145
165
  raise ProtocolException.new("Invalid AJP command: %d state=%s", cmd.type, @state)
@@ -147,14 +167,14 @@ module Baykit
147
167
 
148
168
  wdat = WarpData.get(tur)
149
169
 
150
- if BayServer.harbor.trace_header?
170
+ if BayServer.harbor.trace_header
151
171
  BayLog.info("%s recv res status: %d", wdat, cmd.status)
152
172
  end
153
173
 
154
174
  wdat.res_headers.status = cmd.status
155
175
  cmd.headers.keys.each do |name|
156
176
  cmd.headers[name].each do |value|
157
- if BayServer.harbor.trace_header?
177
+ if BayServer.harbor.trace_header
158
178
  BayLog.info("%s recv res header: %s=%s", wdat, name, value)
159
179
  end
160
180
  wdat.res_headers.add(name, value)
@@ -173,10 +193,6 @@ module Baykit
173
193
  return NextSocketAction::CONTINUE
174
194
  end
175
195
 
176
- def handle_eof
177
- raise EOFError.new()
178
- end
179
-
180
196
  def need_data
181
197
  return false
182
198
  end
@@ -190,8 +206,8 @@ module Baykit
190
206
  end
191
207
 
192
208
  def end_res_content(tur)
193
- @ship.end_warp_tour(tur)
194
- tur.res.end_content(Tour::TOUR_ID_NOCHECK)
209
+ ship.end_warp_tour(tur)
210
+ tur.res.end_res_content(Tour::TOUR_ID_NOCHECK)
195
211
  reset_state()
196
212
  end
197
213
 
@@ -218,7 +234,7 @@ module Baykit
218
234
  end
219
235
 
220
236
  rel_uri = rel_uri[town_path.length .. -1]
221
- req_uri = @ship.docker.warp_base + rel_uri
237
+ req_uri = ship.docker.warp_base + rel_uri
222
238
 
223
239
  pos = req_uri.index('?')
224
240
  if pos != nil
@@ -231,10 +247,10 @@ module Baykit
231
247
  cmd.remote_addr = tur.req.remote_address
232
248
  cmd.remote_host = tur.req.remote_host()
233
249
  cmd.server_name = tur.req.server_name
234
- cmd.server_port = @ship.docker.port
250
+ cmd.server_port = ship.docker.port
235
251
  cmd.is_ssl = tur.is_secure
236
252
  cmd.headers = tur.req.headers
237
- if BayServer.harbor.trace_header?
253
+ if BayServer.harbor.trace_header
238
254
  cmd.headers.names.each do |name|
239
255
  cmd.headers.values(name).each do |value|
240
256
  BayLog.info("%s sendWarpHeader: %s=%s", WarpData.get(tur), name, value)
@@ -242,7 +258,7 @@ module Baykit
242
258
  end
243
259
  end
244
260
 
245
- @ship.post(cmd)
261
+ ship.post(cmd)
246
262
  end
247
263
 
248
264
  def send_data(tur, data, ofs, len, &callback)
@@ -251,7 +267,11 @@ module Baykit
251
267
  cmd = CmdData.new(data, ofs, len)
252
268
  cmd.to_server = true
253
269
 
254
- @ship.post(cmd, &callback)
270
+ ship.post(cmd, &callback)
271
+ end
272
+
273
+ def ship
274
+ return @protocol_handler.ship
255
275
  end
256
276
 
257
277
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bayserver-docker-ajp
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.3.2
4
+ version: 3.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Michisuke-P
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-12-23 00:00:00.000000000 Z
11
+ date: 2024-11-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bayserver-core
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - '='
18
18
  - !ruby/object:Gem::Version
19
- version: 2.3.2
19
+ version: 3.0.0
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - '='
25
25
  - !ruby/object:Gem::Version
26
- version: 2.3.2
26
+ version: 3.0.0
27
27
  description: BayServer is one of the high-speed web servers. It operates as a single-threaded,
28
28
  asynchronous server, which makes it exceptionally fast. It also supports multi-core
29
29
  processors, harnessing the full potential of the CPU's capabilities.
@@ -38,6 +38,7 @@ files:
38
38
  - lib/baykit/bayserver/docker/ajp/ajp_command_handler.rb
39
39
  - lib/baykit/bayserver/docker/ajp/ajp_command_unpacker.rb
40
40
  - lib/baykit/bayserver/docker/ajp/ajp_docker.rb
41
+ - lib/baykit/bayserver/docker/ajp/ajp_handler.rb
41
42
  - lib/baykit/bayserver/docker/ajp/ajp_inbound_handler.rb
42
43
  - lib/baykit/bayserver/docker/ajp/ajp_packet.rb
43
44
  - lib/baykit/bayserver/docker/ajp/ajp_packet_factory.rb