puma 5.6.0-java → 5.6.1-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
  SHA256:
3
- metadata.gz: 1c9604a002b072d351254eef56c4cc52bc7ac1c73750546f0408a7bd21f91705
4
- data.tar.gz: 24919b065100d37b1f43b7465a9464e6b5492a0256d7880ea6f519a482deafe5
3
+ metadata.gz: 13ee538038db45a4708423f03dfd2d8ac9fdd8739ef69ea6f06dd627fbfd9430
4
+ data.tar.gz: cac82e9c940c2f2647cbc9f54c993f517540144676100f719f805f19923036c5
5
5
  SHA512:
6
- metadata.gz: ab900da240f92390b6f4235bef4f0358cc03d13cb795b44c878d9b96d0ea2865d35419cbe8c31f2fc18cb272b9df716273959391b85a6455aaebdadd03b2922b
7
- data.tar.gz: 2daeb82d068ebd639a27699f670df828417069eba86fb3c4c599371898079cafcae7c0d5ac7256b562b8b0629f4e236ff9e62a17efc80ba0c00fca8ca3cfcae8
6
+ metadata.gz: a0b49f62e5e77305256fae6c69ca95d7c945c8622c2a66568e6a32cab6514d0b63a2526a567893a845cee0dabd3348805c5af183eca8b95c2f1a389f7438f05b
7
+ data.tar.gz: 9e816311e715873f136fa2095a65d0bfacd039af7200aef684c48c1ce78aedf1cf499ca3722a02866964acfc58a801845ff19326ad4ea53b91582fcbafac68a3
data/History.md CHANGED
@@ -1,3 +1,8 @@
1
+ ## 5.6.1 / 2022-01-26
2
+
3
+ * Bugfixes
4
+ * Reverted a commit which appeared to be causing occasional blank header values ([#2809])
5
+
1
6
  ## 5.6.0 / 2022-01-25
2
7
 
3
8
  * Features
@@ -1830,6 +1835,7 @@ be added back in a future date when a java Puma::MiniSSL is added.
1830
1835
  * Bugfixes
1831
1836
  * Your bugfix goes here <Most recent on the top, like GitHub> (#Github Number)
1832
1837
 
1838
+ [#2809]:https://github.com/puma/puma/pull/2809 "PR by @dentarg, merged 2022-01-26"
1833
1839
  [#2764]:https://github.com/puma/puma/pull/2764 "PR by @dentarg, merged 2022-01-18"
1834
1840
  [#2708]:https://github.com/puma/puma/issues/2708 "Issue by @erikaxel, closed 2022-01-18"
1835
1841
  [#2780]:https://github.com/puma/puma/pull/2780 "PR by @dalibor, merged 2022-01-01"
data/lib/puma/const.rb CHANGED
@@ -100,7 +100,7 @@ module Puma
100
100
  # too taxing on performance.
101
101
  module Const
102
102
 
103
- PUMA_VERSION = VERSION = "5.6.0".freeze
103
+ PUMA_VERSION = VERSION = "5.6.1".freeze
104
104
  CODE_NAME = "Birdie's Version".freeze
105
105
 
106
106
  PUMA_SERVER_STRING = ['puma', PUMA_VERSION, CODE_NAME].join(' ').freeze
Binary file
data/lib/puma/request.rb CHANGED
@@ -46,7 +46,11 @@ module Puma
46
46
  env[HIJACK_P] = true
47
47
  env[HIJACK] = client
48
48
 
49
- env[RACK_INPUT] = client.body
49
+ body = client.body
50
+
51
+ head = env[REQUEST_METHOD] == HEAD
52
+
53
+ env[RACK_INPUT] = body
50
54
  env[RACK_URL_SCHEME] ||= default_server_port(env) == PORT_443 ? HTTPS : HTTP
51
55
 
52
56
  if @early_hints
@@ -65,58 +69,36 @@ module Puma
65
69
  # A rack extension. If the app writes #call'ables to this
66
70
  # array, we will invoke them when the request is done.
67
71
  #
68
- env[RACK_AFTER_REPLY] = []
72
+ after_reply = env[RACK_AFTER_REPLY] = []
69
73
 
70
74
  begin
71
- status, headers, res_body = @thread_pool.with_force_shutdown do
72
- @app.call(env)
73
- end
74
-
75
- return :async if client.hijacked
76
-
77
- status = status.to_i
78
-
79
- if status == -1
80
- unless headers.empty? and res_body == []
81
- raise "async response must have empty headers and body"
75
+ begin
76
+ status, headers, res_body = @thread_pool.with_force_shutdown do
77
+ @app.call(env)
82
78
  end
83
79
 
84
- return :async
85
- end
86
- rescue ThreadPool::ForceShutdown => e
87
- @events.unknown_error e, client, "Rack app"
88
- @events.log "Detected force shutdown of a thread"
89
-
90
- status, headers, res_body = lowlevel_error(e, env, 503)
91
- rescue Exception => e
92
- @events.unknown_error e, client, "Rack app"
80
+ return :async if client.hijacked
93
81
 
94
- status, headers, res_body = lowlevel_error(e, env, 500)
95
- end
82
+ status = status.to_i
96
83
 
97
- write_response(status, headers, res_body, lines, requests, client)
98
- end
84
+ if status == -1
85
+ unless headers.empty? and res_body == []
86
+ raise "async response must have empty headers and body"
87
+ end
99
88
 
100
- # Does the actual response writing for Request#handle_request and Server#client_error
101
- #
102
- # @param status [Integer] the status returned by the Rack application
103
- # @param headers [Hash] the headers returned by the Rack application
104
- # @param res_body [Array] the body returned by the Rack application
105
- # @param lines [Puma::IOBuffer] modified in place
106
- # @param requests [Integer] number of inline requests handled
107
- # @param client [Puma::Client]
108
- # @return [Boolean,:async]
109
- def write_response(status, headers, res_body, lines, requests, client)
110
- env = client.env
111
- io = client.io
89
+ return :async
90
+ end
91
+ rescue ThreadPool::ForceShutdown => e
92
+ @events.unknown_error e, client, "Rack app"
93
+ @events.log "Detected force shutdown of a thread"
112
94
 
113
- return false if closed_socket?(io)
114
- lines.clear
95
+ status, headers, res_body = lowlevel_error(e, env, 503)
96
+ rescue Exception => e
97
+ @events.unknown_error e, client, "Rack app"
115
98
 
116
- head = env[REQUEST_METHOD] == HEAD
117
- after_reply = env[RACK_AFTER_REPLY] || []
99
+ status, headers, res_body = lowlevel_error(e, env, 500)
100
+ end
118
101
 
119
- begin
120
102
  res_info = {}
121
103
  res_info[:content_length] = nil
122
104
  res_info[:no_body] = head
@@ -167,9 +149,9 @@ module Puma
167
149
  res_body.each do |part|
168
150
  next if part.bytesize.zero?
169
151
  if chunked
170
- fast_write io, (part.bytesize.to_s(16) << line_ending)
171
- fast_write io, part # part may have different encoding
172
- fast_write io, line_ending
152
+ fast_write io, (part.bytesize.to_s(16) << line_ending)
153
+ fast_write io, part # part may have different encoding
154
+ fast_write io, line_ending
173
155
  else
174
156
  fast_write io, part
175
157
  end
@@ -187,7 +169,7 @@ module Puma
187
169
  ensure
188
170
  uncork_socket io
189
171
 
190
- client.body.close if client.body
172
+ body.close
191
173
  client.tempfile.unlink if client.tempfile
192
174
  res_body.close if res_body.respond_to? :close
193
175
 
data/lib/puma/server.rb CHANGED
@@ -476,7 +476,7 @@ module Puma
476
476
  end
477
477
  true
478
478
  rescue StandardError => e
479
- client_error(e, client, buffer, requests)
479
+ client_error(e, client)
480
480
  # The ensure tries to close +client+ down
481
481
  requests > 0
482
482
  ensure
@@ -504,36 +504,34 @@ module Puma
504
504
  # :nocov:
505
505
 
506
506
  # Handle various error types thrown by Client I/O operations.
507
- def client_error(e, client, buffer = ::Puma::IOBuffer.new, requests = 1)
507
+ def client_error(e, client)
508
508
  # Swallow, do not log
509
509
  return if [ConnectionError, EOFError].include?(e.class)
510
510
 
511
+ lowlevel_error(e, client.env)
511
512
  case e
512
513
  when MiniSSL::SSLError
513
514
  @events.ssl_error e, client.io
514
515
  when HttpParserError
515
- status, headers, res_body = lowlevel_error(e, client.env, 400)
516
- write_response(status, headers, res_body, buffer, requests, client)
516
+ client.write_error(400)
517
517
  @events.parse_error e, client
518
518
  else
519
- status, headers, res_body = lowlevel_error(e, client.env)
520
- write_response(status, headers, res_body, buffer, requests, client)
519
+ client.write_error(500)
521
520
  @events.unknown_error e, nil, "Read"
522
521
  end
523
522
  end
524
523
 
525
524
  # A fallback rack response if +@app+ raises as exception.
526
525
  #
527
- def lowlevel_error(e, env, status = 500)
526
+ def lowlevel_error(e, env, status=500)
528
527
  if handler = @options[:lowlevel_error_handler]
529
528
  if handler.arity == 1
530
- handler_status, headers, res_body = handler.call(e)
529
+ return handler.call(e)
531
530
  elsif handler.arity == 2
532
- handler_status, headers, res_body = handler.call(e, env)
531
+ return handler.call(e, env)
533
532
  else
534
- handler_status, headers, res_body = handler.call(e, env, status)
533
+ return handler.call(e, env, status)
535
534
  end
536
- return [handler_status || status, headers || {}, res_body || []]
537
535
  end
538
536
 
539
537
  if @leak_stack_on_error
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: puma
3
3
  version: !ruby/object:Gem::Version
4
- version: 5.6.0
4
+ version: 5.6.1
5
5
  platform: java
6
6
  authors:
7
7
  - Evan Phoenix