agoo 2.0.4 → 2.0.5

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: da2816b985fc556221634cd9002ddf9a2fd2a33c5e0ddc09c897ef8d9c686afc
4
- data.tar.gz: c99f5e5679c4b837dfd3ff2bbed6425905c1d41295666c82e5d0779811a2a202
3
+ metadata.gz: 69a2baa46cde1aaa305d41b6396ce5e78ffc207d0225b910faf280e2beb18749
4
+ data.tar.gz: b8ff1ffd30767c254ba0849d3e90593a0ccd687fe15db9b211c21fe4b8d5f98b
5
5
  SHA512:
6
- metadata.gz: 5eacde94a5ec77f4901fafc4bc6e2424729b4edbfbe40c9151f16fbb84ef354f7400ad463fd8b7c91120c40b65e7a86f734aafbd3657a7138b71a259a35eccd1
7
- data.tar.gz: 0c649ea6946255f17903b623dc8fd3767e0a712355bc4556d2a2a511017e8abfefaf4f3acff7fddd57fe3714559ff6ecdd5134fcbe104bde900a688d97c8322d
6
+ metadata.gz: 6d120ee1e1008a9d0fb0382b4f56af522b8eb3e553258632089596d5e506eab7d7d03f221b7275a9f1268e132d4281e0bf0210dd35e69da105d5f12ab1cf7c75
7
+ data.tar.gz: 2f90130a772f81b444c27ff5d3d4e148de5d8bf971a01d30b93edb9405ca6dc8a0fd57ef7ad4d4cccd3b7501049985dfd4a9945350556e7be1b66d9eb4592cb5
@@ -1,5 +1,11 @@
1
1
  # CHANGELOG
2
2
 
3
+ ### 2.0.5 - 2018-05-06
4
+
5
+ - 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`.
6
+
7
+ - 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.
8
+
3
9
  ### 2.0.4 - 2018-05-06
4
10
 
5
11
  - Fix allocation bug.
@@ -1,6 +1,7 @@
1
1
  // Copyright (c) 2018, Peter Ohler, All rights reserved.
2
2
 
3
3
  #include <stdio.h>
4
+ #include <ctype.h>
4
5
 
5
6
  #include "debug.h"
6
7
  #include "con.h"
@@ -109,10 +110,7 @@ req_script_name(Req r) {
109
110
  if (NULL == r) {
110
111
  rb_raise(rb_eArgError, "Request is no longer valid.");
111
112
  }
112
- if (0 == r->path.len || (1 == r->path.len && '/' == *r->path.start)) {
113
- return empty_val;
114
- }
115
- return rb_str_new(r->path.start, r->path.len);
113
+ return empty_val;
116
114
  }
117
115
 
118
116
  /* Document-method: script_name
@@ -136,7 +134,11 @@ req_path_info(Req r) {
136
134
  if (0 == r->path.len || (1 == r->path.len && '/' == *r->path.start)) {
137
135
  return slash_val;
138
136
  }
139
- return empty_val;
137
+
138
+ if (0 == r->path.len || (1 == r->path.len && '/' == *r->path.start)) {
139
+ return empty_val;
140
+ }
141
+ return rb_str_new(r->path.start, r->path.len);
140
142
  }
141
143
 
142
144
  /* Document-method: path_info
@@ -383,7 +385,7 @@ add_header_value(VALUE hh, const char *key, int klen, const char *val, int vlen)
383
385
  } else {
384
386
  char hkey[1024];
385
387
  char *k = hkey;
386
-
388
+
387
389
  strcpy(hkey, "HTTP_");
388
390
  k = hkey + 5;
389
391
  if ((int)(sizeof(hkey) - 5) <= klen) {
@@ -393,6 +395,11 @@ add_header_value(VALUE hh, const char *key, int klen, const char *val, int vlen)
393
395
  hkey[klen + 5] = '\0';
394
396
 
395
397
  rb_hash_aset(hh, rb_str_new(hkey, klen + 5), rb_str_new(val, vlen));
398
+ // Contrary to the Rack spec, Rails expects all upper case keys so add those as well.
399
+ for (k = hkey + 5; '\0' != *k; k++) {
400
+ *k = toupper(*k);
401
+ }
402
+ rb_hash_aset(hh, rb_str_new(hkey, klen + 5), rb_str_new(val, vlen));
396
403
  }
397
404
  }
398
405
 
@@ -1,5 +1,5 @@
1
1
 
2
2
  module Agoo
3
3
  # Agoo version.
4
- VERSION = '2.0.4'
4
+ VERSION = '2.0.5'
5
5
  end
@@ -38,7 +38,7 @@ class BaseHandlerTest < Minitest::Test
38
38
  end
39
39
 
40
40
  def on_request(req, res)
41
- res.body = "#{@name} - #{req.script_name}"
41
+ res.body = "#{@name} - #{req.path_info}"
42
42
  end
43
43
  end
44
44
 
@@ -98,10 +98,10 @@ class BaseHandlerTest < Minitest::Test
98
98
  "HTTP_Accept" => "application/json",
99
99
  "HTTP_Accept-Encoding" => "*",
100
100
  "HTTP_User-Agent" => "Ruby",
101
- "PATH_INFO" => "",
101
+ "PATH_INFO" => "/tellme",
102
102
  "QUERY_STRING" => "a=1",
103
103
  "REQUEST_METHOD" => "GET",
104
- "SCRIPT_NAME" => "/tellme",
104
+ "SCRIPT_NAME" => "",
105
105
  "SERVER_NAME" => "localhost",
106
106
  "SERVER_PORT" => "6470",
107
107
  "rack.errors" => nil,
@@ -90,10 +90,10 @@ class RackHandlerTest < Minitest::Test
90
90
  "HTTP_Accept" => "application/json",
91
91
  "HTTP_Accept-Encoding" => "*",
92
92
  "HTTP_User-Agent" => "Ruby",
93
- "PATH_INFO" => "",
93
+ "PATH_INFO" => "/tellme",
94
94
  "QUERY_STRING" => "a=1",
95
95
  "REQUEST_METHOD" => "GET",
96
- "SCRIPT_NAME" => "/tellme",
96
+ "SCRIPT_NAME" => "",
97
97
  "SERVER_NAME" => "localhost",
98
98
  "SERVER_PORT" => "6467",
99
99
  "rack.errors" => nil,
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: agoo
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.4
4
+ version: 2.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Peter Ohler