creationix/http-parser-js

not works with chunk data

Closed this issue · 4 comments

it will be broken with chunk data

As of #2 some support for chunked data was added, and I believe is actively used for parsing chunked responses (e.g. when used with http.get). It's possible that parsing chunked requests (e.g. when used with http.createServer) isn't supported, is that what you're trying to do?

More details or an example or, even better, a pull request would be ideal.

Let me explain my scenario: i use it parse http based network traffic, that means every http request i will pass to http-parser-js.

and the exception is i found lots of exception at: line 111:
var line = this.chunk.toString("ascii", this.captureStart, this.captureEnd);
exception is: captureEnd should be greater than captureStart

After further checking, i think it's not related with chunk response, maybe it's caused by tcp segment of http request, i checked with wireshark, find i have lots of TCP segment of a reassembled PDU, each time when the request arrive, i found the http-request is separate to more than one chunk

This is probably fixed in 0.3.0. Can you update and try to reproduce again, @junhui?

I think his conclusion was that it wasn't a http parser issue, but the issue was he was trying to parse a tcp fragment which only included part of an http request, which probably isn't going to work. I'm going to mark this closed, but feel free to re-open it with more details if there's something you think there's something wrong or something this module could help with.