puma 2.12.1-java → 2.12.2-java
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of puma might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/History.txt +6 -0
- data/Manifest.txt +1 -0
- data/ext/puma_http11/org/jruby/puma/MiniSSL.java +5 -0
- data/lib/puma/const.rb +1 -1
- data/lib/puma/puma_http11.jar +0 -0
- data/lib/puma/rack/builder.rb +2 -0
- data/lib/puma/rack/urlmap.rb +90 -0
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 768be597d1e25adc921a6b075d6659aedcbf62ca
|
4
|
+
data.tar.gz: 6c7ee73f2b7d12e8243e366d81cbcdc804b562bf
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 13cd7a49bcdd098e9998b1d9e67155edfd21ff5f711c88aa26f1b3ee750b46922331ba1d0ae8704b6835a8b25df1a336ff970d7c953a2938ac7857ac3268bffe
|
7
|
+
data.tar.gz: 04b52e6c876d8762f1d899405438a2d3e8886a434343c0eb954ffc6b9a2a65b7ca5231663ed8d09b0d7c1b41382cb9ba2d0180ad1c9b09ddf67dbb20d39748d2
|
data/History.txt
CHANGED
data/Manifest.txt
CHANGED
data/lib/puma/const.rb
CHANGED
data/lib/puma/puma_http11.jar
CHANGED
Binary file
|
data/lib/puma/rack/builder.rb
CHANGED
@@ -290,6 +290,8 @@ module Puma::Rack
|
|
290
290
|
private
|
291
291
|
|
292
292
|
def generate_map(default_app, mapping)
|
293
|
+
require 'puma/rack/urlmap'
|
294
|
+
|
293
295
|
mapped = default_app ? {'/' => default_app} : {}
|
294
296
|
mapping.each { |r,b| mapped[r] = self.class.new(default_app, &b).to_app }
|
295
297
|
URLMap.new(mapped)
|
@@ -0,0 +1,90 @@
|
|
1
|
+
module Puma::Rack
|
2
|
+
# Rack::URLMap takes a hash mapping urls or paths to apps, and
|
3
|
+
# dispatches accordingly. Support for HTTP/1.1 host names exists if
|
4
|
+
# the URLs start with <tt>http://</tt> or <tt>https://</tt>.
|
5
|
+
#
|
6
|
+
# URLMap modifies the SCRIPT_NAME and PATH_INFO such that the part
|
7
|
+
# relevant for dispatch is in the SCRIPT_NAME, and the rest in the
|
8
|
+
# PATH_INFO. This should be taken care of when you need to
|
9
|
+
# reconstruct the URL in order to create links.
|
10
|
+
#
|
11
|
+
# URLMap dispatches in such a way that the longest paths are tried
|
12
|
+
# first, since they are most specific.
|
13
|
+
|
14
|
+
class URLMap
|
15
|
+
NEGATIVE_INFINITY = -1.0 / 0.0
|
16
|
+
INFINITY = 1.0 / 0.0
|
17
|
+
|
18
|
+
def initialize(map = {})
|
19
|
+
remap(map)
|
20
|
+
end
|
21
|
+
|
22
|
+
def remap(map)
|
23
|
+
@mapping = map.map { |location, app|
|
24
|
+
if location =~ %r{\Ahttps?://(.*?)(/.*)}
|
25
|
+
host, location = $1, $2
|
26
|
+
else
|
27
|
+
host = nil
|
28
|
+
end
|
29
|
+
|
30
|
+
unless location[0] == ?/
|
31
|
+
raise ArgumentError, "paths need to start with /"
|
32
|
+
end
|
33
|
+
|
34
|
+
location = location.chomp('/')
|
35
|
+
match = Regexp.new("^#{Regexp.quote(location).gsub('/', '/+')}(.*)", nil, 'n')
|
36
|
+
|
37
|
+
[host, location, match, app]
|
38
|
+
}.sort_by do |(host, location, _, _)|
|
39
|
+
[host ? -host.size : INFINITY, -location.size]
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
43
|
+
def call(env)
|
44
|
+
path = env['PATH_INFO']
|
45
|
+
script_name = env['SCRIPT_NAME']
|
46
|
+
hHost = env['HTTP_HOST']
|
47
|
+
sName = env['SERVER_NAME']
|
48
|
+
sPort = env['SERVER_PORT']
|
49
|
+
|
50
|
+
@mapping.each do |host, location, match, app|
|
51
|
+
unless casecmp?(hHost, host) \
|
52
|
+
|| casecmp?(sName, host) \
|
53
|
+
|| (!host && (casecmp?(hHost, sName) ||
|
54
|
+
casecmp?(hHost, sName+':'+sPort)))
|
55
|
+
next
|
56
|
+
end
|
57
|
+
|
58
|
+
next unless m = match.match(path.to_s)
|
59
|
+
|
60
|
+
rest = m[1]
|
61
|
+
next unless !rest || rest.empty? || rest[0] == ?/
|
62
|
+
|
63
|
+
env['SCRIPT_NAME'] = (script_name + location)
|
64
|
+
env['PATH_INFO'] = rest
|
65
|
+
|
66
|
+
return app.call(env)
|
67
|
+
end
|
68
|
+
|
69
|
+
[404, {'Content-Type' => "text/plain", "X-Cascade" => "pass"}, ["Not Found: #{path}"]]
|
70
|
+
|
71
|
+
ensure
|
72
|
+
env['PATH_INFO'] = path
|
73
|
+
env['SCRIPT_NAME'] = script_name
|
74
|
+
end
|
75
|
+
|
76
|
+
private
|
77
|
+
def casecmp?(v1, v2)
|
78
|
+
# if both nil, or they're the same string
|
79
|
+
return true if v1 == v2
|
80
|
+
|
81
|
+
# if either are nil... (but they're not the same)
|
82
|
+
return false if v1.nil?
|
83
|
+
return false if v2.nil?
|
84
|
+
|
85
|
+
# otherwise check they're not case-insensitive the same
|
86
|
+
v1.casecmp(v2).zero?
|
87
|
+
end
|
88
|
+
end
|
89
|
+
end
|
90
|
+
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: puma
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.12.
|
4
|
+
version: 2.12.2
|
5
5
|
platform: java
|
6
6
|
authors:
|
7
7
|
- Evan Phoenix
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-07-
|
11
|
+
date: 2015-07-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
requirement: !ruby/object:Gem::Requirement
|
@@ -146,6 +146,7 @@ files:
|
|
146
146
|
- lib/puma/rack/backports/uri/common_192.rb
|
147
147
|
- lib/puma/rack/backports/uri/common_193.rb
|
148
148
|
- lib/puma/rack/builder.rb
|
149
|
+
- lib/puma/rack/urlmap.rb
|
149
150
|
- lib/puma/rack_default.rb
|
150
151
|
- lib/puma/reactor.rb
|
151
152
|
- lib/puma/runner.rb
|