bayserver-docker-ajp 2.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/lib/baykit/bayserver/docker/ajp/ajp_command.rb +55 -0
- data/lib/baykit/bayserver/docker/ajp/ajp_command_handler.rb +26 -0
- data/lib/baykit/bayserver/docker/ajp/ajp_command_unpacker.rb +66 -0
- data/lib/baykit/bayserver/docker/ajp/ajp_docker.rb +15 -0
- data/lib/baykit/bayserver/docker/ajp/ajp_inbound_handler.rb +292 -0
- data/lib/baykit/bayserver/docker/ajp/ajp_packet.rb +112 -0
- data/lib/baykit/bayserver/docker/ajp/ajp_packet_factory.rb +18 -0
- data/lib/baykit/bayserver/docker/ajp/ajp_packet_unpacker.rb +150 -0
- data/lib/baykit/bayserver/docker/ajp/ajp_port_docker.rb +52 -0
- data/lib/baykit/bayserver/docker/ajp/ajp_protocol_handler.rb +55 -0
- data/lib/baykit/bayserver/docker/ajp/ajp_type.rb +22 -0
- data/lib/baykit/bayserver/docker/ajp/ajp_warp_docker.rb +54 -0
- data/lib/baykit/bayserver/docker/ajp/ajp_warp_handler.rb +258 -0
- data/lib/baykit/bayserver/docker/ajp/command/cmd_data.rb +59 -0
- data/lib/baykit/bayserver/docker/ajp/command/cmd_end_response.rb +48 -0
- data/lib/baykit/bayserver/docker/ajp/command/cmd_forward_request.rb +288 -0
- data/lib/baykit/bayserver/docker/ajp/command/cmd_get_body_chunk.rb +44 -0
- data/lib/baykit/bayserver/docker/ajp/command/cmd_send_body_chunk.rb +71 -0
- data/lib/baykit/bayserver/docker/ajp/command/cmd_send_headers.rb +153 -0
- data/lib/baykit/bayserver/docker/ajp/command/cmd_shutdown.rb +37 -0
- data/lib/baykit/bayserver/docker/ajp/command/package.rb +7 -0
- data/lib/baykit/bayserver/docker/ajp/package.rb +12 -0
- metadata +78 -0
@@ -0,0 +1,288 @@
|
|
1
|
+
require 'baykit/bayserver/docker/ajp/ajp_command'
|
2
|
+
require 'baykit/bayserver/docker/ajp/ajp_type'
|
3
|
+
require 'baykit/bayserver/protocol/protocol_exception'
|
4
|
+
require 'baykit/bayserver/util/headers'
|
5
|
+
|
6
|
+
#
|
7
|
+
# AJP protocol
|
8
|
+
# https://tomcat.apache.org/connectors-doc/ajp/ajpv13a.html
|
9
|
+
#
|
10
|
+
# AJP13_FORWARD_REQUEST :=
|
11
|
+
# prefix_code (byte) 0x02 = JK_AJP13_FORWARD_REQUEST
|
12
|
+
# method (byte)
|
13
|
+
# protocol (string)
|
14
|
+
# req_uri (string)
|
15
|
+
# remote_addr (string)
|
16
|
+
# remote_host (string)
|
17
|
+
# server_name (string)
|
18
|
+
# server_port (integer)
|
19
|
+
# is_ssl (boolean)
|
20
|
+
# num_headers (integer)
|
21
|
+
# request_headers(req_header_name req_header_value)
|
22
|
+
# attributes (attribut_name attribute_value)
|
23
|
+
# request_terminator (byte) OxFF
|
24
|
+
#
|
25
|
+
module Baykit
|
26
|
+
module BayServer
|
27
|
+
module Docker
|
28
|
+
module Ajp
|
29
|
+
module Command
|
30
|
+
class CmdForwardRequest < Baykit::BayServer::Docker::Ajp::AjpCommand
|
31
|
+
include Baykit::BayServer::Protocol
|
32
|
+
include Baykit::BayServer::Util
|
33
|
+
|
34
|
+
class << self
|
35
|
+
attr :method_map
|
36
|
+
attr :well_known_header_map
|
37
|
+
attr :attribute_name_map
|
38
|
+
end
|
39
|
+
|
40
|
+
@method_map = {
|
41
|
+
1 => "OPTIONS",
|
42
|
+
2 => "GET",
|
43
|
+
3 => "HEAD",
|
44
|
+
4 => "POST",
|
45
|
+
5 => "PUT",
|
46
|
+
6 => "DELETE",
|
47
|
+
7 => "TRACE",
|
48
|
+
8 => "PROPFIND",
|
49
|
+
9 => "PROPPATCH",
|
50
|
+
10 => "MKCOL",
|
51
|
+
11 => "COPY",
|
52
|
+
12 => "MOVE",
|
53
|
+
13 => "LOCK",
|
54
|
+
14 => "UNLOCK",
|
55
|
+
15 => "ACL",
|
56
|
+
16 => "REPORT",
|
57
|
+
17 => "VERSION_CONTROL",
|
58
|
+
18 => "CHECKIN",
|
59
|
+
19 => "CHECKOUT",
|
60
|
+
20 => "UNCHECKOUT",
|
61
|
+
21 => "SEARCH",
|
62
|
+
22 => "MKWORKSPACE",
|
63
|
+
23 => "UPDATE",
|
64
|
+
24 => "LABEL",
|
65
|
+
25 => "MERGE",
|
66
|
+
26 => "BASELINE_CONTROL",
|
67
|
+
27 => "MKACTIVITY",
|
68
|
+
}
|
69
|
+
|
70
|
+
def self.get_method_code(method)
|
71
|
+
@method_map.keys.each do |key|
|
72
|
+
if @method_map[key].casecmp? method
|
73
|
+
return key
|
74
|
+
end
|
75
|
+
end
|
76
|
+
return -1
|
77
|
+
end
|
78
|
+
|
79
|
+
|
80
|
+
@well_known_header_map = {
|
81
|
+
0xA001 => "Accept",
|
82
|
+
0xA002 => "Accept-Charset",
|
83
|
+
0xA003 => "Accept-Encoding",
|
84
|
+
0xA004 => "Accept-Language",
|
85
|
+
0xA005 => "Authorization",
|
86
|
+
0xA006 => "Connection",
|
87
|
+
0xA007 => "Content-Type",
|
88
|
+
0xA008 => "Content-Length",
|
89
|
+
0xA009 => "Cookie",
|
90
|
+
0xA00A => "Cookie2",
|
91
|
+
0xA00B => "Host",
|
92
|
+
0xA00C => "Pragma",
|
93
|
+
0xA00D => "Referer",
|
94
|
+
0xA00E => "User-Agent",
|
95
|
+
}
|
96
|
+
|
97
|
+
def self.get_well_known_header_code(name)
|
98
|
+
@well_known_header_map.keys.each do |key|
|
99
|
+
if @well_known_header_map[key].casecmp? name
|
100
|
+
return key
|
101
|
+
end
|
102
|
+
end
|
103
|
+
return -1
|
104
|
+
end
|
105
|
+
|
106
|
+
|
107
|
+
@attribute_name_map = {
|
108
|
+
0x01 => "?context",
|
109
|
+
0x02 => "?servlet_path",
|
110
|
+
0x03 => "?remote_user",
|
111
|
+
0x04 => "?auth_type",
|
112
|
+
0x05 => "?query_string",
|
113
|
+
0x06 => "?route",
|
114
|
+
0x07 => "?ssl_cert",
|
115
|
+
0x08 => "?ssl_cipher",
|
116
|
+
0x09 => "?ssl_session",
|
117
|
+
0x0A => "?req_attribute",
|
118
|
+
0x0B => "?ssl_key_size",
|
119
|
+
0x0C => "?secret",
|
120
|
+
0x0D => "?stored_method",
|
121
|
+
}
|
122
|
+
|
123
|
+
def self.get_attribute_code(atr)
|
124
|
+
@attribute_name_map.keys.each do |key|
|
125
|
+
if @attribute_name_map[key].casecmp?(atr)
|
126
|
+
return key
|
127
|
+
end
|
128
|
+
end
|
129
|
+
return -1
|
130
|
+
end
|
131
|
+
|
132
|
+
attr_accessor :method
|
133
|
+
attr_accessor :protocol
|
134
|
+
attr_accessor :req_uri
|
135
|
+
attr_accessor :remote_addr
|
136
|
+
attr_accessor :remote_host
|
137
|
+
attr_accessor :server_name
|
138
|
+
attr_accessor :server_port
|
139
|
+
attr_accessor :is_ssl
|
140
|
+
attr_accessor :headers
|
141
|
+
attr :attributes
|
142
|
+
|
143
|
+
def initialize
|
144
|
+
super(AjpType::FORWARD_REQUEST, true)
|
145
|
+
@headers = Headers.new()
|
146
|
+
@attributes = {}
|
147
|
+
end
|
148
|
+
|
149
|
+
def to_s()
|
150
|
+
return "ForwardRequest(m=#{self.method} p=#{self.protocol} u=#{self.req_uri} ra=#{self.remote_addr} rh=#{self.remote_host} sn=#{self.server_name} sp=#{self.server_port} ss=#{self.is_ssl} h=#{self.headers}"
|
151
|
+
end
|
152
|
+
|
153
|
+
def pack(pkt)
|
154
|
+
#BayLog.info("%s", self)
|
155
|
+
acc = pkt.new_ajp_data_accessor()
|
156
|
+
acc.put_byte(@type) # prefix code
|
157
|
+
acc.put_byte(CmdForwardRequest.get_method_code(@method))
|
158
|
+
acc.put_string(@protocol)
|
159
|
+
acc.put_string(@req_uri)
|
160
|
+
acc.put_string(@remote_addr)
|
161
|
+
acc.put_string(@remote_host)
|
162
|
+
acc.put_string(@server_name)
|
163
|
+
acc.put_short(@server_port)
|
164
|
+
acc.put_byte(@is_ssl ? 1 : 0)
|
165
|
+
write_request_headers(acc)
|
166
|
+
write_attributes(acc)
|
167
|
+
|
168
|
+
# must be called from last line
|
169
|
+
super
|
170
|
+
end
|
171
|
+
|
172
|
+
def unpack(pkt)
|
173
|
+
super
|
174
|
+
acc = pkt.new_ajp_data_accessor()
|
175
|
+
acc.get_byte() # prefix code
|
176
|
+
@method = CmdForwardRequest.method_map[acc.get_byte]
|
177
|
+
@protocol = acc.get_string
|
178
|
+
@req_uri = acc.get_string
|
179
|
+
@remote_addr = acc.get_string
|
180
|
+
@remote_host = acc.get_string
|
181
|
+
@server_name = acc.get_string
|
182
|
+
@server_port = acc.get_short
|
183
|
+
@is_ssl = acc.get_byte == 1
|
184
|
+
|
185
|
+
read_request_headers(acc)
|
186
|
+
read_attributes(acc)
|
187
|
+
end
|
188
|
+
|
189
|
+
def handle(handler)
|
190
|
+
return handler.handle_forward_request(self)
|
191
|
+
end
|
192
|
+
|
193
|
+
|
194
|
+
private
|
195
|
+
def read_request_headers(acc)
|
196
|
+
count = acc.get_short
|
197
|
+
count.times do |i|
|
198
|
+
code = acc.get_short
|
199
|
+
|
200
|
+
if code >= 0xA000
|
201
|
+
name = CmdForwardRequest.well_known_header_map[code]
|
202
|
+
|
203
|
+
if name == nil
|
204
|
+
raise ProtocolException.new("Invalid header")
|
205
|
+
end
|
206
|
+
else
|
207
|
+
# code is length of header name
|
208
|
+
name = acc.get_string_by_len(code)
|
209
|
+
end
|
210
|
+
|
211
|
+
value = acc.get_string
|
212
|
+
@headers.add(name, value)
|
213
|
+
#BayLog.trace "ForwardRequest header: #{name}=#{value}"
|
214
|
+
end
|
215
|
+
end
|
216
|
+
|
217
|
+
def read_attributes(acc)
|
218
|
+
while true
|
219
|
+
code = acc.get_byte()
|
220
|
+
|
221
|
+
if code == 0xFF
|
222
|
+
break
|
223
|
+
elsif code == 0x0A
|
224
|
+
name = acc.get_string()
|
225
|
+
else
|
226
|
+
name = CmdForwardRequest.attribute_name_map[code]
|
227
|
+
if name == nil
|
228
|
+
raise ProtocolException.new "Invalid attribute: code=#{code}"
|
229
|
+
end
|
230
|
+
end
|
231
|
+
|
232
|
+
if code == 0x0B # "?ssl_key_size"
|
233
|
+
value = acc.get_short()
|
234
|
+
@attributes[name] = value.to_s
|
235
|
+
else
|
236
|
+
value = acc.get_string
|
237
|
+
@attributes[name] = value
|
238
|
+
end
|
239
|
+
|
240
|
+
#BayLog.trace "ForwardRequest readAttributes:#{name}=#{value}"
|
241
|
+
end
|
242
|
+
end
|
243
|
+
|
244
|
+
def write_request_headers(acc)
|
245
|
+
h_list = []
|
246
|
+
@headers.names.each do |name|
|
247
|
+
@headers.values(name).each do |value|
|
248
|
+
h_list << [name, value]
|
249
|
+
end
|
250
|
+
end
|
251
|
+
|
252
|
+
acc.put_short(h_list.length)
|
253
|
+
h_list.each do |item|
|
254
|
+
code = CmdForwardRequest.get_well_known_header_code(item[0])
|
255
|
+
if code != -1
|
256
|
+
acc.put_short(code)
|
257
|
+
else
|
258
|
+
acc.put_string(item[0])
|
259
|
+
end
|
260
|
+
|
261
|
+
acc.put_string(item[1])
|
262
|
+
end
|
263
|
+
|
264
|
+
end
|
265
|
+
|
266
|
+
def write_attributes(acc)
|
267
|
+
@attributes.keys.each do |name|
|
268
|
+
value = @attributes[name]
|
269
|
+
code = CmdForwardRequest.get_attribute_code(name)
|
270
|
+
if code != -1
|
271
|
+
acc.put_byte(code)
|
272
|
+
else
|
273
|
+
acc.put_string(name)
|
274
|
+
end
|
275
|
+
|
276
|
+
acc.put_string(value)
|
277
|
+
end
|
278
|
+
|
279
|
+
acc.put_byte(0xFF) # terminator code
|
280
|
+
end
|
281
|
+
end
|
282
|
+
|
283
|
+
end
|
284
|
+
end
|
285
|
+
end
|
286
|
+
end
|
287
|
+
end
|
288
|
+
|
@@ -0,0 +1,44 @@
|
|
1
|
+
require 'baykit/bayserver/docker/ajp/ajp_command'
|
2
|
+
require 'baykit/bayserver/docker/ajp/ajp_type'
|
3
|
+
require 'baykit/bayserver/docker/ajp/ajp_packet'
|
4
|
+
|
5
|
+
#
|
6
|
+
# Get Body Chunk format
|
7
|
+
#
|
8
|
+
# AJP13_GET_BODY_CHUNK :=
|
9
|
+
# prefix_code 6
|
10
|
+
# requested_length (integer)
|
11
|
+
#
|
12
|
+
module Baykit
|
13
|
+
module BayServer
|
14
|
+
module Docker
|
15
|
+
module Ajp
|
16
|
+
module Command
|
17
|
+
class CmdGetBodyChunk < Baykit::BayServer::Docker::Ajp::AjpCommand
|
18
|
+
attr_accessor :req_len
|
19
|
+
|
20
|
+
def initialize()
|
21
|
+
super AjpType::GET_BODY_CHUNK, false
|
22
|
+
end
|
23
|
+
|
24
|
+
def pack(pkt)
|
25
|
+
acc = pkt.new_ajp_data_accessor()
|
26
|
+
acc.put_byte(@type)
|
27
|
+
acc.put_short(@req_len)
|
28
|
+
|
29
|
+
# must be called from last line
|
30
|
+
super
|
31
|
+
end
|
32
|
+
|
33
|
+
def handle(handler)
|
34
|
+
return handler.handle_get_body_chunk(self)
|
35
|
+
end
|
36
|
+
|
37
|
+
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
@@ -0,0 +1,71 @@
|
|
1
|
+
require 'baykit/bayserver/docker/ajp/ajp_command'
|
2
|
+
require 'baykit/bayserver/docker/ajp/ajp_type'
|
3
|
+
require 'baykit/bayserver/docker/ajp/ajp_packet'
|
4
|
+
require 'baykit/bayserver/util/string_util'
|
5
|
+
#
|
6
|
+
# Send body chunk format
|
7
|
+
#
|
8
|
+
# AJP13_SEND_BODY_CHUNK :=
|
9
|
+
# prefix_code (byte) 0x03
|
10
|
+
# chunk_length (integer)
|
11
|
+
# chunk *(byte)
|
12
|
+
#
|
13
|
+
module Baykit
|
14
|
+
module BayServer
|
15
|
+
module Docker
|
16
|
+
module Ajp
|
17
|
+
module Command
|
18
|
+
class CmdSendBodyChunk < Baykit::BayServer::Docker::Ajp::AjpCommand
|
19
|
+
include Baykit::BayServer::Docker::Ajp
|
20
|
+
include Baykit::BayServer::Util
|
21
|
+
|
22
|
+
attr :chunk
|
23
|
+
attr :offset
|
24
|
+
attr :length
|
25
|
+
|
26
|
+
MAX_CHUNKLEN = AjpPacket::MAX_DATA_LEN - 4
|
27
|
+
|
28
|
+
def initialize(buf, ofs, len)
|
29
|
+
super(AjpType::SEND_BODY_CHUNK, false)
|
30
|
+
@chunk = buf
|
31
|
+
@offset = ofs
|
32
|
+
@length = len
|
33
|
+
end
|
34
|
+
|
35
|
+
def pack(pkt)
|
36
|
+
if @length > MAX_CHUNKLEN
|
37
|
+
raise RuntimeError.new("IllegalArgument")
|
38
|
+
end
|
39
|
+
|
40
|
+
acc = pkt.new_ajp_data_accessor
|
41
|
+
acc.put_byte(@type)
|
42
|
+
acc.put_short(@length)
|
43
|
+
acc.put_bytes(@chunk, @offset, @length)
|
44
|
+
acc.put_byte(0) # maybe document bug
|
45
|
+
|
46
|
+
# must be called from last line
|
47
|
+
super
|
48
|
+
end
|
49
|
+
|
50
|
+
def unpack(pkt)
|
51
|
+
acc = pkt.new_ajp_data_accessor
|
52
|
+
acc.get_byte # code
|
53
|
+
@length = acc.get_short
|
54
|
+
if @chunk == nil || @length > @chunk.length
|
55
|
+
@chunk = StringUtil.alloc(@length)
|
56
|
+
end
|
57
|
+
|
58
|
+
acc.get_bytes(@chunk, 0, @length)
|
59
|
+
end
|
60
|
+
|
61
|
+
def handle(handler)
|
62
|
+
return handler.handle_send_body_chunk(self)
|
63
|
+
end
|
64
|
+
|
65
|
+
end
|
66
|
+
end
|
67
|
+
end
|
68
|
+
end
|
69
|
+
end
|
70
|
+
end
|
71
|
+
|
@@ -0,0 +1,153 @@
|
|
1
|
+
require 'baykit/bayserver/docker/ajp/ajp_command'
|
2
|
+
require 'baykit/bayserver/docker/ajp/ajp_type'
|
3
|
+
require 'baykit/bayserver/util/http_status'
|
4
|
+
|
5
|
+
#
|
6
|
+
# Send headers format
|
7
|
+
#
|
8
|
+
# AJP13_SEND_HEADERS :=
|
9
|
+
# prefix_code 4
|
10
|
+
# http_status_code (integer)
|
11
|
+
# http_status_msg (string)
|
12
|
+
# num_headers (integer)
|
13
|
+
# response_headers *(res_header_name header_value)
|
14
|
+
#
|
15
|
+
# res_header_name :=
|
16
|
+
# sc_res_header_name | (string) [see below for how this is parsed]
|
17
|
+
#
|
18
|
+
# sc_res_header_name := 0xA0 (byte)
|
19
|
+
#
|
20
|
+
# header_value := (string)
|
21
|
+
#
|
22
|
+
module Baykit
|
23
|
+
module BayServer
|
24
|
+
module Docker
|
25
|
+
module Ajp
|
26
|
+
module Command
|
27
|
+
class CmdSendHeaders < Baykit::BayServer::Docker::Ajp::AjpCommand
|
28
|
+
include Baykit::BayServer::Util
|
29
|
+
|
30
|
+
class << self
|
31
|
+
attr :well_known_header_map
|
32
|
+
end
|
33
|
+
|
34
|
+
@well_known_header_map = {
|
35
|
+
"content-type" => 0xA001,
|
36
|
+
"content-language" => 0xA002,
|
37
|
+
"content-length" => 0xA003,
|
38
|
+
"date" => 0xA004,
|
39
|
+
"last-modified" => 0xA005,
|
40
|
+
"location" => 0xA006,
|
41
|
+
"set-cookie" => 0xA007,
|
42
|
+
"set-cookie2" => 0xA008,
|
43
|
+
"servlet-engine" => 0xA009,
|
44
|
+
"status" => 0xA00A,
|
45
|
+
"www-authenticate" => 0xA00B,
|
46
|
+
}
|
47
|
+
|
48
|
+
def self.get_well_known_header_name(code)
|
49
|
+
@well_known_header_map.keys.each do |name|
|
50
|
+
if @well_known_header_map[name] == code
|
51
|
+
return name
|
52
|
+
end
|
53
|
+
end
|
54
|
+
return nil
|
55
|
+
end
|
56
|
+
|
57
|
+
attr :headers
|
58
|
+
attr_accessor :status
|
59
|
+
attr :desc
|
60
|
+
|
61
|
+
def initialize
|
62
|
+
super(AjpType::SEND_HEADERS, false)
|
63
|
+
@headers = {}
|
64
|
+
@status = HttpStatus::OK
|
65
|
+
@desc = nil
|
66
|
+
end
|
67
|
+
|
68
|
+
def to_s()
|
69
|
+
return "SendHeaders(s=#{@status} d=#{@desc} h=#{@headers}"
|
70
|
+
end
|
71
|
+
|
72
|
+
def pack(pkt)
|
73
|
+
acc = pkt.new_ajp_data_accessor
|
74
|
+
acc.put_byte(@type)
|
75
|
+
acc.put_short(@status)
|
76
|
+
acc.put_string(HttpStatus.description(@status))
|
77
|
+
|
78
|
+
count = 0
|
79
|
+
@headers.keys.each do |key|
|
80
|
+
count += @headers[key].length
|
81
|
+
end
|
82
|
+
acc.put_short(count)
|
83
|
+
|
84
|
+
@headers.keys.each do |name|
|
85
|
+
code = CmdSendHeaders.well_known_header_map[name]
|
86
|
+
|
87
|
+
@headers[name].each do |value|
|
88
|
+
if code != nil
|
89
|
+
acc.put_short(code)
|
90
|
+
else
|
91
|
+
acc.put_string(name)
|
92
|
+
end
|
93
|
+
acc.put_string(value)
|
94
|
+
end
|
95
|
+
end
|
96
|
+
|
97
|
+
# must be called from last line
|
98
|
+
super
|
99
|
+
end
|
100
|
+
|
101
|
+
def unpack(pkt)
|
102
|
+
acc = pkt.new_ajp_data_accessor
|
103
|
+
prefix_code = acc.get_byte
|
104
|
+
if prefix_code != AjpType::SEND_HEADERS
|
105
|
+
raise ProtocolException.new "Expected SEND_HEADERS"
|
106
|
+
end
|
107
|
+
|
108
|
+
@status = acc.get_short
|
109
|
+
@desc = acc.get_string
|
110
|
+
count = acc.get_short
|
111
|
+
count.times do |i|
|
112
|
+
code = acc.get_short
|
113
|
+
name = CmdSendHeaders.get_well_known_header_name(code)
|
114
|
+
if name == nil
|
115
|
+
name = acc.get_string_by_len(code)
|
116
|
+
end
|
117
|
+
|
118
|
+
value = acc.get_string
|
119
|
+
add_header(name, value)
|
120
|
+
end
|
121
|
+
#BayLog.info("%s", self)
|
122
|
+
end
|
123
|
+
|
124
|
+
def handle(handler)
|
125
|
+
return handler.handle_send_headers(self)
|
126
|
+
end
|
127
|
+
|
128
|
+
|
129
|
+
def get_header(name)
|
130
|
+
values = @headers[name.downcase]
|
131
|
+
if values == nil || values.empty?
|
132
|
+
nil
|
133
|
+
else
|
134
|
+
values[0]
|
135
|
+
end
|
136
|
+
end
|
137
|
+
|
138
|
+
def add_header(name, value)
|
139
|
+
values = @headers[name]
|
140
|
+
if values == nil
|
141
|
+
values = []
|
142
|
+
@headers[name] = values
|
143
|
+
end
|
144
|
+
values.append(value)
|
145
|
+
end
|
146
|
+
|
147
|
+
end
|
148
|
+
end
|
149
|
+
end
|
150
|
+
end
|
151
|
+
end
|
152
|
+
end
|
153
|
+
|
@@ -0,0 +1,37 @@
|
|
1
|
+
require 'baykit/bayserver/docker/ajp/ajp_command'
|
2
|
+
require 'baykit/bayserver/docker/ajp/ajp_type'
|
3
|
+
|
4
|
+
#
|
5
|
+
# Shutdown command format
|
6
|
+
#
|
7
|
+
# none
|
8
|
+
#
|
9
|
+
module Baykit
|
10
|
+
module BayServer
|
11
|
+
module Docker
|
12
|
+
module Ajp
|
13
|
+
module Command
|
14
|
+
class CmdShutdown < Baykit::BayServer::Docker::Ajp::AjpCommand
|
15
|
+
|
16
|
+
def initialize
|
17
|
+
super(AjpType::SHUTDOWN, true)
|
18
|
+
end
|
19
|
+
|
20
|
+
def unpack(pkt)
|
21
|
+
super
|
22
|
+
end
|
23
|
+
|
24
|
+
def pack(pkt)
|
25
|
+
super
|
26
|
+
end
|
27
|
+
|
28
|
+
def handle(handler)
|
29
|
+
return handler.handle_shutdown(self)
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
@@ -0,0 +1,7 @@
|
|
1
|
+
require 'baykit/bayserver/docker/ajp/command/cmd_data'
|
2
|
+
require 'baykit/bayserver/docker/ajp/command/cmd_end_response'
|
3
|
+
require 'baykit/bayserver/docker/ajp/command/cmd_forward_request'
|
4
|
+
require 'baykit/bayserver/docker/ajp/command/cmd_get_body_chunk'
|
5
|
+
require 'baykit/bayserver/docker/ajp/command/cmd_send_body_chunk'
|
6
|
+
require 'baykit/bayserver/docker/ajp/command/cmd_send_headers'
|
7
|
+
require 'baykit/bayserver/docker/ajp/command/cmd_shutdown'
|
@@ -0,0 +1,12 @@
|
|
1
|
+
require 'baykit/bayserver/docker/ajp/ajp_command'
|
2
|
+
require 'baykit/bayserver/docker/ajp/ajp_command_handler'
|
3
|
+
require 'baykit/bayserver/docker/ajp/ajp_command_unpacker'
|
4
|
+
require 'baykit/bayserver/docker/ajp/ajp_inbound_handler'
|
5
|
+
require 'baykit/bayserver/docker/ajp/ajp_docker'
|
6
|
+
require 'baykit/bayserver/docker/ajp/ajp_packet'
|
7
|
+
require 'baykit/bayserver/docker/ajp/ajp_packet_factory'
|
8
|
+
require 'baykit/bayserver/docker/ajp/ajp_packet_unpacker'
|
9
|
+
require 'baykit/bayserver/docker/ajp/ajp_port_docker'
|
10
|
+
require 'baykit/bayserver/docker/ajp/ajp_protocol_handler'
|
11
|
+
require 'baykit/bayserver/docker/ajp/ajp_type'
|
12
|
+
require 'baykit/bayserver/docker/ajp/ajp_warp_handler'
|
metadata
ADDED
@@ -0,0 +1,78 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: bayserver-docker-ajp
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 2.2.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Michisuke-P
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2023-08-29 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: bayserver-core
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - '='
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: 2.2.0
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - '='
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: 2.2.0
|
27
|
+
description: AJP docker of BayServer
|
28
|
+
email: michisukep@gmail.com
|
29
|
+
executables: []
|
30
|
+
extensions: []
|
31
|
+
extra_rdoc_files: []
|
32
|
+
files:
|
33
|
+
- lib/baykit/bayserver/docker/ajp/ajp_command.rb
|
34
|
+
- lib/baykit/bayserver/docker/ajp/ajp_command_handler.rb
|
35
|
+
- lib/baykit/bayserver/docker/ajp/ajp_command_unpacker.rb
|
36
|
+
- lib/baykit/bayserver/docker/ajp/ajp_docker.rb
|
37
|
+
- lib/baykit/bayserver/docker/ajp/ajp_inbound_handler.rb
|
38
|
+
- lib/baykit/bayserver/docker/ajp/ajp_packet.rb
|
39
|
+
- lib/baykit/bayserver/docker/ajp/ajp_packet_factory.rb
|
40
|
+
- lib/baykit/bayserver/docker/ajp/ajp_packet_unpacker.rb
|
41
|
+
- lib/baykit/bayserver/docker/ajp/ajp_port_docker.rb
|
42
|
+
- lib/baykit/bayserver/docker/ajp/ajp_protocol_handler.rb
|
43
|
+
- lib/baykit/bayserver/docker/ajp/ajp_type.rb
|
44
|
+
- lib/baykit/bayserver/docker/ajp/ajp_warp_docker.rb
|
45
|
+
- lib/baykit/bayserver/docker/ajp/ajp_warp_handler.rb
|
46
|
+
- lib/baykit/bayserver/docker/ajp/command/cmd_data.rb
|
47
|
+
- lib/baykit/bayserver/docker/ajp/command/cmd_end_response.rb
|
48
|
+
- lib/baykit/bayserver/docker/ajp/command/cmd_forward_request.rb
|
49
|
+
- lib/baykit/bayserver/docker/ajp/command/cmd_get_body_chunk.rb
|
50
|
+
- lib/baykit/bayserver/docker/ajp/command/cmd_send_body_chunk.rb
|
51
|
+
- lib/baykit/bayserver/docker/ajp/command/cmd_send_headers.rb
|
52
|
+
- lib/baykit/bayserver/docker/ajp/command/cmd_shutdown.rb
|
53
|
+
- lib/baykit/bayserver/docker/ajp/command/package.rb
|
54
|
+
- lib/baykit/bayserver/docker/ajp/package.rb
|
55
|
+
homepage: https://baykit.yokohama
|
56
|
+
licenses:
|
57
|
+
- MIT
|
58
|
+
metadata: {}
|
59
|
+
post_install_message:
|
60
|
+
rdoc_options: []
|
61
|
+
require_paths:
|
62
|
+
- lib
|
63
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
64
|
+
requirements:
|
65
|
+
- - ">="
|
66
|
+
- !ruby/object:Gem::Version
|
67
|
+
version: '0'
|
68
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
69
|
+
requirements:
|
70
|
+
- - ">="
|
71
|
+
- !ruby/object:Gem::Version
|
72
|
+
version: '0'
|
73
|
+
requirements: []
|
74
|
+
rubygems_version: 3.1.6
|
75
|
+
signing_key:
|
76
|
+
specification_version: 4
|
77
|
+
summary: AJP docker of BayServer
|
78
|
+
test_files: []
|