agoo 2.15.6 → 2.15.8
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/CHANGELOG.md +18 -0
- data/bin/agoo +47 -39
- data/ext/agoo/bind.c +209 -198
- data/ext/agoo/rgraphql.c +7 -4
- data/ext/agoo/rserver.c +689 -688
- data/ext/agoo/sdl.c +13 -2
- data/ext/agoo/server.c +255 -253
- data/lib/agoo/version.rb +1 -1
- data/lib/rack/handler/agoo.rb +130 -128
- metadata +3 -3
data/lib/agoo/version.rb
CHANGED
data/lib/rack/handler/agoo.rb
CHANGED
@@ -13,161 +13,163 @@ module Rack
|
|
13
13
|
# Run the server. Options are the same as for Agoo::Server plus a :port,
|
14
14
|
# :root, :rmux, and :wc option.
|
15
15
|
def self.run(handler, options={})
|
16
|
-
|
17
|
-
|
16
|
+
port = 0
|
17
|
+
root = './public'
|
18
18
|
root_set = false
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
19
|
+
worker_count = 1;
|
20
|
+
default_handler = nil
|
21
|
+
not_found_handler = nil
|
22
|
+
path_map = {}
|
23
|
+
verbose = 1
|
24
|
+
log_dir = nil
|
25
|
+
classic = true
|
26
|
+
console = true
|
27
|
+
colorize = true
|
28
|
+
binds = nil
|
29
|
+
graphql = nil
|
30
30
|
options[:root_first] = true # the default for rack
|
31
31
|
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
32
|
+
default_handler = handler unless handler.nil?
|
33
|
+
options.each { |k,v|
|
34
|
+
if :port == k || :p == k
|
35
|
+
port = v.to_i
|
36
|
+
options.delete(k)
|
37
|
+
elsif :root == k || :dir == k || :d == k
|
38
|
+
root = v
|
39
39
|
root_set = true
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
40
|
+
options.delete(k)
|
41
|
+
elsif :wc == k || :workers == k
|
42
|
+
worker_count = v.to_i
|
43
|
+
options.delete(k)
|
44
|
+
elsif :rmux == k || :root_first == k || :f == k
|
45
45
|
options[:root_first] = false
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
46
|
+
elsif k.nil?
|
47
|
+
not_found_handler = v
|
48
|
+
options.delete(k)
|
49
|
+
elsif :graphql == k || :g == k
|
50
|
+
graphql = v
|
51
|
+
options.delete(k)
|
52
|
+
elsif :s == k || :silent == k
|
53
|
+
verbose = 0
|
54
|
+
options.delete(k)
|
55
|
+
elsif :v == k || :verbose == k
|
56
|
+
verbose = 2
|
57
|
+
options.delete(k)
|
58
|
+
elsif :debug == k
|
59
|
+
verbose = 3
|
60
|
+
options.delete(k)
|
61
|
+
elsif :b == k || :bind == k
|
62
|
+
if v.is_a?(String)
|
63
|
+
binds = v.split(',')
|
64
|
+
else
|
65
|
+
binds = v
|
66
|
+
end
|
67
|
+
options.delete(k)
|
68
|
+
elsif :log_dir == k
|
69
|
+
log_dir = v
|
70
|
+
options.delete(k)
|
71
|
+
elsif :log_classic == k
|
72
|
+
classic = true
|
73
|
+
options.delete(k)
|
74
|
+
elsif :no_log_classic == k
|
75
|
+
classic = false
|
76
|
+
options.delete(k)
|
77
|
+
elsif :log_console == k
|
78
|
+
console = true
|
79
|
+
options.delete(k)
|
80
|
+
elsif :no_log_console == k
|
81
|
+
console = false
|
82
|
+
options.delete(k)
|
83
|
+
elsif :log_colorize == k
|
84
|
+
colorize = true
|
85
|
+
options.delete(k)
|
86
|
+
elsif :no_log_colorize == k
|
87
|
+
colorize = false
|
88
|
+
options.delete(k)
|
89
|
+
elsif :help == k || :h == k
|
90
|
+
puts %|
|
91
91
|
Agoo is a Ruby web server that supports Rack. The follwing options are available
|
92
92
|
using the -O NAME[=VALUE] option of rackup. Note that if binds are provided the
|
93
93
|
-p PORT option will be ignored but -Op=PORT can be used.
|
94
94
|
|
95
|
-
-O h, help
|
96
|
-
-O s, silent
|
97
|
-
-O v, verbose
|
98
|
-
-O debug
|
99
|
-
-O f, rmux, root_first
|
100
|
-
-O p, port=PORT
|
101
|
-
-O b, bind=URL
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
-O d, dir, root=DIR
|
108
|
-
-O g, graphql=PATH
|
109
|
-
-O t, threads=COUNT
|
110
|
-
-O w, workers=COUNT
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
95
|
+
-O h, help Show this display.
|
96
|
+
-O s, silent Silent.
|
97
|
+
-O v, verbose Verbose.
|
98
|
+
-O debug Very verbose.
|
99
|
+
-O f, rmux, root_first Check the root directory before the handle paths.
|
100
|
+
-O p, port=PORT Port to listen on.
|
101
|
+
-O b, bind=URL URLs to receive connections on, comma separated.
|
102
|
+
Examples:
|
103
|
+
"http ://127.0.0.1:6464"
|
104
|
+
"unix:///tmp/agoo.socket"
|
105
|
+
"http ://[::1]:6464
|
106
|
+
"http ://:6464"
|
107
|
+
-O d, dir, root=DIR Directory to serve static assets from.
|
108
|
+
-O g, graphql=PATH URL path for GraphQL requests.
|
109
|
+
-O t, threads=COUNT Number of threads to use.
|
110
|
+
-O w, workers=COUNT Number of workers to use.
|
111
|
+
-O log_dir=DIR Log file directory.
|
112
|
+
-O ssl_cert=FILE SSL certificate file.
|
113
|
+
-O ssl_key=FILE SSL key file.
|
114
|
+
-O [no_]log_classic Classic log entries instead of JSON.
|
115
|
+
-O [no_]log_console Display log entries on the console.
|
116
|
+
-O [no_]log_colorize Display log entries in color.
|
115
117
|
-O /path=MyHandler path and class name to handle requests on that path
|
116
118
|
|
117
119
|
|
|
118
|
-
|
119
|
-
|
120
|
+
exit(true)
|
121
|
+
else
|
120
122
|
k = k.to_s
|
121
123
|
if k.start_with?('/')
|
122
124
|
path_map[k] = v
|
123
125
|
options.delete(k)
|
124
126
|
end
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
127
|
+
end
|
128
|
+
}
|
129
|
+
options[:thread_count] = 0
|
130
|
+
options[:worker_count] = worker_count
|
131
|
+
if binds.nil?
|
132
|
+
options[:Port] = port unless port == 0
|
133
|
+
else
|
134
|
+
options[:bind] = binds
|
135
|
+
options[:Port] = port
|
136
|
+
end
|
137
|
+
options[:graphql] = graphql unless graphql.nil?
|
136
138
|
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
139
|
+
::Agoo::Log.configure(dir: log_dir,
|
140
|
+
console: console,
|
141
|
+
classic: classic,
|
142
|
+
colorize: colorize,
|
143
|
+
states: {
|
144
|
+
INFO: 1 <= verbose,
|
145
|
+
DEBUG: 3 <= verbose,
|
146
|
+
connect: 2 <= verbose,
|
147
|
+
request: 2 <= verbose,
|
148
|
+
response: 2 <= verbose,
|
149
|
+
eval: 2 <= verbose,
|
150
|
+
push: 2 <= verbose,
|
151
|
+
})
|
152
|
+
::Agoo::Server.init(port, root, options)
|
153
|
+
path_map.each { |path,h|
|
154
|
+
::Agoo::Server.handle(nil, path, h)
|
155
|
+
}
|
154
156
|
begin
|
155
157
|
# If Rails is loaded this should work else just ignore.
|
156
|
-
|
158
|
+
if const_defined?(:Rails)
|
157
159
|
::Agoo::Server.path_group('/assets', ::Rails.configuration.assets.paths)
|
158
160
|
root = Rails.public_path unless root_set
|
159
|
-
|
161
|
+
end
|
160
162
|
rescue Exception
|
161
163
|
end
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
164
|
+
unless default_handler.nil?
|
165
|
+
::Agoo::Server.handle(nil, '**', default_handler)
|
166
|
+
end
|
167
|
+
::Agoo::Server.handle_not_found(not_found_handler) unless not_found_handler.nil?
|
168
|
+
::Agoo::Server.start
|
167
169
|
end
|
168
170
|
|
169
171
|
def self.shutdown
|
170
|
-
|
172
|
+
::Agoo::shutdown
|
171
173
|
end
|
172
174
|
|
173
175
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: agoo
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.15.
|
4
|
+
version: 2.15.8
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Peter Ohler
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-
|
11
|
+
date: 2023-10-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: oj
|
@@ -190,7 +190,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
190
190
|
version: '0'
|
191
191
|
requirements:
|
192
192
|
- Linux or macOS
|
193
|
-
rubygems_version: 3.4.
|
193
|
+
rubygems_version: 3.4.10
|
194
194
|
signing_key:
|
195
195
|
specification_version: 4
|
196
196
|
summary: An HTTP server
|