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 +4 -4
- data/CHANGELOG.md +6 -0
- data/ext/agoo/request.c +13 -6
- data/lib/agoo/version.rb +1 -1
- data/test/base_handler_test.rb +3 -3
- data/test/rack_handler_test.rb +2 -2
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 69a2baa46cde1aaa305d41b6396ce5e78ffc207d0225b910faf280e2beb18749
|
4
|
+
data.tar.gz: b8ff1ffd30767c254ba0849d3e90593a0ccd687fe15db9b211c21fe4b8d5f98b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6d120ee1e1008a9d0fb0382b4f56af522b8eb3e553258632089596d5e506eab7d7d03f221b7275a9f1268e132d4281e0bf0210dd35e69da105d5f12ab1cf7c75
|
7
|
+
data.tar.gz: 2f90130a772f81b444c27ff5d3d4e148de5d8bf971a01d30b93edb9405ca6dc8a0fd57ef7ad4d4cccd3b7501049985dfd4a9945350556e7be1b66d9eb4592cb5
|
data/CHANGELOG.md
CHANGED
@@ -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.
|
data/ext/agoo/request.c
CHANGED
@@ -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
|
-
|
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
|
-
|
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
|
|
data/lib/agoo/version.rb
CHANGED
data/test/base_handler_test.rb
CHANGED
@@ -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.
|
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" => "
|
104
|
+
"SCRIPT_NAME" => "",
|
105
105
|
"SERVER_NAME" => "localhost",
|
106
106
|
"SERVER_PORT" => "6470",
|
107
107
|
"rack.errors" => nil,
|
data/test/rack_handler_test.rb
CHANGED
@@ -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" => "
|
96
|
+
"SCRIPT_NAME" => "",
|
97
97
|
"SERVER_NAME" => "localhost",
|
98
98
|
"SERVER_PORT" => "6467",
|
99
99
|
"rack.errors" => nil,
|