Skip to content

Commit

Permalink
Stomp content-length header should be in bytes (eventmachine#315)
Browse files Browse the repository at this point in the history
  • Loading branch information
ibc committed Apr 2, 2013
1 parent cb490f6 commit 457baa8
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions lib/em/protocols/stomp.rb
Original file line number Diff line number Diff line change
Expand Up @@ -104,12 +104,15 @@ def consume_line line

# @private
def send_frame verb, headers={}, body=""
body = body.to_s
ary = [verb, "\n"]
body_bytesize = body.bytesize if body.respond_to? :bytesize
body_bytesize ||= body.size
headers.each {|k,v| ary << "#{k}:#{v}\n" }
ary << "content-length: #{body.to_s.length}\n"
ary << "content-length: #{body_bytesize}\n"
ary << "content-type: text/plain; charset=UTF-8\n" unless headers.has_key? 'content-type'
ary << "\n"
ary << body.to_s
ary << body
ary << "\0"
send_data ary.join
end
Expand Down

0 comments on commit 457baa8

Please sign in to comment.