agoo 2.11.1 → 2.11.2

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: 3b7919a52d201024eefc3480e4f64e28587b124b402d41dfd4cf9cc2108a01a6
4
- data.tar.gz: a7d185258d848b7887b50dccac072eed8660817a099a210d279d52812ade3263
3
+ metadata.gz: df1bb00da0c9e4622be8beab3f1f6e1e72944ebd499c59be4708a406497398e5
4
+ data.tar.gz: 919371ceccd840f0bd281ae010f1478764e76ca4660d1160b3b1c324e5f862f9
5
5
  SHA512:
6
- metadata.gz: 434a205f05f234cb2eec6212e33947cecbc8773c47c6c77e0e0c17aab87d22b6406cdfd3750fbb9388f1ca5972cb883a95b7b3c3565c5a50b09cb4cd6a314079
7
- data.tar.gz: 9decdf78bb95013eaedd1b9ee594f7206fdaca20b1e9c9944fc87bbd61a4fcb376fa357d2b3c83f0c1d3f9eb38e7bd6661e58d7a790d2f8b7d57ad3cd566e2ca
6
+ metadata.gz: 6a964aaf5a16e046f245d4da7e13852e5b996628fcd293343ce8ac57bbf8ca38b658282681e7c8e38b33c19546516adf5e3c148a5a9000b942de90438742f752
7
+ data.tar.gz: b5334140835783165e52f716217079739ab1460e7bda78e3f0dd0925b86885583b9143222befde5d206543838b7cc8a1127e6a4915c1a04df08821b7b80a4def
@@ -4,6 +4,17 @@ All changes to the Agoo gem are documented here. Releases follow semantic versio
4
4
 
5
5
  ## [Unreleased]
6
6
 
7
+ ## [2.11.2] - [2019-10-20]
8
+
9
+ Coerce improvements
10
+
11
+ ### Fixed
12
+ - Coerce of `nil` to anything returns GraphQL `null`.
13
+
14
+ - Coerce String to defined scalar now succeeds.
15
+
16
+ - Handle comments in all locations.
17
+
7
18
  ## [2.11.1] - [2019-09-22]
8
19
 
9
20
  Race fix
data/README.md CHANGED
@@ -125,7 +125,7 @@ the develop branch. Pull requests should be made against the develop branch.
125
125
 
126
126
  ## Support
127
127
 
128
- [Get supported Agoo with a Tidelift Subscription.](https://tidelift.com/subscription/pkg/rubygems-agoo?utm_source=rubygems-agoo&utm_medium=referral&utm_campaign=readme)
128
+ [Get supported Agoo with a Tidelift Subscription.](https://tidelift.com/subscription/pkg/rubygems-agoo?utm_source=rubygems-agoo&utm_medium=referral&utm_campaign=readme) Security updates are [supported](https://tidelift.com/security).
129
129
 
130
130
  ## Links
131
131
 
@@ -487,19 +487,21 @@ check_upgrade(agooCon c) {
487
487
 
488
488
  #ifdef HAVE_OPENSSL_SSL_H
489
489
  static void
490
- con_ssl_error(agooCon c, const char *filename, int line) {
491
- char buf[224];
492
- unsigned long e = ERR_get_error();
490
+ con_ssl_error(agooCon c, const char *what, unsigned long e, const char *filename, int line) {
491
+ char buf[224];
493
492
 
493
+ if (0 == e) {
494
+ e = ERR_get_error();
495
+ }
494
496
  c->dead = true;
495
497
  ERR_error_string_n(e, buf, sizeof(buf));
496
- agoo_log_cat(&agoo_error_cat, "%s at %s:%d", buf, filename, line);
498
+ agoo_log_cat(&agoo_error_cat, "%s %s at %s:%d", what, buf, filename, line);
497
499
  }
498
500
  #endif
499
501
 
500
502
  bool
501
503
  agoo_con_http_read(agooCon c) {
502
- ssize_t cnt;
504
+ ssize_t cnt = 0;
503
505
 
504
506
  if (c->dead || 0 == c->sock || c->closing) {
505
507
  return true;
@@ -512,13 +514,13 @@ agoo_con_http_read(agooCon c) {
512
514
  cnt = SSL_read(c->ssl, c->buf + c->bcnt, sizeof(c->buf) - c->bcnt - 1);
513
515
  }
514
516
  if (0 > cnt) {
515
- unsigned long e = ERR_get_error();
517
+ //unsigned long e = ERR_get_error();
518
+ int e = ERR_get_error();
516
519
 
517
520
  if (0 == e) {
518
- cnt = 0;
519
521
  return false;
520
522
  } else {
521
- con_ssl_error(c, __FILE__, __LINE__);
523
+ con_ssl_error(c, "read", (unsigned long)e, __FILE__, __LINE__);
522
524
  c->dead = true;
523
525
  return true;
524
526
  }
@@ -632,7 +634,7 @@ bool
632
634
  agoo_con_http_write(agooCon c) {
633
635
  agooRes res = agoo_con_res_pop(c);
634
636
  agooText message = agoo_res_message_peek(res);
635
- ssize_t cnt;
637
+ ssize_t cnt = 0;
636
638
 
637
639
  if (NULL == message) {
638
640
  return true;
@@ -665,7 +667,7 @@ agoo_con_http_write(agooCon c) {
665
667
  if (0 == e) {
666
668
  return true;
667
669
  }
668
- con_ssl_error(c, __FILE__, __LINE__);
670
+ con_ssl_error(c, "write", (unsigned long)e, __FILE__, __LINE__);
669
671
  c->dead = true;
670
672
 
671
673
  return false;
@@ -1246,13 +1248,13 @@ static void
1246
1248
  con_ssl_setup(agooCon c) {
1247
1249
  #ifdef HAVE_OPENSSL_SSL_H
1248
1250
  if (NULL == (c->ssl = SSL_new(agoo_server.ssl_ctx))) {
1249
- con_ssl_error(c, __FILE__, __LINE__);
1251
+ con_ssl_error(c, "new SSL", 0, __FILE__, __LINE__);
1250
1252
  }
1251
1253
  if (!SSL_set_fd(c->ssl, c->sock)) {
1252
- con_ssl_error(c, __FILE__, __LINE__);
1254
+ con_ssl_error(c, "SSL set fd", 0, __FILE__, __LINE__);
1253
1255
  }
1254
1256
  if (!SSL_accept(c->ssl)) {
1255
- con_ssl_error(c, __FILE__, __LINE__);
1257
+ con_ssl_error(c, "SSL accept", 0, __FILE__, __LINE__);
1256
1258
  }
1257
1259
  #else
1258
1260
  agoo_log_cat(&agoo_error_cat, "SSL not included in the build.");
@@ -61,7 +61,14 @@ int
61
61
  agoo_doc_skip_white(agooDoc doc) {
62
62
  const char *start = doc->cur;
63
63
 
64
- for (; 'w' == char_map[*(uint8_t*)doc->cur]; doc->cur++) {
64
+ while (true) {
65
+ for (; 'w' == char_map[*(uint8_t*)doc->cur]; doc->cur++) {
66
+ }
67
+ if ('#' == *doc->cur) {
68
+ agoo_doc_skip_comment(doc);
69
+ } else {
70
+ break;
71
+ }
65
72
  }
66
73
  return (int)(doc->cur - start);
67
74
  }
@@ -746,6 +746,7 @@ gql_scalar_create(agooErr err, const char *name, const char *desc, size_t dlen)
746
746
  type->to_json = NULL;
747
747
  type->to_sdl = NULL;
748
748
  type->destroy = NULL;
749
+ type->scalar_kind = GQL_SCALAR_STRING;
749
750
  }
750
751
  return type;
751
752
  }
@@ -222,6 +222,9 @@ coerce(agooErr err, gqlRef ref, gqlType type) {
222
222
  gqlValue value = NULL;
223
223
  volatile VALUE v;
224
224
 
225
+ if (Qnil == (VALUE)ref) {
226
+ return gql_null_create(err);
227
+ }
225
228
  if (NULL == type) {
226
229
  // This is really an error but make a best effort anyway.
227
230
  switch (rb_type((VALUE)ref)) {
@@ -1,5 +1,5 @@
1
1
 
2
2
  module Agoo
3
3
  # Agoo version.
4
- VERSION = '2.11.1'
4
+ VERSION = '2.11.2'
5
5
  end
@@ -14,7 +14,7 @@ require 'oj'
14
14
 
15
15
  require 'agoo'
16
16
 
17
- class RackHandlerTest < Minitest::Test
17
+ class HijackHandlerTest < Minitest::Test
18
18
  class HijackHandler
19
19
  def call(env)
20
20
  io = env['rack.hijack'].call
@@ -27,34 +27,33 @@ hello world|)
27
27
  end
28
28
  end
29
29
 
30
+ Minitest.after_run {
31
+ GC.start
32
+ Agoo::shutdown
33
+ }
34
+
30
35
  def test_hijack
31
- begin
32
- Agoo::Log.configure(dir: '',
33
- console: true,
34
- classic: true,
35
- colorize: true,
36
- states: {
37
- INFO: false,
38
- DEBUG: false,
39
- connect: false,
40
- request: false,
41
- response: false,
42
- eval: true,
43
- })
44
-
45
- Agoo::Server.init(6471, 'root', thread_count: 1)
46
-
47
- handler = HijackHandler.new
48
- Agoo::Server.handle(:GET, "/hijack", handler)
49
-
50
- Agoo::Server.start()
51
-
52
- jack
53
-
54
- ensure
55
- GC.start
56
- Agoo.shutdown
57
- end
36
+ Agoo::Log.configure(dir: '',
37
+ console: true,
38
+ classic: true,
39
+ colorize: true,
40
+ states: {
41
+ INFO: false,
42
+ DEBUG: false,
43
+ connect: false,
44
+ request: false,
45
+ response: false,
46
+ eval: true,
47
+ })
48
+
49
+ Agoo::Server.init(6471, 'root', thread_count: 1)
50
+
51
+ handler = HijackHandler.new
52
+ Agoo::Server.handle(:GET, "/hijack", handler)
53
+
54
+ Agoo::Server.start()
55
+
56
+ jack
58
57
  end
59
58
 
60
59
  def jack
@@ -72,5 +71,5 @@ hello world|)
72
71
 
73
72
  assert_equal('hello world', content, 'content mismatch')
74
73
  end
75
-
74
+
76
75
  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.11.1
4
+ version: 2.11.2
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-09-22 00:00:00.000000000 Z
11
+ date: 2019-10-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: oj