Skip to content

Commit

Permalink
Fix encoding issue in Ruby when native support not used. Closes GH-1763.
Browse files Browse the repository at this point in the history
The "backup" to the Ruby native support lib couldn't handle encodings
in the response body that didn't mix with UTF-8 (e.g. UTF-16), which
caused an error and a zero byte response body.
  • Loading branch information
Daniel Knoppel (Phusion) committed Mar 10, 2016
1 parent 4327693 commit 4a0e281
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 20 deletions.
1 change: 1 addition & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
Release 5.0.27
--------------

* Fix encoding issue for Ruby apps that resulted in a 0-byte response body. This occurred when the Ruby native support lib was not used and the app outputted an encoding that doesn't mix with UTF-8 (like UTF-16). Closes GH-1763.
* Support Debian GNU/kFreeBSD build. Based on contribution by stevenc99.
* Fix incomplete libuv upgrade: some build files were not autoregenerated during the upgrade from 1.5.0 to 1.8.0 in the previous release.
* Switch a number of places in the Passenger Core over to using the monotonic clock instead of the wallclock for robustness against clock time-stepping.
Expand Down
25 changes: 5 additions & 20 deletions src/ruby_supportlib/phusion_passenger/ruby_core_io_enhancements.rb
Original file line number Diff line number Diff line change
Expand Up @@ -61,32 +61,17 @@ def writev3(components, components2, components3)
end
else
def writev(components)
return write(components.join(''))
return write(components.pack('a*' * components.size))
end

def writev2(components, components2)
data = ''
components.each do |component|
data << component
end
components2.each do |component|
data << component
end
return write(data)
joined = components + components2
return write(joined.pack('a*' * joined.size))
end

def writev3(components, components2, components3)
data = ''
components.each do |component|
data << component
end
components2.each do |component|
data << component
end
components3.each do |component|
data << component
end
return write(data)
joined = components + components2 + components3
return write(joined.pack('a*' * joined.size))
end
end

Expand Down

0 comments on commit 4a0e281

Please sign in to comment.