agoo 2.13.0 → 2.14.0

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: df42da153e97e018d4984fa75be78ac86a1c8b97aed6b48d62ec7fe5047d7099
4
- data.tar.gz: e83a55eed4781bbb0ab08df41203509df6ec45d06817b87c9d61d25bca8a294a
3
+ metadata.gz: f70842cac2f630e74251967ca0accfcb2dacef7b143bb3707ae74d88a0f1da36
4
+ data.tar.gz: 75996d57b98c1d164fa44009f1c6037deb28f22d7179b7bd3ede0296f3d9a605
5
5
  SHA512:
6
- metadata.gz: ac6e8d86a9b545d93c9ee033950422292b4ab2f740ba692f2c24940e928c42466b895dfae6ce5263040f2b53613a6c1241f5dfe5c0be21961f1ee885970ec220
7
- data.tar.gz: 9dd8414c88948198bd1a22d5aac236ef8d5bf4251020b7fcfc4b94837d8a48433aa6774ba9e13df1dc36dc1e29f1697dfcc2c21e8ef1a9dc6897d223b72eb946
6
+ metadata.gz: 39f02fdb5ab101d1414a57a7d712b6b4910b583e2509d0911d2cf5c398badfdb556c6847eaa7e108d280b590792bf3cb007514e4f6cd7c8f57ddb233299e3a0f
7
+ data.tar.gz: 10b2f2cc9d56d34e27dd597c5c2d0fa61bcf3921198efcbffcbfece23841656af9dc9eb6909b592e63ff30dd79aed315a55bacf97a471ac5c1c3e7acff4782f2
@@ -2,6 +2,16 @@
2
2
 
3
3
  All changes to the Agoo gem are documented here. Releases follow semantic versioning.
4
4
 
5
+ ## [2.14.0] - 2020-11-07
6
+
7
+ ### Added
8
+
9
+ - REMOTE_ADDR element added to requests/env argument to `call()`.
10
+
11
+ - Added check for multiple Content-Length headers.
12
+
13
+ - Multiple occurrances of a header are now passed to the Rack `call()` method as an array.
14
+
5
15
  ## [2.13.0] - 2020-07-05
6
16
 
7
17
  ### Added
data/README.md CHANGED
@@ -68,6 +68,31 @@ sleep
68
68
  gem install agoo
69
69
  ```
70
70
 
71
+ ## Using agoo as server for rails
72
+
73
+ As agoo supports rack compatible apps you can use it for rails applications:
74
+
75
+ Add agoo to the Gemfile:
76
+
77
+ ```
78
+ # Gemfile
79
+ gem 'agoo'
80
+ ```
81
+
82
+ Install bundle:
83
+
84
+ ```
85
+ $ bundle install
86
+ ```
87
+
88
+ Start rails with agoo as server:
89
+
90
+ ```
91
+ $ rails server -u agoo
92
+ ```
93
+
94
+ Enjoy the increased performance!
95
+
71
96
  ## What Is This?
72
97
 
73
98
  Agoo is Japanese for a type of flying fish. This gem flies. It is a high
@@ -63,6 +63,22 @@ agoo_con_create(agooErr err, int sock, uint64_t id, agooBind b) {
63
63
  if (NULL == (c = (agooCon)AGOO_CALLOC(1, sizeof(struct _agooCon)))) {
64
64
  AGOO_ERR_MEM(err, "Connection");
65
65
  } else {
66
+ // It would be better to get this information in server.c after
67
+ // accept() but that does not work on macOS so instead a call to
68
+ // getpeername() is used instead.
69
+ struct sockaddr_storage addr;
70
+ socklen_t len = sizeof(addr);
71
+
72
+ getpeername(sock, (struct sockaddr*)&addr, &len);
73
+ if (addr.ss_family == AF_INET) {
74
+ struct sockaddr_in *s = (struct sockaddr_in*)&addr;
75
+
76
+ inet_ntop(AF_INET, &s->sin_addr, c->remote, sizeof(c->remote));
77
+ } else {
78
+ struct sockaddr_in6 *s = (struct sockaddr_in6*)&addr;
79
+
80
+ inet_ntop(AF_INET6, &s->sin6_addr, c->remote, sizeof(c->remote));
81
+ }
66
82
  c->sock = sock;
67
83
  c->id = id;
68
84
  c->timeout = dtime() + CON_TIMEOUT;
@@ -437,6 +453,7 @@ con_header_read(agooCon c, size_t *mlenp) {
437
453
  c->req->method = method;
438
454
  c->req->upgrade = AGOO_UP_NONE;
439
455
  c->req->up = NULL;
456
+ memcpy(c->req->remote, c->remote, sizeof(c->remote));
440
457
  c->req->path.start = c->req->msg + (path.start - c->buf);
441
458
  c->req->path.len = (int)(path.end - path.start);
442
459
  c->req->query.start = c->req->msg + (query - c->buf);
@@ -3,6 +3,7 @@
3
3
  #ifndef AGOO_CON_H
4
4
  #define AGOO_CON_H
5
5
 
6
+ #include <arpa/inet.h>
6
7
  #include <poll.h>
7
8
  #include <pthread.h>
8
9
  #include <stdbool.h>
@@ -45,6 +46,7 @@ typedef struct _agooCon {
45
46
  struct _agooBind *bind;
46
47
  struct pollfd *pp;
47
48
  uint64_t id;
49
+ char remote[INET6_ADDRSTRLEN];
48
50
  char buf[MAX_HEADER_SIZE];
49
51
  size_t bcnt;
50
52
 
@@ -26,7 +26,7 @@ typedef struct _cache {
26
26
  struct _cache key_cache;
27
27
 
28
28
  // The rack spec indicates the characters (),/:;<=>?@[]{} are invalid which
29
- // clearly is not consisten with RFC7230 so stick with the RFC.
29
+ // clearly is not consistent with RFC7230 so stick with the RFC.
30
30
  static char header_value_chars[256] = "\
31
31
  xxxxxxxxxxoxxxxxxxxxxxxxxxxxxxxx\
32
32
  oooooooooooooooooooooooooooooooo\
@@ -50,7 +50,6 @@ static const char *header_keys[] = {
50
50
  "Accept-Encoding",
51
51
  "Accept-Features",
52
52
  "Accept-Language",
53
- "Accept-Language",
54
53
  "Accept-Patch",
55
54
  "Accept-Post",
56
55
  "Accept-Ranges",
@@ -74,7 +73,6 @@ static const char *header_keys[] = {
74
73
  "Approved",
75
74
  "Archive",
76
75
  "Archived-At",
77
- "Archived-At",
78
76
  "Article-Names",
79
77
  "Article-Updates",
80
78
  "Authentication-Control",
@@ -99,36 +97,27 @@ static const char *header_keys[] = {
99
97
  "Cc",
100
98
  "Close",
101
99
  "Comments",
102
- "Comments",
103
100
  "Compliance",
104
101
  "Connection",
105
102
  "Content-Alternative",
106
103
  "Content-Base",
107
- "Content-Base",
108
104
  "Content-Description",
109
105
  "Content-Disposition",
110
- "Content-Disposition",
111
106
  "Content-Duration",
112
107
  "Content-Encoding",
113
108
  "Content-ID",
114
- "Content-ID",
115
109
  "Content-Identifier",
116
110
  "Content-Language",
117
- "Content-Language",
118
111
  "Content-Length",
119
112
  "Content-Location",
120
- "Content-Location",
121
- "Content-MD5",
122
113
  "Content-MD5",
123
114
  "Content-Range",
124
115
  "Content-Return",
125
116
  "Content-Script-Type",
126
117
  "Content-Style-Type",
127
118
  "Content-Transfer-Encoding",
128
- "Content-Transfer-Encoding",
129
119
  "Content-Translation-Type",
130
120
  "Content-Type",
131
- "Content-Type",
132
121
  "Content-Version",
133
122
  "Content-features",
134
123
  "Control",
@@ -141,8 +130,7 @@ static const char *header_keys[] = {
141
130
  "DAV",
142
131
  "DKIM-Signature",
143
132
  "DL-Expansion-History",
144
- "Date",
145
- "Date",
133
+ "DNT",
146
134
  "Date",
147
135
  "Date-Received",
148
136
  "Default-Style",
@@ -182,7 +170,6 @@ static const char *header_keys[] = {
182
170
  "Downgraded-Sender",
183
171
  "Downgraded-To",
184
172
  "EDIINT-Features",
185
- "EDIINT-Features",
186
173
  "ETag",
187
174
  "Eesst-Version",
188
175
  "Encoding",
@@ -190,16 +177,13 @@ static const char *header_keys[] = {
190
177
  "Errors-To",
191
178
  "Expect",
192
179
  "Expires",
193
- "Expires",
194
- "Expires",
195
180
  "Expiry-Date",
196
181
  "Ext",
197
182
  "Followup-To",
198
183
  "Form-Sub",
199
184
  "Forwarded",
200
185
  "From",
201
- "From",
202
- "From",
186
+ "Front-End-Https",
203
187
  "Generate-Delivery-Report",
204
188
  "GetProfile",
205
189
  "HTTP2-Settings",
@@ -219,10 +203,8 @@ static const char *header_keys[] = {
219
203
  "Injection-Date",
220
204
  "Injection-Info",
221
205
  "Jabber-ID",
222
- "Jabber-ID",
223
206
  "Keep-Alive",
224
207
  "Keywords",
225
- "Keywords",
226
208
  "Label",
227
209
  "Language",
228
210
  "Last-Modified",
@@ -240,7 +222,6 @@ static const char *header_keys[] = {
240
222
  "Location",
241
223
  "Lock-Token",
242
224
  "MIME-Version",
243
- "MIME-Version",
244
225
  "MMHS-Acp127-Message-Identifier",
245
226
  "MMHS-Authorizing-Users",
246
227
  "MMHS-Codress-Message-Indicator",
@@ -262,8 +243,6 @@ static const char *header_keys[] = {
262
243
  "Memento-Datetime",
263
244
  "Message-Context",
264
245
  "Message-ID",
265
- "Message-ID",
266
- "Message-ID",
267
246
  "Message-Type",
268
247
  "Meter",
269
248
  "Method-Check",
@@ -279,7 +258,6 @@ static const char *header_keys[] = {
279
258
  "Optional-WWW-Authenticate",
280
259
  "Ordering-Type",
281
260
  "Organization",
282
- "Organization",
283
261
  "Origin",
284
262
  "Original-Encoded-Information-Types",
285
263
  "Original-From",
@@ -292,7 +270,6 @@ static const char *header_keys[] = {
292
270
  "P3P",
293
271
  "PEP",
294
272
  "PICS-Label",
295
- "PICS-Label",
296
273
  "Path",
297
274
  "Pep-Info",
298
275
  "Position",
@@ -311,6 +288,7 @@ static const char *header_keys[] = {
311
288
  "Proxy-Authenticate",
312
289
  "Proxy-Authentication-Info",
313
290
  "Proxy-Authorization",
291
+ "Proxy-Connection",
314
292
  "Proxy-Features",
315
293
  "Proxy-Instruction",
316
294
  "Public",
@@ -321,13 +299,11 @@ static const char *header_keys[] = {
321
299
  "Received-SPF",
322
300
  "Redirect-Ref",
323
301
  "References",
324
- "References",
325
302
  "Referer",
326
303
  "Referer-Root",
327
304
  "Relay-Version",
328
305
  "Reply-By",
329
306
  "Reply-To",
330
- "Reply-To",
331
307
  "Require-Recipient-Valid-Since",
332
308
  "Resent-Bcc",
333
309
  "Resent-Cc",
@@ -345,6 +321,7 @@ static const char *header_keys[] = {
345
321
  "SIO-Label-History",
346
322
  "SLUG",
347
323
  "Safe",
324
+ "Save-Data",
348
325
  "Schedule-Reply",
349
326
  "Schedule-Tag",
350
327
  "Sec-WebSocket-Accept",
@@ -367,11 +344,9 @@ static const char *header_keys[] = {
367
344
  "Strict-Transport-Security",
368
345
  "SubOK",
369
346
  "Subject",
370
- "Subject",
371
347
  "Subst",
372
348
  "Summary",
373
349
  "Supersedes",
374
- "Supersedes",
375
350
  "Surrogate-Capability",
376
351
  "Surrogate-Control",
377
352
  "TCN",
@@ -390,9 +365,9 @@ static const char *header_keys[] = {
390
365
  "UA-Windowpixels",
391
366
  "URI",
392
367
  "Upgrade",
368
+ "Upgrade-Insecure-Requests",
393
369
  "Urgency",
394
370
  "User-Agent",
395
- "User-Agent",
396
371
  "VBR-Info",
397
372
  "Variant-Vary",
398
373
  "Vary",
@@ -401,22 +376,32 @@ static const char *header_keys[] = {
401
376
  "WWW-Authenticate",
402
377
  "Want-Digest",
403
378
  "Warning",
404
- "X-Archived-At",
379
+ "X-ATT-DeviceId",
405
380
  "X-Archived-At",
406
381
  "X-Content-Type-Options",
382
+ "X-Correlation-ID",
383
+ "X-Csrf-Token",
407
384
  "X-Device-Accept",
408
385
  "X-Device-Accept-Charset",
409
386
  "X-Device-Accept-Encoding",
410
387
  "X-Device-Accept-Language",
411
388
  "X-Device-User-Agent",
389
+ "X-Forwarded-For",
390
+ "X-Forwarded-Host",
391
+ "X-Forwarded-Proto",
412
392
  "X-Frame-Options",
393
+ "X-Http-Method-Override",
413
394
  "X-Mittente",
414
395
  "X-PGP-Sig",
396
+ "X-Request-ID",
397
+ "X-Requested-With",
415
398
  "X-Ricevuta",
416
399
  "X-Riferimento-Message-ID",
417
400
  "X-TipoRicevuta",
418
401
  "X-Trasporto",
402
+ "X-UIDH",
419
403
  "X-VerificaSicurezza",
404
+ "X-Wap-Profile",
420
405
  "X-XSS-Protection",
421
406
  "X400-Content-Identifier",
422
407
  "X400-Content-Return",
@@ -469,7 +454,7 @@ key_set(const char *key) {
469
454
  int64_t h = calc_hash(key, &len);
470
455
  Slot *bucket = get_bucketp(h);
471
456
  Slot s;
472
-
457
+
473
458
  if (NULL != (s = (Slot)AGOO_MALLOC(sizeof(struct _slot)))) {
474
459
  s->hash = h;
475
460
  s->klen = len;
@@ -482,7 +467,7 @@ key_set(const char *key) {
482
467
  void
483
468
  agoo_http_init() {
484
469
  const char **kp = header_keys;
485
-
470
+
486
471
  memset(&key_cache, 0, sizeof(struct _cache));
487
472
  for (; NULL != *kp; kp++) {
488
473
  key_set(*kp);
@@ -550,7 +535,7 @@ agoo_http_header_ok(agooErr err, const char *key, int klen, const char *value, i
550
535
  const char*
551
536
  agoo_http_code_message(int code) {
552
537
  const char *msg = "";
553
-
538
+
554
539
  switch (code) {
555
540
  case 100: msg = "Continue"; break;
556
541
  case 101: msg = "Switching Protocols"; break;
@@ -3,6 +3,7 @@
3
3
  #ifndef AGOO_REQ_H
4
4
  #define AGOO_REQ_H
5
5
 
6
+ #include <arpa/inet.h>
6
7
  #include <stdint.h>
7
8
 
8
9
  #include "hook.h"
@@ -32,6 +33,7 @@ typedef struct _agooReq {
32
33
  struct _agooStr query;
33
34
  struct _agooStr header;
34
35
  struct _agooStr body;
36
+ char remote[INET6_ADDRSTRLEN];
35
37
  void *env;
36
38
  agooHook hook;
37
39
  size_t mlen; // allocated msg length
@@ -43,6 +43,7 @@ static VALUE rack_upgrade_val = Qundef;
43
43
  static VALUE rack_url_scheme_val = Qundef;
44
44
  static VALUE rack_version_val = Qundef;
45
45
  static VALUE rack_version_val_val = Qundef;
46
+ static VALUE remote_addr_val = Qundef;
46
47
  static VALUE request_method_val = Qundef;
47
48
  static VALUE script_name_val = Qundef;
48
49
  static VALUE server_name_val = Qundef;
@@ -96,6 +97,27 @@ method(VALUE self) {
96
97
  return req_method((agooReq)DATA_PTR(self));
97
98
  }
98
99
 
100
+ static VALUE
101
+ req_remote_addr(agooReq r) {
102
+
103
+ if (NULL == r) {
104
+ rb_raise(rb_eArgError, "Request is no longer valid.");
105
+ }
106
+ return rb_str_new(r->remote, strlen(r->remote));
107
+ }
108
+
109
+ /* Document-method: remote_addr
110
+ *
111
+ * call-seq: remote_addr()
112
+ *
113
+ * Returns the remote address.
114
+ */
115
+ static VALUE
116
+ remote_addr(VALUE self) {
117
+ return req_remote_addr((agooReq)DATA_PTR(self));
118
+ }
119
+
120
+
99
121
  static VALUE
100
122
  req_script_name(agooReq r) {
101
123
  // The logic is a bit tricky here and for path_info. If the HTTP path is /
@@ -366,14 +388,29 @@ rack_run_once(VALUE self) {
366
388
 
367
389
  static void
368
390
  add_header_value(VALUE hh, const char *key, int klen, const char *val, int vlen) {
391
+ VALUE v;
392
+
369
393
  if (sizeof(content_type) - 1 == klen && 0 == strncasecmp(key, content_type, sizeof(content_type) - 1)) {
370
- rb_hash_aset(hh, content_type_val, rb_str_new(val, vlen));
394
+ if (Qnil == (v = rb_hash_lookup2(hh, content_type_val, Qnil))) {
395
+ rb_hash_aset(hh, content_type_val, rb_str_new(val, vlen));
396
+ } else {
397
+ volatile VALUE a = rb_ary_new();
398
+
399
+ rb_ary_push(a, v);
400
+ rb_ary_push(a, rb_str_new(val, vlen));
401
+ rb_hash_aset(hh, content_type_val, a);
402
+ }
371
403
  } else if (sizeof(content_length) - 1 == klen && 0 == strncasecmp(key, content_length, sizeof(content_length) - 1)) {
372
- rb_hash_aset(hh, content_length_val, rb_str_new(val, vlen));
404
+ if (Qnil == (v = rb_hash_lookup2(hh, content_length_val, Qnil))) {
405
+ rb_hash_aset(hh, content_length_val, rb_str_new(val, vlen));
406
+ } else {
407
+ rb_raise(rb_eArgError, "Multiple Content-Length headers.");
408
+ }
373
409
  } else {
374
410
  char hkey[1024];
375
411
  char *k = hkey;
376
412
  volatile VALUE sval = rb_str_new(val, vlen);
413
+ volatile VALUE kval;
377
414
 
378
415
  strcpy(hkey, "HTTP_");
379
416
  k = hkey + 5;
@@ -392,7 +429,16 @@ add_header_value(VALUE hh, const char *key, int klen, const char *val, int vlen)
392
429
  *k = toupper(*k);
393
430
  }
394
431
  }
395
- rb_hash_aset(hh, rb_str_new(hkey, klen + 5), sval);
432
+ kval = rb_str_new(hkey, klen + 5);
433
+ if (Qnil == (v = rb_hash_lookup2(hh, kval, Qnil))) {
434
+ rb_hash_aset(hh, kval, sval);
435
+ } else {
436
+ volatile VALUE a = rb_ary_new();
437
+
438
+ rb_ary_push(a, v);
439
+ rb_ary_push(a, sval);
440
+ rb_hash_aset(hh, kval, a);
441
+ }
396
442
  }
397
443
  }
398
444
 
@@ -545,8 +591,9 @@ request_env(agooReq req, VALUE self) {
545
591
  rb_hash_aset(env, script_name_val, req_script_name(req));
546
592
  rb_hash_aset(env, path_info_val, req_path_info(req));
547
593
  rb_hash_aset(env, query_string_val, req_query_string(req));
548
- rb_hash_aset(env, server_name_val, req_server_name(req));
594
+ rb_hash_aset(env, remote_addr_val, req_remote_addr(req));
549
595
  rb_hash_aset(env, server_port_val, req_server_port(req));
596
+ rb_hash_aset(env, server_name_val, req_server_name(req));
550
597
  fill_headers(req, env);
551
598
  rb_hash_aset(env, rack_version_val, rack_version_val_val);
552
599
  rb_hash_aset(env, rack_url_scheme_val, req_rack_url_scheme(req));
@@ -663,6 +710,7 @@ request_init(VALUE mod) {
663
710
  rb_define_method(req_class, "query_string", query_string, 0);
664
711
  rb_define_method(req_class, "server_name", server_name, 0);
665
712
  rb_define_method(req_class, "server_port", server_port, 0);
713
+ rb_define_method(req_class, "remote_addr", remote_addr, 0);
666
714
  rb_define_method(req_class, "rack_version", rack_version, 0);
667
715
  rb_define_method(req_class, "rack_url_scheme", rack_url_scheme, 0);
668
716
  rb_define_method(req_class, "rack_input", rack_input, 0);
@@ -713,6 +761,7 @@ request_init(VALUE mod) {
713
761
  rack_upgrade_val = rb_str_new_cstr("rack.upgrade?"); rb_gc_register_address(&rack_upgrade_val);
714
762
  rack_url_scheme_val = rb_str_new_cstr("rack.url_scheme"); rb_gc_register_address(&rack_url_scheme_val);
715
763
  rack_version_val = rb_str_new_cstr("rack.version"); rb_gc_register_address(&rack_version_val);
764
+ remote_addr_val = rb_str_new_cstr("REMOTE_ADDR"); rb_gc_register_address(&remote_addr_val);
716
765
  request_method_val = rb_str_new_cstr("REQUEST_METHOD"); rb_gc_register_address(&request_method_val);
717
766
  script_name_val = rb_str_new_cstr("SCRIPT_NAME"); rb_gc_register_address(&script_name_val);
718
767
  server_name_val = rb_str_new_cstr("SERVER_NAME"); rb_gc_register_address(&server_name_val);
@@ -160,8 +160,8 @@ listen_loop(void *x) {
160
160
  //fcntl(client_sock, F_SETFL, FNDELAY);
161
161
  setsockopt(client_sock, SOL_SOCKET, SO_KEEPALIVE, &optval, sizeof(optval));
162
162
  setsockopt(client_sock, IPPROTO_TCP, TCP_NODELAY, &optval, sizeof(optval));
163
- agoo_log_cat(&agoo_con_cat, "Server with pid %d accepted connection %llu on %s [%d]",
164
- getpid(), (unsigned long long)cnt, b->id, con->sock);
163
+ agoo_log_cat(&agoo_con_cat, "Server with pid %d accepted connection %llu on %s [%d] from %s",
164
+ getpid(), (unsigned long long)cnt, b->id, con->sock, con->remote);
165
165
 
166
166
  con_cnt = atomic_fetch_add(&agoo_server.con_cnt, 1);
167
167
  if (agoo_server.loop_max > agoo_server.loop_cnt && agoo_server.loop_cnt * LOOP_UP < con_cnt) {
@@ -189,6 +189,7 @@ agoo_ws_create_req(agooCon c, long mlen) {
189
189
  c->req->method = (AGOO_WS_OP_BIN == op) ? AGOO_ON_BIN : AGOO_ON_MSG;
190
190
  c->req->upgrade = AGOO_UP_NONE;
191
191
  c->req->up = c->up;
192
+ memcpy(c->req->remote, c->remote, sizeof(c->remote));
192
193
  c->req->res = NULL;
193
194
  if (c->up->on_msg) {
194
195
  c->req->hook = agoo_hook_create(AGOO_NONE, NULL, c->up->ctx, PUSH_HOOK, &agoo_server.eval_queue);
@@ -1,5 +1,5 @@
1
1
 
2
2
  module Agoo
3
3
  # Agoo version.
4
- VERSION = '2.13.0'
4
+ VERSION = '2.14.0'
5
5
  end
@@ -82,7 +82,7 @@ class BaseHandlerTest < Minitest::Test
82
82
  GC.start
83
83
  Agoo::shutdown
84
84
  }
85
-
85
+
86
86
  def test_eval
87
87
  uri = URI('http://localhost:6470/tellme?a=1')
88
88
  req = Net::HTTP::Get.new(uri)
@@ -132,13 +132,13 @@ class BaseHandlerTest < Minitest::Test
132
132
  req['Accept-Encoding'] = '*'
133
133
  req['Accept'] = 'application/json'
134
134
  req['User-Agent'] = 'Ruby'
135
-
135
+
136
136
  res = Net::HTTP.start(uri.hostname, uri.port) { |h|
137
137
  h.request(req)
138
138
  }
139
139
  assert_equal(Net::HTTPNoContent, res.class)
140
140
  end
141
-
141
+
142
142
  def test_put
143
143
  uri = URI('http://localhost:6470/makeme')
144
144
  req = Net::HTTP::Put.new(uri)
@@ -147,7 +147,7 @@ class BaseHandlerTest < Minitest::Test
147
147
  req['Accept'] = 'application/json'
148
148
  req['User-Agent'] = 'Ruby'
149
149
  req.body = 'hello'
150
-
150
+
151
151
  res = Net::HTTP.start(uri.hostname, uri.port) { |h|
152
152
  h.request(req)
153
153
  }
@@ -105,6 +105,7 @@ size=big
105
105
  "PATH_INFO" => "/tellme",
106
106
  "QUERY_STRING" => "a=1",
107
107
  "REQUEST_METHOD" => "GET",
108
+ "REMOTE_ADDR" => "127.0.0.1",
108
109
  "SCRIPT_NAME" => "",
109
110
  "SERVER_NAME" => "localhost",
110
111
  "SERVER_PORT" => "6467",
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.13.0
4
+ version: 2.14.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Peter Ohler
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-07-05 00:00:00.000000000 Z
11
+ date: 2020-11-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: oj