shimaore/esl

Parser Exception

afshin2003 opened this issue · 6 comments

Hi shimaore,
Would you help me on this:

Best,
Afshin

/opt/opxi2/node_modules/esl/lib/parser.js:47
header_end = this.buffer.indexOf('\n\n');
^
TypeError: Object Content-Type: auth/request

has no method 'indexOf'
at FreeSwitchParser.module.exports.FreeSwitchParser.capture_headers (/opt/opxi2/node_modules/esl/lib/parser.js:47:32)
at FreeSwitchParser.module.exports.FreeSwitchParser.on_data (/opt/opxi2/node_modules/esl/lib/parser.js:69:21)
at FreeSwitchClient. (/opt/opxi2/node_modules/esl/lib/parser.js:17:24)
at FreeSwitchClient.emit (events.js:95:17)
at FreeSwitchClient. (stream_readable.js:765:14)
at FreeSwitchClient.emit (events.js:92:17)
at emitReadable
(_stream_readable.js:427:10)
at emitReadable (_stream_readable.js:423:5)
at readableAddChunk (_stream_readable.js:166:9)
at FreeSwitchClient.Readable.push (_stream_readable.js:128:10)
at TCP.onread (net.js:529:21)

@afshin2003 this was introduced in Node.js 1.5.0, you probably need to upgrade Node.js.
(And I probably need to document this in package.json as well.)

Hi,
Since what version it requires Nodejs 1.5.0 ? And How can I build your project from the source? :)

npm install
???
Afshin

The reference to indexOf was introduced in 44b45e2 so it's recent (esl 4.1.0).
Yes, npm install should work, npm run-script prepublish is actually what builds.

Well actually, what happened in 44b45e2 is that the parser's buffer was changed from a string to an actual Buffer object. So the dependency was introduced because of that change (esl has always been using indexOf but it was on a string, which is standard JS). I missed the fact that Buffer::indexOf was only introduced recently.

Many thanks

On Tue, 3 Nov 2015 at 21:36, Stéphane Alnet notifications@github.com
wrote:

The reference to indexOf was introduced in 44b45e2
44b45e2
so it's recent (esl 4.1.0).
Yes, npm install should work, npm run-script prepublish is actually what
builds.


Reply to this email directly or view it on GitHub
#30 (comment).

I understand. It would be nice if you could somehow remove this dependency.

On Tue, 3 Nov 2015 at 21:50, Stéphane Alnet notifications@github.com
wrote:

Well actually, what happened in 44b45e2
44b45e2
is that the parser's buffer was changed from a string to an actual Buffer
object. So the dependency was introduced because of that change (esl has
always been using indexOf but it was on a string, which is standard JS).
I missed the fact that Buffer::indexOf was only introduced recently.


Reply to this email directly or view it on GitHub
#30 (comment).