Module: HTTPX::Plugins::Cookies::Cookie::Scanner

Defined in:
lib/httpx/plugins/cookies/cookie.rb

Constant Summary collapse

RE_BAD_CHAR =
/([\x00-\x20\x7F",;\\])/.freeze

Class Method Summary collapse

Class Method Details

.quote(s) ⇒ Object



166
167
168
169
170
# File 'lib/httpx/plugins/cookies/cookie.rb', line 166

def quote(s)
  return s unless s.match(RE_BAD_CHAR)

  "\"#{s.gsub(/([\\"])/, "\\\\\\1")}\""
end