Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions lib/websocket/extensions/parser.rb
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ def self.parse_header(header)
if unquoted
data = unquoted
elsif quoted
data = quoted.gsub(/\\/, '')
data = quoted.gsub(/\\([\x00-\x7f])/, '\1')
else
data = true
end
Expand Down Expand Up @@ -66,8 +66,8 @@ def self.serialize_params(name, params)
when true then values.push(key)
when Numeric then values.push(key + '=' + value.to_s)
else
if value =~ NOTOKEN
values.push(key + '="' + value.gsub(/"/, '\"') + '"')
if value == '' or value =~ NOTOKEN
values.push(key + '="' + value.gsub(/["\\]/) { |char| '\\' + char } + '"')
else
values.push(key + '=' + value)
end
Expand Down