puma 1.3.1 → 1.4.0

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.

@@ -1,3 +1,11 @@
1
+ === 1.4.0 / 2012-06-04
2
+
3
+ * 1 bug fix:
4
+ * SCRIPT_NAME should be passed from env to allow mounting apps
5
+
6
+ * 1 experimental feature:
7
+ * Add puma.socket key for direct socket access
8
+
1
9
  === 1.3.1 / 2012-05-15
2
10
 
3
11
  * 2 bug fixes:
data/README.md CHANGED
@@ -93,7 +93,7 @@ Puma comes with a builtin status/control app that can be used query and control
93
93
 
94
94
  $ puma --control tcp://127.0.0.1:9293 --control-token foo
95
95
 
96
- This directly puma to start the control server on localhost port 9293. Additionally, all requests to the control server will need to include `token=foo` as a query parameter. This allows for simple authentication. Check out https://github.com/puma/puma/blob/master/lib/puma/app/status.rb to see what the app has available.
96
+ This directs puma to start the control server on localhost port 9293. Additionally, all requests to the control server will need to include `token=foo` as a query parameter. This allows for simple authentication. Check out https://github.com/puma/puma/blob/master/lib/puma/app/status.rb to see what the app has available.
97
97
 
98
98
  ## Restart
99
99
 
@@ -120,7 +120,7 @@ If you start puma with `-S some/path` then you can pass that same path to the `p
120
120
 
121
121
  $ pumactl -S some/path restart
122
122
 
123
- will cause the server to perform a restart. `pumactl` is a simple CLI frontend to the contro/status app described above.
123
+ will cause the server to perform a restart. `pumactl` is a simple CLI frontend to the control/status app described above.
124
124
 
125
125
  ## License
126
126
 
@@ -25,7 +25,7 @@ module Puma
25
25
  # too taxing on performance.
26
26
  module Const
27
27
 
28
- PUMA_VERSION = VERSION = "1.3.1".freeze
28
+ PUMA_VERSION = VERSION = "1.4.0".freeze
29
29
 
30
30
  # The default number of seconds for another request within a persistent
31
31
  # session.
@@ -103,6 +103,7 @@ module Puma
103
103
  RACK_INPUT = "rack.input".freeze
104
104
  RACK_URL_SCHEME = "rack.url_scheme".freeze
105
105
  RACK_AFTER_REPLY = "rack.after_reply".freeze
106
+ PUMA_SOCKET = "puma.socket".freeze
106
107
 
107
108
  HTTP = "http".freeze
108
109
  HTTPS = "https".freeze
@@ -62,7 +62,7 @@ module Puma
62
62
  "rack.multithread".freeze => true,
63
63
  "rack.multiprocess".freeze => false,
64
64
  "rack.run_once".freeze => true,
65
- "SCRIPT_NAME".freeze => "",
65
+ "SCRIPT_NAME".freeze => ENV['SCRIPT_NAME'] || "",
66
66
 
67
67
  # Rack blows up if this is an empty string, and Rack::Lint
68
68
  # blows up if it's nil. So 'text/plain' seems like the most
@@ -398,6 +398,8 @@ module Puma
398
398
  def handle_request(env, client, body, cl)
399
399
  normalize_env env, client
400
400
 
401
+ env[PUMA_SOCKET] = client
402
+
401
403
  if cl
402
404
  body = read_body env, client, body, cl
403
405
  return false unless body
@@ -76,4 +76,25 @@ class TestPumaServer < Test::Unit::TestCase
76
76
 
77
77
  assert_equal "#{fifteen}#{fifteen}", data
78
78
  end
79
+
80
+ def test_puma_socket
81
+ body = "HTTP/1.1 750 Upgraded to Awesome\r\nDone: Yep!\r\n"
82
+ @server.app = proc do |env|
83
+ io = env['puma.socket']
84
+
85
+ io.write body
86
+
87
+ io.close
88
+
89
+ [-1, {}, []]
90
+ end
91
+
92
+ @server.add_tcp_listener @host, @port
93
+ @server.run
94
+
95
+ sock = TCPSocket.new @host, @port
96
+ sock << "PUT / HTTP/1.0\r\n\r\nHello"
97
+
98
+ assert_equal body, sock.read
99
+ end
79
100
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: puma
3
3
  version: !ruby/object:Gem::Version
4
- hash: 25
4
+ hash: 7
5
5
  prerelease:
6
6
  segments:
7
7
  - 1
8
- - 3
9
- - 1
10
- version: 1.3.1
8
+ - 4
9
+ - 0
10
+ version: 1.4.0
11
11
  platform: ruby
12
12
  authors:
13
13
  - Evan Phoenix
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2012-05-16 00:00:00 Z
18
+ date: 2012-06-04 00:00:00 Z
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
21
21
  name: rack
@@ -198,7 +198,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
198
198
  requirements: []
199
199
 
200
200
  rubyforge_project: puma
201
- rubygems_version: 1.8.18
201
+ rubygems_version: 1.8.22
202
202
  signing_key:
203
203
  specification_version: 3
204
204
  summary: Puma is a simple, fast, and highly concurrent HTTP 1.1 server for Ruby web applications