module Puma::Util
def escape(s, encoding = Encoding::UTF_8)
def escape(s, encoding = Encoding::UTF_8) URI.encode_www_form_component(s, encoding) end
def escape(s, encoding = nil)
def escape(s, encoding = nil) URI.encode_www_form_component(s, encoding) end
def parse_query(qs, d = nil, &unescaper)
cookies by changing the characters used in the second
and ';' characters. You can also use this to parse
Parses a query string by breaking it up at the '&'
Stolen from Mongrel, with some small modifications:
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
def pipe
def pipe IO.pipe end
def purge_interrupt_queue
which currently effects some older versions of Ruby: 2.2.7 2.2.8 2.2.9 2.2.10 2.3.4 2.4.1
An instance method on Thread has been provided to address https://bugs.ruby-lang.org/issues/13632,
def purge_interrupt_queue Thread.current.purge_interrupt_queue if Thread.current.respond_to? :purge_interrupt_queue end
def unescape(s, encoding = Encoding::UTF_8)
def unescape(s, encoding = Encoding::UTF_8) URI.decode_www_form_component(s, encoding) end
def unescape(s, encoding = nil)
def unescape(s, encoding = nil) URI.decode_www_form_component(s, encoding) end