strelka 0.0.1.pre.290 → 0.0.1.pre.291

Sign up to get free protection for your applications and to get access to all the features.
data.tar.gz.sig CHANGED
Binary file
@@ -94,13 +94,13 @@ class Strelka::HTTPRequest < Mongrel2::HTTPRequest
94
94
  ### # => #<URI::HTTP:0x007fe34d16b2e0 URL:http://localhost:8080/user>
95
95
  def base_uri
96
96
  rval = self.uri
97
- rval.path = self.route
97
+ rval.path = self.headers.pattern
98
98
  rval.query = nil
99
99
  return rval
100
100
  end
101
101
 
102
102
 
103
- ### Return the portion of the Request's path that was routed by Mongrel2. This and the
103
+ ### Return the unescaped portion of the Request's path that was routed by Mongrel2. This and the
104
104
  ### #app_path make up the #path.
105
105
  ###
106
106
  ### # For a handler with a route of '/user', for the request:
@@ -108,20 +108,20 @@ class Strelka::HTTPRequest < Mongrel2::HTTPRequest
108
108
  ### request.route
109
109
  ### # => "/user"
110
110
  def route
111
- return self.headers.pattern
111
+ return URI.unescape( self.headers.pattern )
112
112
  end
113
113
  alias_method :pattern, :route
114
114
 
115
115
 
116
- ### Return the portion of the Request's path relative to the request's #route.
116
+ ### Return the unescaped portion of the Request's path relative to the request's #route.
117
117
  ###
118
118
  ### # For a handler with a route of '/user', for the request:
119
119
  ### # "GET /user/1/profile HTTP/1.1"
120
120
  ### request.app_path
121
121
  ### # => "/1/profile"
122
122
  def app_path
123
- rval = self.uri.path.dup
124
- rval.slice!( 0, self.route.length )
123
+ rval = URI.unescape( self.uri.path )
124
+ rval.slice!( 0, self.route.bytesize )
125
125
  return rval
126
126
  end
127
127
 
@@ -78,6 +78,33 @@ describe Strelka::HTTPRequest do
78
78
  end
79
79
 
80
80
 
81
+ context "instance with URI-escaped characters in its path" do
82
+
83
+ before( :each ) do
84
+ @req = @request_factory.get( '/directory/user%20info/ged%00' )
85
+ end
86
+
87
+ it "knows what the request's parsed URI is" do
88
+ @req.uri.should be_a( URI )
89
+ @req.uri.to_s.should == 'http://localhost:8080/directory/user%20info/ged%00'
90
+ end
91
+
92
+ it "knows what Mongrel2 route it followed" do
93
+ @req.pattern.should == "/directory"
94
+ end
95
+
96
+ it "knows what the URI of the route handling the request is" do
97
+ @req.base_uri.should be_a( URI )
98
+ @req.base_uri.to_s.should == 'http://localhost:8080/directory'
99
+ end
100
+
101
+ it "knows what the path of the request past its route is" do
102
+ @req.app_path.should == "/user info/ged\0"
103
+ end
104
+
105
+ end
106
+
107
+
81
108
  context "instance with a query string" do
82
109
 
83
110
  before( :each ) do
@@ -258,6 +258,11 @@ describe Strelka::Router::Default do
258
258
  @router.route_request( req ).should match_route( :as_pdf )
259
259
  end
260
260
 
261
+ it "doesn't route /foo%1B.pdf to the regexp action" do
262
+ req = @request_factory.get( "/user/foo%1B.pdf" )
263
+ @router.route_request( req ).should_not match_route( :as_pdf )
264
+ end
265
+
261
266
  it "routes /zanzibar.pdf to the regexp action" do
262
267
  req = @request_factory.get( '/user/zanzibar.pdf' )
263
268
  @router.route_request( req ).should match_route( :as_pdf )
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: strelka
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1.pre.290
4
+ version: 0.0.1.pre.291
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
metadata.gz.sig CHANGED
@@ -1 +1,2 @@
1
- ��L5i:��ռ݃ �'��l���As1�,ҳ� &M��d4��;2�] SbZϮ���`���-��j���� x��o"諈Ž'�H`Ǯz��~A��a 5�&L.�^3< c��߀�]5`k댩�H���p���U'����.4X'�u����A��]�#�\��J�&���q�&�ׯ�(?}2��K��F>Gp V��B������L� ��u�J�)r������l��weO�� ?
1
+ �-�)E9�c"�މx (���"Jh���~�y�'c+���u�38�`�f���Q6��yV����c�K��0��0Rb�Hk#��M����aޟ˗�6�!}��a��9IP���� U<���Y����a�ʑcf�ӱV6��g ��!�zؖ��o����7�Q޲��匋�>���N_Db��"�V bەD=�;�
2
+ �F*���\��f;�OeQK�?����l�g�ǔ;�@��+�Z}��e�;lM�