bayserver-docker-http 2.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (52) hide show
  1. checksums.yaml +7 -0
  2. data/lib/baykit/bayserver/docker/http/h1/command/cmd_content.rb +46 -0
  3. data/lib/baykit/bayserver/docker/http/h1/command/cmd_end_content.rb +37 -0
  4. data/lib/baykit/bayserver/docker/http/h1/command/cmd_header.rb +306 -0
  5. data/lib/baykit/bayserver/docker/http/h1/command/package.rb +3 -0
  6. data/lib/baykit/bayserver/docker/http/h1/h1_command.rb +19 -0
  7. data/lib/baykit/bayserver/docker/http/h1/h1_command_handler.rb +31 -0
  8. data/lib/baykit/bayserver/docker/http/h1/h1_command_unpacker.rb +58 -0
  9. data/lib/baykit/bayserver/docker/http/h1/h1_inbound_handler.rb +371 -0
  10. data/lib/baykit/bayserver/docker/http/h1/h1_packet.rb +28 -0
  11. data/lib/baykit/bayserver/docker/http/h1/h1_packet_factory.rb +21 -0
  12. data/lib/baykit/bayserver/docker/http/h1/h1_packet_unpacker.rb +180 -0
  13. data/lib/baykit/bayserver/docker/http/h1/h1_protocol_handler.rb +66 -0
  14. data/lib/baykit/bayserver/docker/http/h1/h1_type.rb +18 -0
  15. data/lib/baykit/bayserver/docker/http/h1/h1_warp_handler.rb +228 -0
  16. data/lib/baykit/bayserver/docker/http/h1/package.rb +11 -0
  17. data/lib/baykit/bayserver/docker/http/h2/command/cmd_data.rb +65 -0
  18. data/lib/baykit/bayserver/docker/http/h2/command/cmd_go_away.rb +67 -0
  19. data/lib/baykit/bayserver/docker/http/h2/command/cmd_headers.rb +108 -0
  20. data/lib/baykit/bayserver/docker/http/h2/command/cmd_ping.rb +50 -0
  21. data/lib/baykit/bayserver/docker/http/h2/command/cmd_preface.rb +51 -0
  22. data/lib/baykit/bayserver/docker/http/h2/command/cmd_priority.rb +59 -0
  23. data/lib/baykit/bayserver/docker/http/h2/command/cmd_rst_stream.rb +50 -0
  24. data/lib/baykit/bayserver/docker/http/h2/command/cmd_settings.rb +98 -0
  25. data/lib/baykit/bayserver/docker/http/h2/command/cmd_window_update.rb +53 -0
  26. data/lib/baykit/bayserver/docker/http/h2/command/package.rb +9 -0
  27. data/lib/baykit/bayserver/docker/http/h2/h2_command.rb +42 -0
  28. data/lib/baykit/bayserver/docker/http/h2/h2_command_handler.rb +29 -0
  29. data/lib/baykit/bayserver/docker/http/h2/h2_command_unpacker.rb +73 -0
  30. data/lib/baykit/bayserver/docker/http/h2/h2_error_code.rb +53 -0
  31. data/lib/baykit/bayserver/docker/http/h2/h2_flags.rb +82 -0
  32. data/lib/baykit/bayserver/docker/http/h2/h2_inbound_handler.rb +417 -0
  33. data/lib/baykit/bayserver/docker/http/h2/h2_packet.rb +204 -0
  34. data/lib/baykit/bayserver/docker/http/h2/h2_packet_factory.rb +21 -0
  35. data/lib/baykit/bayserver/docker/http/h2/h2_packet_unpacker.rb +224 -0
  36. data/lib/baykit/bayserver/docker/http/h2/h2_protocol_handler.rb +58 -0
  37. data/lib/baykit/bayserver/docker/http/h2/h2_settings.rb +42 -0
  38. data/lib/baykit/bayserver/docker/http/h2/h2_type.rb +26 -0
  39. data/lib/baykit/bayserver/docker/http/h2/h2_warp_handler.rb +142 -0
  40. data/lib/baykit/bayserver/docker/http/h2/header_block.rb +191 -0
  41. data/lib/baykit/bayserver/docker/http/h2/header_block_analyzer.rb +88 -0
  42. data/lib/baykit/bayserver/docker/http/h2/header_block_builder.rb +68 -0
  43. data/lib/baykit/bayserver/docker/http/h2/header_table.rb +167 -0
  44. data/lib/baykit/bayserver/docker/http/h2/huffman/hnode.rb +28 -0
  45. data/lib/baykit/bayserver/docker/http/h2/huffman/htree.rb +339 -0
  46. data/lib/baykit/bayserver/docker/http/h2/package.rb +17 -0
  47. data/lib/baykit/bayserver/docker/http/htp_docker.rb +23 -0
  48. data/lib/baykit/bayserver/docker/http/htp_port_docker.rb +107 -0
  49. data/lib/baykit/bayserver/docker/http/htp_warp_docker.rb +125 -0
  50. data/lib/baykit/bayserver/docker/http/htp_warp_ship_helper.rb +19 -0
  51. data/lib/baykit/bayserver/docker/http/package.rb +6 -0
  52. metadata +106 -0
@@ -0,0 +1,17 @@
1
+ require 'baykit/bayserver/docker/http/h2/h2_type'
2
+ require 'baykit/bayserver/docker/http/h2/h2_packet'
3
+ require 'baykit/bayserver/docker/http/h2/h2_packet_factory'
4
+ require 'baykit/bayserver/docker/http/h2/h2_packet_unpacker'
5
+ require 'baykit/bayserver/docker/http/h2/h2_command'
6
+ require 'baykit/bayserver/docker/http/h2/h2_command_unpacker'
7
+ require 'baykit/bayserver/docker/http/h2/h2_command_handler'
8
+ require 'baykit/bayserver/docker/http/h2/h2_inbound_handler'
9
+ require 'baykit/bayserver/docker/http/h2/h2_protocol_handler'
10
+ require 'baykit/bayserver/docker/http/h2/h2_error_code'
11
+ require 'baykit/bayserver/docker/http/h2/h2_settings'
12
+ require 'baykit/bayserver/docker/http/h2/h2_type'
13
+ require 'baykit/bayserver/docker/http/h2/h2_warp_handler'
14
+ require 'baykit/bayserver/docker/http/h2/header_block'
15
+ require 'baykit/bayserver/docker/http/h2/header_block_analyzer'
16
+ require 'baykit/bayserver/docker/http/h2/header_block_builder'
17
+ require 'baykit/bayserver/docker/http/h2/header_table'
@@ -0,0 +1,23 @@
1
+ require 'baykit/bayserver/agent/transporter/package'
2
+ require 'baykit/bayserver/docker/base/port_base'
3
+ require 'baykit/bayserver/docker/warp/package'
4
+ require 'baykit/bayserver/docker/http/h1/package'
5
+
6
+
7
+ module Baykit
8
+ module BayServer
9
+ module Docker
10
+ module Http
11
+ module HtpDocker
12
+ #
13
+ # interface
14
+ #
15
+
16
+ H1_PROTO_NAME = "h1"
17
+ H2_PROTO_NAME = "h2"
18
+ end
19
+ end
20
+ end
21
+ end
22
+ end
23
+
@@ -0,0 +1,107 @@
1
+ require 'baykit/bayserver/agent/transporter/package'
2
+ require 'baykit/bayserver/protocol/packet_store'
3
+ require 'baykit/bayserver/util/io_util'
4
+ require 'baykit/bayserver/util/string_util'
5
+
6
+ require 'baykit/bayserver/docker/base/port_base'
7
+ require 'baykit/bayserver/docker/http/htp_docker'
8
+ require 'baykit/bayserver/docker/http/h1/package'
9
+ require 'baykit/bayserver/docker/http/h2/package'
10
+
11
+ module Baykit
12
+ module BayServer
13
+ module Docker
14
+ module Http
15
+ class HtpPortDocker < Baykit::BayServer::Docker::Base::PortBase
16
+ include Baykit::BayServer::Docker::Http::HtpDocker # implements
17
+
18
+ include Baykit::BayServer::Bcf
19
+ include Baykit::BayServer::Protocol
20
+ include Baykit::BayServer::WaterCraft
21
+ include Baykit::BayServer::Util
22
+ include Baykit::BayServer::Docker::Base
23
+ include Baykit::BayServer::Docker::Http
24
+ include Baykit::BayServer::Docker::Http::H1
25
+ include Baykit::BayServer::Docker::Http::H2
26
+
27
+ DEFAULT_SUPPORT_H2 = true
28
+
29
+ attr :support_h2
30
+
31
+ def initialize
32
+ super
33
+ @support_h2 = DEFAULT_SUPPORT_H2
34
+ end
35
+
36
+ ######################################################
37
+ # Implements Docker
38
+ ######################################################
39
+
40
+ def init(elm, parent)
41
+ super
42
+
43
+ if @support_h2
44
+ if @secure_docker != nil
45
+ @secure_docker.set_app_protocols(["h2", "http/1.1"])
46
+ end
47
+ H2ErrorCode.init()
48
+ end
49
+ end
50
+
51
+ ######################################################
52
+ # Implements DockerBase
53
+ ######################################################
54
+
55
+ def init_key_val(kv)
56
+ case kv.key.downcase
57
+ when "supporth2", "enableh2"
58
+ @support_h2 = StringUtil.parse_bool(kv.value)
59
+ else
60
+ return super
61
+ end
62
+ return true
63
+ end
64
+
65
+ ######################################################
66
+ # Implements Port
67
+ ######################################################
68
+
69
+ def protocol()
70
+ return H1_PROTO_NAME
71
+ end
72
+
73
+ ######################################################
74
+ # Implements PortBase
75
+ ######################################################
76
+ def support_anchored()
77
+ return true
78
+ end
79
+
80
+ def support_unanchored()
81
+ return false
82
+ end
83
+
84
+ ######################################################
85
+ # Class initializer
86
+ ######################################################
87
+ begin
88
+ PacketStore.register_protocol(
89
+ H1_PROTO_NAME,
90
+ H1PacketFactory.new())
91
+ PacketStore.register_protocol(
92
+ H2_PROTO_NAME,
93
+ H2PacketFactory.new())
94
+ ProtocolHandlerStore.register_protocol(
95
+ H1_PROTO_NAME,
96
+ true,
97
+ H1InboundHandler::InboundProtocolHandlerFactory.new())
98
+ ProtocolHandlerStore.register_protocol(
99
+ H2_PROTO_NAME,
100
+ true,
101
+ H2InboundHandler::InboundProtocolHandlerFactory.new())
102
+ end
103
+ end
104
+ end
105
+ end
106
+ end
107
+ end
@@ -0,0 +1,125 @@
1
+ require 'openssl'
2
+
3
+ require 'baykit/bayserver/agent/transporter/package'
4
+ require 'baykit/bayserver/docker/base/port_base'
5
+ require 'baykit/bayserver/protocol/packet_store'
6
+ require 'baykit/bayserver/docker/warp/package'
7
+ require 'baykit/bayserver/docker/http/h1/package'
8
+ require 'baykit/bayserver/docker/http/h2/package'
9
+
10
+
11
+ module Baykit
12
+ module BayServer
13
+ module Docker
14
+ module Http
15
+ class HtpWarpDocker < Baykit::BayServer::Docker::Warp::WarpDocker
16
+ include Baykit::BayServer::Docker::Http::HtpDocker # implements
17
+
18
+ include OpenSSL
19
+ include Baykit::BayServer::Agent::Transporter
20
+ include Baykit::BayServer::Protocol
21
+ include Baykit::BayServer::Docker::Http::H1
22
+ include Baykit::BayServer::Docker::Http::H2
23
+
24
+ attr :secure
25
+ attr :support_h2
26
+ attr :ssl_ctx
27
+ attr :trace_ssl
28
+
29
+ def initialize
30
+ super
31
+ @secure = false
32
+ @support_h2 = true
33
+ @ssl_ctx = nil
34
+ @trace_ssl = false
35
+ end
36
+
37
+ ######################################################
38
+ # Implements Docker
39
+ ######################################################
40
+
41
+ def init(elm, parent)
42
+ super
43
+
44
+ if @secure
45
+ begin
46
+ @ssl_ctx = SSL::SSLContext.new
47
+ rescue => e
48
+ BayLog.error_e(e)
49
+ raise ConfigException.new(elm.file_name, elm.line_no, BayMessage.get(:CFG_SSL_INIT_ERROR, e))
50
+ end
51
+ end
52
+
53
+ end
54
+
55
+ ######################################################
56
+ # Implements DockerBase
57
+ ######################################################
58
+
59
+ def init_key_val(kv)
60
+ case kv.key.downcase
61
+ when "supporth2"
62
+ @support_h2 = StringUtil.(kv.value)
63
+
64
+ when "tracessl"
65
+ @trace_ssl = StringUtil.parse_bool(kv.value)
66
+
67
+ when "secure"
68
+ @secure = StringUtil.parse_bool(kv.value)
69
+ else
70
+ return super
71
+ end
72
+
73
+ return true;
74
+ end
75
+
76
+ ######################################################
77
+ # Implements WarpDocker
78
+ ######################################################
79
+
80
+ def secure()
81
+ return @secure
82
+ end
83
+
84
+ ######################################################
85
+ # Implements WarpDockerBase
86
+ ######################################################
87
+
88
+ def protocol()
89
+ return H1_PROTO_NAME
90
+ end
91
+
92
+ def new_transporter(agt, skt)
93
+ if @secure
94
+ return SecureTransporter.new(@ssl_ctx, false, IOUtil.get_sock_recv_buf_size(skt), @trace_ssl)
95
+ else
96
+ return PlainTransporter.new(false, IOUtil.get_sock_recv_buf_size(skt))
97
+ end
98
+ end
99
+
100
+
101
+ ######################################################
102
+ # Class initializer
103
+ ######################################################
104
+ begin
105
+ PacketStore.register_protocol(
106
+ H1_PROTO_NAME,
107
+ H1PacketFactory.new())
108
+ PacketStore.register_protocol(
109
+ H2_PROTO_NAME,
110
+ H2PacketFactory.new())
111
+ ProtocolHandlerStore.register_protocol(
112
+ H1_PROTO_NAME,
113
+ false,
114
+ H1WarpHandler::WarpProtocolHandlerFactory.new())
115
+ ProtocolHandlerStore.register_protocol(
116
+ H2_PROTO_NAME,
117
+ false,
118
+ H2WarpHandler::WarpProtocolHandlerFactory.new())
119
+ end
120
+ end
121
+ end
122
+ end
123
+ end
124
+ end
125
+
@@ -0,0 +1,19 @@
1
+ module Baykit
2
+ module BayServer
3
+ module Docker
4
+ module Http
5
+ class HtpWarpShipHelper
6
+ # interface
7
+ #
8
+ # def reset()
9
+ # def send_req_headers(tur)
10
+ # def send_req_contents(tur, buf, start, len
11
+ # def end_req_contents(tur)
12
+ # def next_warp_id
13
+ #
14
+ end
15
+ end
16
+ end
17
+ end
18
+ end
19
+
@@ -0,0 +1,6 @@
1
+ require 'baykit/bayserver/docker/http/htp_ship'
2
+ require 'baykit/bayserver/docker/http/htp_port_docker'
3
+ require 'baykit/bayserver/docker/http/htp_warp_ship_helper'
4
+ require 'baykit/bayserver/docker/http/htp_warp_ship'
5
+ require 'baykit/bayserver/docker/http/htp_warp_docker'
6
+ require 'baykit/bayserver/docker/http/upgrade_exception'
metadata ADDED
@@ -0,0 +1,106 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: bayserver-docker-http
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/http/h1/command/cmd_content.rb
34
+ - lib/baykit/bayserver/docker/http/h1/command/cmd_end_content.rb
35
+ - lib/baykit/bayserver/docker/http/h1/command/cmd_header.rb
36
+ - lib/baykit/bayserver/docker/http/h1/command/package.rb
37
+ - lib/baykit/bayserver/docker/http/h1/h1_command.rb
38
+ - lib/baykit/bayserver/docker/http/h1/h1_command_handler.rb
39
+ - lib/baykit/bayserver/docker/http/h1/h1_command_unpacker.rb
40
+ - lib/baykit/bayserver/docker/http/h1/h1_inbound_handler.rb
41
+ - lib/baykit/bayserver/docker/http/h1/h1_packet.rb
42
+ - lib/baykit/bayserver/docker/http/h1/h1_packet_factory.rb
43
+ - lib/baykit/bayserver/docker/http/h1/h1_packet_unpacker.rb
44
+ - lib/baykit/bayserver/docker/http/h1/h1_protocol_handler.rb
45
+ - lib/baykit/bayserver/docker/http/h1/h1_type.rb
46
+ - lib/baykit/bayserver/docker/http/h1/h1_warp_handler.rb
47
+ - lib/baykit/bayserver/docker/http/h1/package.rb
48
+ - lib/baykit/bayserver/docker/http/h2/command/cmd_data.rb
49
+ - lib/baykit/bayserver/docker/http/h2/command/cmd_go_away.rb
50
+ - lib/baykit/bayserver/docker/http/h2/command/cmd_headers.rb
51
+ - lib/baykit/bayserver/docker/http/h2/command/cmd_ping.rb
52
+ - lib/baykit/bayserver/docker/http/h2/command/cmd_preface.rb
53
+ - lib/baykit/bayserver/docker/http/h2/command/cmd_priority.rb
54
+ - lib/baykit/bayserver/docker/http/h2/command/cmd_rst_stream.rb
55
+ - lib/baykit/bayserver/docker/http/h2/command/cmd_settings.rb
56
+ - lib/baykit/bayserver/docker/http/h2/command/cmd_window_update.rb
57
+ - lib/baykit/bayserver/docker/http/h2/command/package.rb
58
+ - lib/baykit/bayserver/docker/http/h2/h2_command.rb
59
+ - lib/baykit/bayserver/docker/http/h2/h2_command_handler.rb
60
+ - lib/baykit/bayserver/docker/http/h2/h2_command_unpacker.rb
61
+ - lib/baykit/bayserver/docker/http/h2/h2_error_code.rb
62
+ - lib/baykit/bayserver/docker/http/h2/h2_flags.rb
63
+ - lib/baykit/bayserver/docker/http/h2/h2_inbound_handler.rb
64
+ - lib/baykit/bayserver/docker/http/h2/h2_packet.rb
65
+ - lib/baykit/bayserver/docker/http/h2/h2_packet_factory.rb
66
+ - lib/baykit/bayserver/docker/http/h2/h2_packet_unpacker.rb
67
+ - lib/baykit/bayserver/docker/http/h2/h2_protocol_handler.rb
68
+ - lib/baykit/bayserver/docker/http/h2/h2_settings.rb
69
+ - lib/baykit/bayserver/docker/http/h2/h2_type.rb
70
+ - lib/baykit/bayserver/docker/http/h2/h2_warp_handler.rb
71
+ - lib/baykit/bayserver/docker/http/h2/header_block.rb
72
+ - lib/baykit/bayserver/docker/http/h2/header_block_analyzer.rb
73
+ - lib/baykit/bayserver/docker/http/h2/header_block_builder.rb
74
+ - lib/baykit/bayserver/docker/http/h2/header_table.rb
75
+ - lib/baykit/bayserver/docker/http/h2/huffman/hnode.rb
76
+ - lib/baykit/bayserver/docker/http/h2/huffman/htree.rb
77
+ - lib/baykit/bayserver/docker/http/h2/package.rb
78
+ - lib/baykit/bayserver/docker/http/htp_docker.rb
79
+ - lib/baykit/bayserver/docker/http/htp_port_docker.rb
80
+ - lib/baykit/bayserver/docker/http/htp_warp_docker.rb
81
+ - lib/baykit/bayserver/docker/http/htp_warp_ship_helper.rb
82
+ - lib/baykit/bayserver/docker/http/package.rb
83
+ homepage: https://baykit.yokohama
84
+ licenses:
85
+ - MIT
86
+ metadata: {}
87
+ post_install_message:
88
+ rdoc_options: []
89
+ require_paths:
90
+ - lib
91
+ required_ruby_version: !ruby/object:Gem::Requirement
92
+ requirements:
93
+ - - ">="
94
+ - !ruby/object:Gem::Version
95
+ version: '0'
96
+ required_rubygems_version: !ruby/object:Gem::Requirement
97
+ requirements:
98
+ - - ">="
99
+ - !ruby/object:Gem::Version
100
+ version: '0'
101
+ requirements: []
102
+ rubygems_version: 3.1.6
103
+ signing_key:
104
+ specification_version: 4
105
+ summary: AJP docker of BayServer
106
+ test_files: []