agoo 2.8.3 → 2.8.4

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of agoo might be problematic. Click here for more details.

checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 22bc32c1d37458aeb10fd5c92f9bbc6f29821eeb42ca53398eccf75da6b584cb
4
- data.tar.gz: e2ee1b75f02b87221ea27074dfe6e2dc009fdd316757e5bbf420d7b5389ae1b5
3
+ metadata.gz: 4a08f7cfbaf708e9ae15b2c14c67b7ad06279ffefc55d3f8cdf02bf79d23ec2a
4
+ data.tar.gz: cdad36a0a5599a9114509b6eff0e219b2f128851f3d95bee344140cfa9f74ba0
5
5
  SHA512:
6
- metadata.gz: 40a3f34e490c9f401e7abdb51c9a75f30c111e58b5cae79793887fa328586554c38c69a542e1258076d50ed53e7557090bbe688b0e5cea3cbaaea0576daf3b93
7
- data.tar.gz: 254adaa0c7d04151be7d950421c911ec9f603f47db11cf875aa028e37754fc56e82c8ca0649de5f06f2d07ace3162adc9409a8345a8108d7e9627df0c6655331
6
+ metadata.gz: 923b3465e9b1c30e20bf627c2ef6b300574a9e475b9bef28d754845ccc5bf407fec7c48b68553189b55a26ee98a55671f9e2a571b7ba86ff2831c1fe16fb2cc5
7
+ data.tar.gz: 7b401ec9acc4373d18815266d312b3b30bbd2ab7d523b8be003f3a680ea57bbe4c791c6ab63bf77d2401ee01ac37a596aa785b06b26261547f38c0fe5bf4f248
@@ -1,256 +1,293 @@
1
- # CHANGELOG
1
+ # Changelog
2
2
 
3
- ### 2.8.3 - 2019-04-04
3
+ All changes to the Agoo gem are documented here. Releases follow semantic versioning.
4
+
5
+ ## [Unreleased]
6
+
7
+ ## [2.8.4] - 2019-06-14
8
+
9
+ GraphQL with Rack
10
+
11
+ ### Fixed
12
+ - Fixed an issue with using GraphQL with Rack. Added a Rack GraphQL example in
13
+ example/graphql/config.ru.
14
+
15
+ ## [2.8.3] - 2019-04-04
4
16
 
5
17
  Description parsing fix.
6
18
 
19
+ ### Fixed
7
20
  - Fixed a description parse bug that would fail to ignore whitespace after a description on some quoted descriptions.
8
21
 
9
- ### 2.8.2 - 2019-03-08
22
+ ## [2.8.2] - 2019-03-08
10
23
 
11
24
  Rack compatibility improvement.
12
25
 
13
- - Add miss `close` method to `Agoo::ErrorStream`.
14
-
26
+ ### Added
15
27
  - Rack builder wrapper added.
16
28
 
17
- ### 2.8.1 - 2019-03-01
29
+ ### Fixed
30
+ - Add miss `close` method to `Agoo::ErrorStream`.
31
+
32
+ ## [2.8.1] - 2019-03-01
18
33
 
19
34
  Add missing options.
20
35
 
36
+ ### Added
21
37
  - Add missing options to `bin/agoo`.
22
-
23
38
  - Add missing options to `rack::Handler::Agoo`.
24
-
25
39
  - `bin/agoo` now picks up `config.ru` or `config.rb` if no other files are specified.
26
40
 
27
- ### 2.8.0 - 2019-02-19
41
+ ## [2.8.0] - 2019-02-19
28
42
 
29
43
  Extend GraphQL
30
44
 
45
+ ### Added
31
46
  - Add support for the Graphql `extend` functionality.
32
-
33
47
  - Add the ID base scalar type.
34
48
 
49
+ ### Fixed
35
50
  - Use `schema` SDL element instead of `type schema`.
36
51
 
37
- ### 2.7.0 - 2019-01-29
52
+ ## [2.7.0] - 2019-01-29
38
53
 
39
54
  Static asset header rules functionality added.
40
55
 
56
+ ### Added
41
57
  - `Agoo::Server.header_rule()` added.
42
58
 
59
+ ### Fixed
43
60
  - Assorted code cleanup.
44
61
 
45
- ### 2.6.1 - 2019-01-20
62
+ ## [2.6.1] - 2019-01-20
46
63
 
47
64
  Ruby 2.6.0 compatibility release.
48
65
 
66
+ ### Added
49
67
  - Registering the GraphQL root object fixed for 2.6.0.
50
68
 
51
- ### 2.6.0 - 2019-01-20
69
+ ## [2.6.0] - 2019-01-20
52
70
 
53
71
  GraphQL supported with a simple, easy to use API. Existing API remain the same but a new Agoo::GraphQL module has been added along with supporting examples.
54
72
 
73
+ ### Fixed
55
74
  - Replaced the use of `gmtime` with an included function to assure support for dates before 1970.
56
75
 
57
- ### 2.5.7 - 2018-12-03
76
+ ## [2.5.7] - 2018-12-03
58
77
 
59
78
  Bad release fix along with upload example.
60
79
 
80
+ ### Fixed
61
81
  - Additional return value checking on `strdup`, `strndup`, and `fstat`.
62
-
63
82
  - Fix double free when a connection times out.
64
83
 
65
- ### 2.5.6 - 2018-11-26
84
+ ## [2.5.6] - 2018-11-26
66
85
 
67
86
  Even more cleanup and minor performance tweak.
68
87
 
69
- - Changed the use of __ and _X in C code.
88
+ ### Added
89
+ - Compile option to use epoll instead of poll. (its slower)
70
90
 
91
+ ### Fixed
92
+ - Changed the use of __ and _X in C code.
71
93
  - Resuse of some memory for responses.
72
94
 
73
- - Compile option to use epoll instead of poll. (its slower)
74
-
75
- ### 2.5.5 - 2018-11-12
95
+ ## [2.5.5] - 2018-11-12
76
96
 
77
97
  More optimizations and some cleanup.
78
98
 
99
+ ### Added
79
100
  - New optional hint to the server that allows responses to `#call` to be cached.
80
101
 
102
+ ### Fixed
81
103
  - Change C header file guards. No change in behavior. Just code cleanup.
82
-
83
104
  - Fixed change that slowed down the server.
84
105
 
85
- ### 2.5.4 - 2018-11-10
106
+ ## [2.5.4] - 2018-11-10
86
107
 
87
108
  Third times a charm.
88
109
 
110
+ ### Fixed
89
111
  - Make sure response are sent when the request includes a close indicator.
90
112
 
91
- ### 2.5.3 - 2018-11-10
113
+ ## [2.5.3] - 2018-11-10
92
114
 
93
115
  Bug fix.
94
116
 
117
+ ### Fixed
95
118
  - The latest changes introduced a bug where requests were lost. Fixed in this release.
96
119
 
97
- ### 2.5.2 - 2018-11-09
120
+ ## [2.5.2] - 2018-11-09
98
121
 
99
122
  Latency improvements.
100
123
 
124
+ ### Changed
101
125
  - Allow empty pages to be returned.
102
-
103
126
  - Included multiple read/write threads.
104
127
 
105
- ### 2.5.1 - 2018-08-30
128
+ ## [2.5.1] - 2018-08-30
106
129
 
107
130
  Bug fix.
108
131
 
132
+ ### Fixed
109
133
  - Sending a POST request that was not handled and caused a segfault. Fixed.
110
134
 
111
- ### 2.5.0 - 2018-08-10
135
+ ## [2.5.0] - 2018-08-10
112
136
 
113
137
  The binding release with multiple options for connecting to the server.
114
138
 
139
+ ### Added
115
140
  - Multiple connection bindings now supported
116
-
117
141
  - Binding to Unix named sockets support added.
118
-
119
142
  - IPv6 now supported.
120
-
121
143
  - Connection address now supported to restrict connection requests.
122
144
 
123
- ### 2.4.0 - 2018-07-04
145
+ ## [2.4.0] - 2018-07-04
124
146
 
147
+ ### Added
125
148
  - Rack hijack now supported.
126
-
127
149
  - Upgraded handler `on_error` now supported and called on Websocket or SSE errors.
128
150
 
129
- ### 2.3.0 - 2018-06-29
151
+ ## [2.3.0] - 2018-06-29
130
152
 
153
+ ### Added
131
154
  - Added an `env` method to the upgrade (Websocket and SSE) client.
132
155
 
156
+ ### Fixed
133
157
  - Fixed Websocket bug where a pong caused a hang on the socket.
134
158
 
135
- ### 2.2.2 - 2018-06-05
136
-
137
- - Fixed `bin/agoo` which had become out of date.
159
+ ## [2.2.2] - 2018-06-05
138
160
 
161
+ ### Added
139
162
  - Added optimization description in `misc/optimize.md`.
140
163
 
164
+ ### Fixed
165
+ - Fixed `bin/agoo` which had become out of date.
141
166
  - Fixed static file asset page caching bug.
142
167
 
143
- ### 2.2.1 - 2018-05-31
168
+ ## [2.2.1] - 2018-05-31
144
169
 
170
+ ### Fixed
145
171
  - Corrected header bug where a `:` in the value would cause an incorrect header key and value.
146
-
147
172
  - Improved idle CPU use.
148
173
 
149
- ### 2.2.0 - 2018-05-30
174
+ ## [2.2.0] - 2018-05-30
150
175
 
176
+ ### Added
151
177
  - Clustering now supported with forked workers making Agoo even faster.
152
-
153
178
  - Changed addition header keys to be all uppercase and also replace `-` with `_` to match Rack unit tests instead of the spec.
154
179
 
155
- ### 2.1.3 - 2018-05-16
180
+ ## [2.1.3] - 2018-05-16
156
181
 
182
+ ### Added
157
183
  - Optimized `rackup` to look for files in the root directory before calling rackup as the default. The root is now set to `./public` instead of `.`. The `:rmux` (rack multiplex) turns that off.
158
184
 
159
- ### 2.1.2 - 2018-05-15
185
+ ## [2.1.2] - 2018-05-15
160
186
 
187
+ ### Added
161
188
  - Added `#open?` method to the Upgraded (connection client) class.
162
-
163
189
  - Slight improvement performcance serving static assets for Rails.
164
190
 
165
- ### 2.1.1 - 2018-05-11
191
+ ## [2.1.1] - 2018-05-11
166
192
 
193
+ ### Added
167
194
  - Subject can now be Symbols or any other object that responds top `#to_s`.
168
-
169
- - Fixed bug where publishes from the `#on_open` callback broke the connection.
170
-
171
195
  - Super fast asset loading for Rails and Rack using `Agoo::Server.path_group`
172
196
 
173
- ### 2.1.0 - 2018-05-10
197
+ ### Fixed
198
+ - Fixed bug where publishes from the `#on_open` callback broke the connection.
174
199
 
175
- - This is a minor release even though the API has changed. The changed API is the one for Rack based WebSocket and SSE connection upgrades. The PR for the spec addition is currently stalled but some suggestions for a stateless API are implemented in this release. The proposed Rack SPEC is [here](misc/SPEC). The PR is [here](https://github.com/rack/rack/pull/1272)
200
+ ## [2.1.0] - 2018-05-10
176
201
 
202
+ ### Added
177
203
  - Publish and subscribe to WebSocket and SSE connections now available. An example in the push subdirectory demonstrates how it works.
178
-
179
204
  - Slight performance boost.
180
205
 
181
- ### 2.0.5 - 2018-05-06
206
+ ### Changed
207
+ - This is a minor release even though the API has changed. The changed API is the one for Rack based WebSocket and SSE connection upgrades. The PR for the spec addition is currently stalled but some suggestions for a stateless API are implemented in this release. The proposed Rack SPEC is [here](misc/SPEC). The PR is [here](https://github.com/rack/rack/pull/1272)
182
208
 
183
- - Changed to putting all the path on the `REQUEST_PATH` variable instead of the `SCRIPT_NAME` to accomodate Rails which only uses the `REQUEST_PATH`.
209
+ ## [2.0.5] - 2018-05-06
184
210
 
211
+ ### Changed
212
+ - Changed to putting all the path on the `REQUEST_PATH` variable instead of the `SCRIPT_NAME` to accomodate Rails which only uses the `REQUEST_PATH`.
185
213
  - Duplicated all `HTTP_` variables to use an all upper case key in addition to the Rack spec simple concatenation to make Rails middleware work. There seems to be an undocumented agreement that all keys will be uppercase.
186
214
 
187
- ### 2.0.4 - 2018-05-06
215
+ ## [2.0.4] - 2018-05-06
188
216
 
217
+ ### Fixed
189
218
  - Fix allocation bug.
190
219
 
191
- ### 2.0.3 - 2018-05-05
220
+ ## [2.0.3] - 2018-05-05
192
221
 
222
+ ### Added
193
223
  - Allow X-XSS-Protection and only check headers in pendantic mode.
194
224
 
195
- ### 2.0.2 - 2018-05-04
225
+ ## [2.0.2] - 2018-05-04
196
226
 
227
+ ### Fixed
197
228
  - Fixed compiler issues for different OSs and compilers.
198
-
199
229
  - More tolerant of `SERVER_NAME` capture from HTTP headers.
200
230
 
201
- ### 2.0.1 - 2018-05-01
231
+ ## [2.0.1] - 2018-05-01
202
232
 
233
+ ### Fixed
203
234
  - Allow compilation on older macOS compilers.
204
235
 
205
- ### 2.0.0 - 2018-04-30
236
+ ## [2.0.0] - 2018-04-30
206
237
 
238
+ ### Added
207
239
  - WebSocket and SSE support added.
208
-
209
240
  - The API moved to a global server approach to support extended
210
241
  handlers for WebSocket and SSE connections.
211
242
 
212
- ### 1.2.2 - 2018-03-26
243
+ ## [1.2.2] - 2018-03-26
213
244
 
245
+ ### Added
214
246
  - rackup option -s now works with 'agoo' as well as with 'Agoo'.
215
247
 
248
+ ### Fixed
216
249
  - Fixed a memory leak.
217
250
 
218
- ### 1.2.1 - 2018-03-16
251
+ ## [1.2.1] - 2018-03-16
219
252
 
253
+ ### Fixed
220
254
  - Improved Rack handling. Rack version is an array as it was
221
255
  supposed to be. Hacked around Rack's handling of HEAD requests so
222
256
  that the content length can be returned more easily by the app.
223
257
 
224
- ### 1.2.0 - 2018-03-01
258
+ ## [1.2.0] - 2018-03-01
225
259
 
260
+ ### Added
226
261
  - Added Rack::Handler::Agoo for a rackup like use of Agoo.
227
-
228
262
  - Examples provided.
229
-
230
263
  - Default thread count set to zero.
231
264
 
232
- ### 1.1.2 - 2018-02-25
265
+ ## [1.1.2] - 2018-02-25
233
266
 
267
+ ### Fixed
234
268
  - Fixed pipelining to handle extreme rates.
235
269
 
236
- ### 1.1.1 - 2018-02-23
270
+ ## [1.1.1] - 2018-02-23
237
271
 
272
+ ### Added
238
273
  - An `agoo` binary was added to run an Agoo server from the command line.
239
274
 
240
- ### 1.1.0 - 2018-02-11
275
+ ## [1.1.0] - 2018-02-11
241
276
 
277
+ ### Added
242
278
  - New mime types can now be added
243
279
  - Added support for rack.logger
244
280
 
245
- ### 1.0.0 - 2018-02-06
281
+ ## [1.0.0] - 2018-02-06
246
282
 
283
+ ### Added
247
284
  - Add not found handler support.
248
285
  - Fixed segfault due to GC of handlers.
249
286
 
250
- ### 0.9.1 - 2018-01-28
287
+ ## [0.9.1] - 2018-01-28
251
288
 
252
289
  Updated to get travis working correctly.
253
290
 
254
- ### 0.9.0 - 2018-01-28
291
+ ## [0.9.0] - 2018-01-28
255
292
 
256
293
  Initial release.
@@ -7,15 +7,17 @@
7
7
  #include "dtime.h"
8
8
 
9
9
  #define MIN_SLEEP (1.0 / (double)CLOCKS_PER_SEC)
10
+ #ifndef CLOCK_REALTIME_COURSE
11
+ #define CLOCK_REALTIME_COURSE CLOCK_REALTIME
12
+ #endif
10
13
 
11
14
  double
12
15
  dtime() {
13
- struct timeval tv;
14
- struct timezone tz;
16
+ struct timespec ts;
15
17
 
16
- gettimeofday(&tv, &tz);
18
+ clock_gettime(CLOCK_REALTIME_COURSE, &ts);
17
19
 
18
- return (double)tv.tv_sec + (double)tv.tv_usec / 1000000.0;
20
+ return (double)ts.tv_sec + (double)ts.tv_nsec / 1000000000.0;
19
21
  }
20
22
 
21
23
  double
@@ -36,7 +38,7 @@ dsleep(double t) {
36
38
  double
37
39
  dwait(double t) {
38
40
  double end = dtime() + t;
39
-
41
+
40
42
  if (MIN_SLEEP < t) {
41
43
  struct timespec req, rem;
42
44
 
@@ -369,8 +369,8 @@ gql_intro_init(agooErr err) {
369
369
 
370
370
  static struct _gqlCclass type_class;
371
371
 
372
- static gqlValue
373
- extract_arg(agooErr err, gqlField field, gqlSel sel, const char *key) {
372
+ gqlValue
373
+ gql_extract_arg(agooErr err, gqlField field, gqlSel sel, const char *key) {
374
374
  if (NULL != sel->args) {
375
375
  gqlSelArg sa;
376
376
  gqlValue v = NULL;
@@ -892,7 +892,7 @@ type_fields(agooErr err, gqlDoc doc, gqlCobj obj, gqlField field, gqlSel sel, gq
892
892
  struct _gqlField cf;
893
893
  struct _gqlCobj child = { .clas = &field_class };
894
894
  int d2 = depth + 1;
895
- gqlValue a = extract_arg(err, field, sel, "includeDeprecated");
895
+ gqlValue a = gql_extract_arg(err, field, sel, "includeDeprecated");
896
896
  bool inc_dep = false;
897
897
 
898
898
  if (GQL_OBJECT != type->kind && GQL_SCHEMA != type->kind && GQL_INTERFACE != type->kind) {
@@ -1086,7 +1086,7 @@ type_enum_values(agooErr err, gqlDoc doc, gqlCobj obj, gqlField field, gqlSel se
1086
1086
  struct _gqlField cf;
1087
1087
  struct _gqlCobj child = { .clas = &enum_value_class };
1088
1088
  int d2 = depth + 1;
1089
- gqlValue a = extract_arg(err, field, sel, "includeDeprecated");
1089
+ gqlValue a = gql_extract_arg(err, field, sel, "includeDeprecated");
1090
1090
  bool inc_dep = false;
1091
1091
 
1092
1092
  if (GQL_ENUM != type->kind) {
@@ -1376,7 +1376,7 @@ root_schema(agooErr err, gqlDoc doc, gqlCobj obj, gqlField field, gqlSel sel, gq
1376
1376
 
1377
1377
  static int
1378
1378
  root_type(agooErr err, gqlDoc doc, gqlCobj obj, gqlField field, gqlSel sel, gqlValue result, int depth) {
1379
- gqlValue na = extract_arg(err, field, sel, "name");
1379
+ gqlValue na = gql_extract_arg(err, field, sel, "name");
1380
1380
  const char *name = NULL;
1381
1381
  const char *key = sel->name;
1382
1382
  int d2 = depth + 1;
@@ -11,8 +11,9 @@ struct _gqlSel;
11
11
  struct _gqlType;
12
12
  struct _gqlValue;
13
13
 
14
- extern int gql_intro_init(agooErr err);
14
+ extern int gql_intro_init(agooErr err);
15
15
 
16
- extern int gql_intro_eval(agooErr err, struct _gqlDoc *doc, struct _gqlSel *sel, struct _gqlValue *result, int depth);
16
+ extern int gql_intro_eval(agooErr err, struct _gqlDoc *doc, struct _gqlSel *sel, struct _gqlValue *result, int depth);
17
+ extern struct _gqlValue* gql_extract_arg(agooErr err, struct _gqlField *field, struct _gqlSel *sel, const char *key);
17
18
 
18
19
  #endif // AGOO_GQLINTRO_H
@@ -24,7 +24,7 @@
24
24
  // head and tail both increment and wrap.
25
25
  // tail points to next open space.
26
26
  // When head == tail the queue is full. This happens when tail catches up with head.
27
- //
27
+ //
28
28
 
29
29
  int
30
30
  agoo_queue_init(agooErr err, agooQueue q, size_t qsize) {
@@ -109,7 +109,7 @@ agoo_queue_pop(agooQueue q, double timeout) {
109
109
  agooQItem item;
110
110
  agooQItem *next;
111
111
  int cnt;
112
-
112
+
113
113
  if (q->multi_pop) {
114
114
  while (atomic_flag_test_and_set(&q->pop_lock)) {
115
115
  dsleep(RETRY_SECS);
@@ -183,7 +183,7 @@ agoo_queue_listen(agooQueue q) {
183
183
  }
184
184
  }
185
185
  atomic_store(&q->wait_state, WAITING);
186
-
186
+
187
187
  return q->rsock;
188
188
  }
189
189
 
@@ -200,7 +200,6 @@ agoo_queue_release(agooQueue q) {
200
200
  int
201
201
  agoo_queue_count(agooQueue q) {
202
202
  int size = (int)(q->end - q->q);
203
-
203
+
204
204
  return ((agooQItem*)atomic_load(&q->tail) - (agooQItem*)atomic_load(&q->head) + size) % size;
205
205
  }
206
-
@@ -88,6 +88,9 @@ protect_eval(void *x) {
88
88
  return NULL;
89
89
  }
90
90
 
91
+ // Hidden ruby function.
92
+ extern int ruby_thread_has_gvl_p();
93
+
91
94
  static gqlValue
92
95
  eval_wrap(agooErr err, gqlDoc doc) {
93
96
  struct _eval eval = {
@@ -95,9 +98,11 @@ eval_wrap(agooErr err, gqlDoc doc) {
95
98
  .err = err,
96
99
  .value = NULL,
97
100
  };
98
-
99
- rb_thread_call_with_gvl(protect_eval, &eval);
100
-
101
+ if (ruby_thread_has_gvl_p()) {
102
+ protect_eval(&eval);
103
+ } else {
104
+ rb_thread_call_with_gvl(protect_eval, &eval);
105
+ }
101
106
  return eval.value;
102
107
  }
103
108
 
@@ -1,5 +1,5 @@
1
1
 
2
2
  module Agoo
3
3
  # Agoo version.
4
- VERSION = '2.8.3'
4
+ VERSION = '2.8.4'
5
5
  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.8.3
4
+ version: 2.8.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Peter Ohler
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-04-04 00:00:00.000000000 Z
11
+ date: 2019-06-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: oj
@@ -177,10 +177,10 @@ signing_key:
177
177
  specification_version: 4
178
178
  summary: An HTTP server
179
179
  test_files:
180
+ - test/base_handler_test.rb
181
+ - test/bind_test.rb
180
182
  - test/graphql_test.rb
181
183
  - test/hijack_test.rb
182
- - test/rack_handler_test.rb
183
- - test/base_handler_test.rb
184
184
  - test/log_test.rb
185
- - test/bind_test.rb
185
+ - test/rack_handler_test.rb
186
186
  - test/static_test.rb