plezi 0.7.4 → 0.7.5
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 +4 -4
- data/CHANGELOG.md +6 -0
- data/lib/plezi/handlers/route.rb +35 -16
- data/lib/plezi/server/protocols/http_protocol.rb +2 -2
- data/lib/plezi/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 09b7229f402afa705079f518c81040b58b0bcdb9
|
4
|
+
data.tar.gz: 051c27c22d072d67a071f131db12ff81f118b743
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 808a747010627be737fac767f277b650de4ae57ebd28cf3b3098a2b5c44790ddf0f69ffd1bec58ae4018fdb5e67f9953ad768890528627c450436416a0935e74
|
7
|
+
data.tar.gz: 35f5e69c499cb04f1e1e23b3f647ad209f960dae41248ce059a70ad958dca3357dfc79319130854a34c4d5a6735d149933281b0757005395ceed4f424b0e4289
|
data/CHANGELOG.md
CHANGED
@@ -2,6 +2,12 @@
|
|
2
2
|
|
3
3
|
***
|
4
4
|
|
5
|
+
Change log v.0.7.5
|
6
|
+
|
7
|
+
**fix**: fixed an issue where form data might not be decoded correctly, resulting in remainin '+' signs that weren't properly converted to spaces.
|
8
|
+
|
9
|
+
***
|
10
|
+
|
5
11
|
Change log v.0.7.4
|
6
12
|
|
7
13
|
**change/fix**: it seems that behavior is more predictable when routes macgic parameters are non-persistent between routes. The old behavior (persistent parameters) is now limited to re-write routes.
|
data/lib/plezi/handlers/route.rb
CHANGED
@@ -90,6 +90,18 @@ module Plezi
|
|
90
90
|
param_num = 0
|
91
91
|
section_search = "([\\/][^\\/]*)"
|
92
92
|
optional_section_search = "([\\/][^\\/]*)?"
|
93
|
+
|
94
|
+
# to check for routes formatted: /:paramater - required parameters
|
95
|
+
regexp_required_params = /^\:([^\(\)\{\}\:]*)$/
|
96
|
+
# to check for routes formatted: /(:paramater) - optional parameters
|
97
|
+
regexp_optional_params = /^\(\:([^\(\)\{\}\:]*)\)$/
|
98
|
+
# to check for routes formatted: /(:paramater){regexp} - optional formatted parameters
|
99
|
+
regexp_formatted_optional_params = /^\(\:([^\(\)\{\}\:]*)\)\{(.*)\}$/
|
100
|
+
# check for routes formatted: /:paramater{regexp} - required parameters
|
101
|
+
regexp_formatted_required_params = /^\:([^\(\)\{\}\:\/]*)\{(.*)\}$/
|
102
|
+
# check for routes formatted: /{regexp} - required path
|
103
|
+
regexp_formatted_path = /^\{(.*)\}$/
|
104
|
+
|
93
105
|
@path = '^'
|
94
106
|
|
95
107
|
# prep path string
|
@@ -124,34 +136,41 @@ module Plezi
|
|
124
136
|
return
|
125
137
|
|
126
138
|
# check for routes formatted: /:paramater - required parameters
|
127
|
-
elsif section.match
|
139
|
+
elsif section.match regexp_required_params
|
128
140
|
#create a simple section catcher
|
129
141
|
@path << section_search
|
130
142
|
# add paramater recognition value
|
131
|
-
@fill_parameters[param_num += 1] = section.match(
|
132
|
-
|
133
|
-
# check for routes formatted: /:paramater{regexp} - required parameters
|
134
|
-
elsif section.match /^\:([^\(\)\{\}\:\/]*)\{(.*)\}$/
|
135
|
-
#create a simple section catcher
|
136
|
-
@path << ( "(\/(" + section.match(/^\:([^\(\)\{\}\:\/]*)\{(.*)\}$/)[2] + "))" )
|
137
|
-
# add paramater recognition value
|
138
|
-
@fill_parameters[param_num += 1] = section.match(/^\:([^\(\)\{\}\:\/]*)\{(.*)\}$/)[1]
|
139
|
-
param_num += 1 # we are using two spaces
|
143
|
+
@fill_parameters[param_num += 1] = section.match(regexp_required_params)[1]
|
140
144
|
|
141
145
|
# check for routes formatted: /(:paramater) - optional parameters
|
142
|
-
elsif section.match
|
146
|
+
elsif section.match regexp_optional_params
|
143
147
|
#create a optional section catcher
|
144
148
|
@path << optional_section_search
|
145
149
|
# add paramater recognition value
|
146
|
-
@fill_parameters[param_num += 1] = section.match(
|
150
|
+
@fill_parameters[param_num += 1] = section.match(regexp_optional_params)[1]
|
147
151
|
|
148
152
|
# check for routes formatted: /(:paramater){regexp} - optional parameters
|
149
|
-
elsif section.match
|
153
|
+
elsif section.match regexp_formatted_optional_params
|
150
154
|
#create a optional section catcher
|
151
|
-
@path << ( "(\/(" + section.match(
|
155
|
+
@path << ( "(\/(" + section.match(regexp_formatted_optional_params)[2] + "))?" )
|
156
|
+
# add paramater recognition value
|
157
|
+
@fill_parameters[param_num += 1] = section.match(regexp_formatted_optional_params)[1]
|
158
|
+
param_num += 1 # we are using two spaces - param_num += should look for () in regex ? /[^\\](/
|
159
|
+
|
160
|
+
# check for routes formatted: /:paramater{regexp} - required parameters
|
161
|
+
elsif section.match regexp_formatted_required_params
|
162
|
+
#create a simple section catcher
|
163
|
+
@path << ( "(\/(" + section.match(regexp_formatted_required_params)[2] + "))" )
|
164
|
+
# add paramater recognition value
|
165
|
+
@fill_parameters[param_num += 1] = section.match(regexp_formatted_required_params)[1]
|
166
|
+
param_num += 1 # we are using two spaces - param_num += should look for () in regex ? /[^\\](/
|
167
|
+
|
168
|
+
# check for routes formatted: /{regexp} - formated path
|
169
|
+
elsif section.match regexp_formatted_path
|
170
|
+
#create a simple section catcher
|
171
|
+
@path << ( "\/(" + section.match(regexp_formatted_path)[1] + ")" )
|
152
172
|
# add paramater recognition value
|
153
|
-
|
154
|
-
param_num += 1 # we are using two spaces
|
173
|
+
param_num += 1 # we are using one space - param_num += should look for () in regex ? /[^\\](/
|
155
174
|
|
156
175
|
else
|
157
176
|
@path << "\/"
|
@@ -232,11 +232,11 @@ module Plezi
|
|
232
232
|
# parse content
|
233
233
|
case @parser_data["content-type"].to_s
|
234
234
|
when /x-www-form-urlencoded/
|
235
|
-
HTTP.extract_data @parser_body.split(/[&;]/), @parser_data[:params], :uri
|
235
|
+
HTTP.extract_data @parser_body.split(/[&;]/), @parser_data[:params], :form # :uri
|
236
236
|
when /multipart\/form-data/
|
237
237
|
read_multipart @parser_data, @parser_body
|
238
238
|
when /text\/xml/
|
239
|
-
# to-do support xml?
|
239
|
+
# to-do support xml?
|
240
240
|
@parser_data[:body] = @parser_body.dup
|
241
241
|
when /application\/json/
|
242
242
|
@parser_data[:body] = @parser_body.dup
|
data/lib/plezi/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: plezi
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.7.
|
4
|
+
version: 0.7.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Boaz Segev
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-03-
|
11
|
+
date: 2015-03-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -133,7 +133,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
133
133
|
version: '0'
|
134
134
|
requirements: []
|
135
135
|
rubyforge_project:
|
136
|
-
rubygems_version: 2.4.
|
136
|
+
rubygems_version: 2.4.6
|
137
137
|
signing_key:
|
138
138
|
specification_version: 4
|
139
139
|
summary: The Ruby Framework for real time web-apps, with Websockets, REST and HTTP
|