Created
March 2, 2016 13:08
-
-
Save trushkevich/cc5b87e3b6f440738441 to your computer and use it in GitHub Desktop.
fix passenger headers issue (for passenger 5)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module PhusionPassenger | |
module Utils | |
# Utility functions that can potentially be accelerated by native_support functions. | |
module NativeSupportUtils | |
extend self | |
NULL = "\0".freeze | |
class ProcessTimes < Struct.new(:utime, :stime) | |
end | |
def split_by_null_into_hash(data) | |
args = data.split(NULL, -1) | |
args.pop | |
headers_hash = Hash.new | |
args.each_slice(2).to_a.each do |pair| | |
headers_hash[pair.first] = pair.last unless headers_hash.keys.include? pair.first | |
end | |
return headers_hash | |
end | |
def process_times | |
times = Process.times | |
return ProcessTimes.new((times.utime * 1_000_000).to_i, | |
(times.stime * 1_000_000).to_i) | |
end | |
end | |
end # module Utils | |
end # module PhusionPassenger |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment