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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 7dc44ef6aaeda70b87da03a15bd5b9bd3abd35d6
4
- data.tar.gz: 64d3be4eb9cbffa1e417c29d561553e2198dcb17
3
+ metadata.gz: 768be597d1e25adc921a6b075d6659aedcbf62ca
4
+ data.tar.gz: 6c7ee73f2b7d12e8243e366d81cbcdc804b562bf
5
5
  SHA512:
6
- metadata.gz: 0d3e867cae3b8c665ae63153d5a47b77f9457f81461976abe27bd9cb82902ba1e68203f8ac4f3dcc3ac7002583f9dc2609b5fce32751f3a85e73f7dd8459591c
7
- data.tar.gz: 2d131676d9f81752d5e47af4d643b5e2a5e7ff4c38db02a1e5fa2f9edb27e36c2c725ae38571316bd6ebeae319960846b295a9cd230caff6521f51b80372e112
6
+ metadata.gz: 13cd7a49bcdd098e9998b1d9e67155edfd21ff5f711c88aa26f1b3ee750b46922331ba1d0ae8704b6835a8b25df1a336ff970d7c953a2938ac7857ac3268bffe
7
+ data.tar.gz: 04b52e6c876d8762f1d899405438a2d3e8886a434343c0eb954ffc6b9a2a65b7ca5231663ed8d09b0d7c1b41382cb9ba2d0180ad1c9b09ddf67dbb20d39748d2
data/History.txt CHANGED
@@ -1,3 +1,9 @@
1
+ === 2.12.2 / 2015-07-17
2
+
3
+ * 2 bug fix:
4
+ * Pull over and use Rack::URLMap. Fixes #741
5
+ * Stub out peercert on JRuby for now. Fixes #739
6
+
1
7
  === 2.12.1 / 2015-07-16
2
8
 
3
9
  * 2 bug fixes:
data/Manifest.txt CHANGED
@@ -53,6 +53,7 @@ lib/puma/rack/backports/uri/common_18.rb
53
53
  lib/puma/rack/backports/uri/common_192.rb
54
54
  lib/puma/rack/backports/uri/common_193.rb
55
55
  lib/puma/rack/builder.rb
56
+ lib/puma/rack/urlmap.rb
56
57
  lib/puma/rack_default.rb
57
58
  lib/puma/reactor.rb
58
59
  lib/puma/runner.rb
@@ -384,4 +384,9 @@ public class MiniSSL extends RubyObject {
384
384
  throw new RuntimeException(e);
385
385
  }
386
386
  }
387
+
388
+ @JRubyMethod
389
+ public IRubyObject peercert() {
390
+ return getRuntime().getNil();
391
+ }
387
392
  }
data/lib/puma/const.rb CHANGED
@@ -99,7 +99,7 @@ module Puma
99
99
  # too taxing on performance.
100
100
  module Const
101
101
 
102
- PUMA_VERSION = VERSION = "2.12.1".freeze
102
+ PUMA_VERSION = VERSION = "2.12.2".freeze
103
103
  CODE_NAME = "Plutonian Photo Shoot".freeze
104
104
 
105
105
  FAST_TRACK_KA_TIMEOUT = 0.2
Binary file
@@ -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.1
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-16 00:00:00.000000000 Z
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