Skip to content

Commit

Permalink
Fixed bug in last commit, updated tests to catch
Browse files Browse the repository at this point in the history
  • Loading branch information
mloughran committed Mar 4, 2013
1 parent aef8e06 commit e0217fd
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/em-websocket/masking04.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ def slice_mask
end

def getbyte(index)
if defined? @masking_key
if defined?(@masking_key) && @masking_key
masked_char = super
masked_char ? masked_char ^ @masking_key.getbyte(index % 4) : nil
else
Expand Down
2 changes: 2 additions & 0 deletions spec/unit/masking_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -23,5 +23,7 @@
t.getbyte(4).should == 0x03
t.read_mask
t.getbyte(4).should == 0x01
t.unset_mask
t.getbyte(4).should == 0x03
end
end

0 comments on commit e0217fd

Please sign in to comment.