module Puma::Util
Constants
- DEFAULT_SEP
Public Class Methods
unescape(s, encoding = Encoding::UTF_8)
click to toggle source
# File lib/puma/util.rb, line 16 def unescape(s, encoding = Encoding::UTF_8) URI.decode_www_form_component(s, encoding) end
Public Instance Methods
nakayoshi_gc(events)
click to toggle source
@version 5.0.0
# File lib/puma/util.rb, line 27 def nakayoshi_gc(events) events.log "! Promoting existing objects to old generation..." 4.times { GC.start(full_mark: false) } if GC.respond_to?(:compact) events.log "! Compacting..." GC.compact end events.log "! Friendly fork preparation complete." end
parse_query(qs, d = nil, &unescaper)
click to toggle source
Stolen from Mongrel, with some small modifications: Parses a query string by breaking it up at the '&' and ';' characters. You can also use this to parse cookies by changing the characters used in the second parameter (which defaults to '&;').
# File lib/puma/util.rb, line 44 def parse_query(qs, d = nil, &unescaper) unescaper ||= method(:unescape) params = {} (qs || '').split(d ? /[#{d}] */n : DEFAULT_SEP).each do |p| next if p.empty? k, v = p.split('=', 2).map(&unescaper) if cur = params[k] if cur.class == Array params[k] << v else params[k] = [cur, v] end else params[k] = v end end params end
pipe()
click to toggle source
# File lib/puma/util.rb, line 9 def pipe IO.pipe end
Private Instance Methods
unescape(s, encoding = Encoding::UTF_8)
click to toggle source
# File lib/puma/util.rb, line 16 def unescape(s, encoding = Encoding::UTF_8) URI.decode_www_form_component(s, encoding) end