bayserver-docker-http 3.3.1 → 3.3.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/baykit/bayserver/docker/http/h1/command/cmd_header.rb +36 -30
- data/lib/baykit/bayserver/docker/http/h1/h1_inbound_handler.rb +2 -1
- data/lib/baykit/bayserver/docker/http/h1/h1_packet_unpacker.rb +36 -41
- data/lib/baykit/bayserver/docker/http/h2/h2_inbound_handler.rb +2 -2
- metadata +4 -4
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 77533775218a5eeece533642ac1268d650988959191835225d32c64169b0a22b
|
|
4
|
+
data.tar.gz: 1f84273c4d5308ed6f0a9f35304d87a3ac81f39bc82ca1e2f76b51cb9e42fc72
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 8843bca3e9b0468c6c2b3f3a92803c2f8246a670ac8f94258c3e4b73bc5a2cf959b0d6d8e86067bd3f8ef7fe58a69b910bd37a9156fe55de7df26db937603693
|
|
7
|
+
data.tar.gz: 589f8e2c5db82799fe851e78c1a42c35a51dd963f849aad53f3dad6d246293cd0baa5e7e6cdbd7f9b271e84a18a0cba531ef5b661ca289472dcf0d804c13651b
|
|
@@ -118,42 +118,48 @@ module Baykit
|
|
|
118
118
|
end
|
|
119
119
|
|
|
120
120
|
def unpack(pkt)
|
|
121
|
-
acc = pkt.new_data_accessor
|
|
122
121
|
data_len = pkt.data_len()
|
|
123
122
|
state = STATE_READ_FIRST_LINE
|
|
124
123
|
|
|
125
124
|
line_start_pos = 0
|
|
126
125
|
line_len = 0
|
|
127
126
|
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
127
|
+
pos = 0
|
|
128
|
+
while pos < data_len
|
|
129
|
+
next_nl = pkt.buf.index("\n", pos)
|
|
130
|
+
if !next_nl
|
|
131
|
+
# No more new lines
|
|
132
|
+
break
|
|
133
|
+
end
|
|
133
134
|
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
135
|
+
line_start_pos = pos
|
|
136
|
+
|
|
137
|
+
# Calculate line length excluding \n
|
|
138
|
+
# Also handle \r if it exists just before \n
|
|
139
|
+
line_end = (next_nl > pos && pkt.buf[next_nl - 1] == "\r") ? next_nl - 1 : next_nl
|
|
140
|
+
line_len = line_end - pos
|
|
141
|
+
|
|
142
|
+
if line_len == 0
|
|
143
|
+
# Empty line found (End of headers)
|
|
144
|
+
# Move pos past the newline and exit
|
|
145
|
+
pos = next_nl + 1
|
|
146
|
+
break
|
|
147
|
+
end
|
|
148
|
+
|
|
149
|
+
if state == STATE_READ_FIRST_LINE
|
|
150
|
+
if @is_req_header
|
|
151
|
+
unpack_request_line(pkt.buf, pos, line_len)
|
|
146
152
|
else
|
|
147
|
-
|
|
153
|
+
unpack_status_line(pkt.buf, pos, line_len)
|
|
148
154
|
end
|
|
149
155
|
|
|
150
|
-
|
|
151
|
-
line_start_pos = pos + 1
|
|
152
|
-
|
|
156
|
+
state = STATE_READ_MESSAGE_HEADERS
|
|
153
157
|
else
|
|
154
|
-
|
|
158
|
+
unpack_message_header(pkt.buf, pos, line_len)
|
|
155
159
|
end
|
|
156
160
|
|
|
161
|
+
# Move to the start of the next line
|
|
162
|
+
pos = next_nl + 1
|
|
157
163
|
end
|
|
158
164
|
|
|
159
165
|
if state == STATE_READ_FIRST_LINE
|
|
@@ -257,11 +263,11 @@ module Baykit
|
|
|
257
263
|
end
|
|
258
264
|
|
|
259
265
|
def pack_request_line(acc)
|
|
260
|
-
acc.
|
|
266
|
+
acc.put_bytes(@method)
|
|
261
267
|
acc.put_bytes(" ")
|
|
262
|
-
acc.
|
|
268
|
+
acc.put_bytes(@uri)
|
|
263
269
|
acc.put_bytes(" ")
|
|
264
|
-
acc.
|
|
270
|
+
acc.put_bytes(@version)
|
|
265
271
|
acc.put_bytes(CharUtil::CRLF)
|
|
266
272
|
end
|
|
267
273
|
|
|
@@ -276,9 +282,9 @@ module Baykit
|
|
|
276
282
|
|
|
277
283
|
# status
|
|
278
284
|
acc.put_bytes(" ")
|
|
279
|
-
acc.
|
|
285
|
+
acc.put_bytes(@status.to_s)
|
|
280
286
|
acc.put_bytes(" ")
|
|
281
|
-
acc.
|
|
287
|
+
acc.put_bytes(desc)
|
|
282
288
|
acc.put_bytes(CharUtil::CRLF)
|
|
283
289
|
end
|
|
284
290
|
|
|
@@ -289,9 +295,9 @@ module Baykit
|
|
|
289
295
|
if !value.kind_of?(String)
|
|
290
296
|
raise RuntimeError.new("IllegalArgument: #{value}")
|
|
291
297
|
end
|
|
292
|
-
acc.
|
|
298
|
+
acc.put_bytes(name)
|
|
293
299
|
acc.put_bytes(":")
|
|
294
|
-
acc.
|
|
300
|
+
acc.put_bytes(value)
|
|
295
301
|
acc.put_bytes(CharUtil::CRLF)
|
|
296
302
|
end
|
|
297
303
|
|
|
@@ -139,7 +139,8 @@ module Baykit
|
|
|
139
139
|
@protocol_handler.post(cmd, &callback)
|
|
140
140
|
end
|
|
141
141
|
|
|
142
|
-
def send_end_tour(tur,
|
|
142
|
+
def send_end_tour(tur, &callback)
|
|
143
|
+
keep_alive = tur.res.headers.get_connection() == Headers::CONNECTION_KEEP_ALIVE
|
|
143
144
|
BayLog.trace("%s sendEndTour: tur=%s keep=%s", ship, tur, keep_alive)
|
|
144
145
|
|
|
145
146
|
# Send dummy end request command
|
|
@@ -68,50 +68,45 @@ module Baykit
|
|
|
68
68
|
suspend = false
|
|
69
69
|
|
|
70
70
|
if @state == STATE_READ_HEADERS
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
return next_act
|
|
101
|
-
else
|
|
102
|
-
raise RuntimeError.new("Invalid next action: #{next_act}")
|
|
103
|
-
end
|
|
104
|
-
|
|
105
|
-
suspend = (next_act == NextSocketAction::SUSPEND)
|
|
106
|
-
break
|
|
71
|
+
|
|
72
|
+
# Find end of headers (empty line)
|
|
73
|
+
# Look for \n\n (LF+LF) or \n\r\n (LF+CR+LF)
|
|
74
|
+
header_end_pos = buf.index("\n\r\n", pos) || buf.index("\n\n", pos)
|
|
75
|
+
|
|
76
|
+
if header_end_pos
|
|
77
|
+
# Calculate total header length
|
|
78
|
+
header_len = (buf[header_end_pos + 1] == "\r") ? header_end_pos + 3 : header_end_pos + 2
|
|
79
|
+
|
|
80
|
+
# Batch copy all header bytes at once
|
|
81
|
+
@tmp_buf.put(buf, pos, header_len - pos)
|
|
82
|
+
pos = header_len
|
|
83
|
+
|
|
84
|
+
# Move to packet processing
|
|
85
|
+
pkt = @pkt_store.rent(H1Type::HEADER)
|
|
86
|
+
pkt.new_data_accessor.put_bytes(@tmp_buf.bytes, 0, @tmp_buf.length)
|
|
87
|
+
|
|
88
|
+
begin
|
|
89
|
+
next_act = @cmd_upacker.packet_received(pkt)
|
|
90
|
+
ensure
|
|
91
|
+
@pkt_store.Return pkt
|
|
92
|
+
end
|
|
93
|
+
|
|
94
|
+
case next_act
|
|
95
|
+
when NextSocketAction::CONTINUE, NextSocketAction::SUSPEND
|
|
96
|
+
if @cmd_upacker.finished()
|
|
97
|
+
change_state(STATE_END)
|
|
98
|
+
else
|
|
99
|
+
change_state(STATE_READ_CONTENT)
|
|
107
100
|
end
|
|
108
|
-
|
|
101
|
+
when NextSocketAction::CLOSE
|
|
102
|
+
# Maybe error
|
|
103
|
+
reset_state()
|
|
104
|
+
return next_act
|
|
109
105
|
else
|
|
110
|
-
|
|
111
|
-
end
|
|
112
|
-
if line_len >= MAX_LINE_LEN
|
|
113
|
-
raise ProtocolException.new("Http/1 Line is too long")
|
|
106
|
+
raise RuntimeError.new("Invalid next action: #{next_act}")
|
|
114
107
|
end
|
|
108
|
+
|
|
109
|
+
suspend = (next_act == NextSocketAction::SUSPEND)
|
|
115
110
|
end
|
|
116
111
|
end
|
|
117
112
|
|
|
@@ -158,8 +158,8 @@ module Baykit
|
|
|
158
158
|
@protocol_handler.post(cmd, &callback)
|
|
159
159
|
end
|
|
160
160
|
|
|
161
|
-
def send_end_tour(tur,
|
|
162
|
-
BayLog.debug("%s send_end_tour. tur=%s
|
|
161
|
+
def send_end_tour(tur, &callback)
|
|
162
|
+
BayLog.debug("%s send_end_tour. tur=%s", self, tur)
|
|
163
163
|
cmd = CmdData.new(tur.req.key, nil, [], 0, 0)
|
|
164
164
|
cmd.flags.set_end_stream(true)
|
|
165
165
|
@protocol_handler.post(cmd, &callback)
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: bayserver-docker-http
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 3.3.
|
|
4
|
+
version: 3.3.2
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Michisuke-P
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2026-02-
|
|
11
|
+
date: 2026-02-02 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: 3.3.
|
|
19
|
+
version: 3.3.2
|
|
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: 3.3.
|
|
26
|
+
version: 3.3.2
|
|
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.
|