File tree Expand file tree Collapse file tree 3 files changed +7
-8
lines changed Expand file tree Collapse file tree 3 files changed +7
-8
lines changed Original file line number Diff line number Diff line change 1
1
Changelog
2
2
=========
3
3
4
+ Bugfixes
5
+
6
+ - Fixed a js parser error that could result in a timeout ([ @BridgeAR ] ( https://github.com/BridgeAR ) )
7
+
4
8
## v.2.2.5 - 18 Oct, 2015
5
9
6
10
Bugfixes
Original file line number Diff line number Diff line change @@ -117,9 +117,7 @@ JavascriptReplyParser.prototype.execute = function (buffer) {
117
117
offset = this . _offset - 1 ;
118
118
119
119
this . send_reply ( this . _parseResult ( type ) ) ;
120
- } else if ( type === 10 || type === 13 ) {
121
- break ;
122
- } else {
120
+ } else if ( type !== 10 && type !== 13 ) {
123
121
var err = new Error ( 'Protocol error, got "' + String . fromCharCode ( type ) + '" as reply type byte' ) ;
124
122
this . send_error ( err ) ;
125
123
}
Original file line number Diff line number Diff line change @@ -55,7 +55,7 @@ describe('parsers', function () {
55
55
return done ( ) ;
56
56
} ) ;
57
57
58
- it ( 'line breaks in the beginning' , function ( done ) {
58
+ it ( 'line breaks in the beginning of the last chunk ' , function ( done ) {
59
59
var parser = new Parser ( ) ;
60
60
var reply_count = 0 ;
61
61
function check_reply ( reply ) {
@@ -68,10 +68,7 @@ describe('parsers', function () {
68
68
parser . execute ( new Buffer ( '*1\r\n*1\r\n$1\r\na' ) ) ;
69
69
70
70
parser . execute ( new Buffer ( '\r\n*1\r\n*1\r' ) ) ;
71
- parser . execute ( new Buffer ( '\n$1\r\na\r\n' ) ) ;
72
-
73
- parser . execute ( new Buffer ( '*1\r\n*1\r\n' ) ) ;
74
- parser . execute ( new Buffer ( '$1\r\na\r\n' ) ) ;
71
+ parser . execute ( new Buffer ( '\n$1\r\na\r\n*1\r\n*1\r\n$1\r\na\r\n' ) ) ;
75
72
76
73
assert . equal ( reply_count , 3 , "check reply should have been called three times" ) ;
77
74
return done ( ) ;
You can’t perform that action at this time.
0 commit comments