Skip to content

Instantly share code, notes, and snippets.

@jordansissel
Created March 4, 2012 08:18

Revisions

  1. jordansissel created this gist Mar 4, 2012.
    19 changes: 19 additions & 0 deletions http_parser.diff
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,19 @@
    diff --git a/ext/ruby_http_parser/ruby_http_parser.c b/ext/ruby_http_parser/ruby_http_parser.c
    index 119d7e1..c2dd6ee 100644
    --- a/ext/ruby_http_parser/ruby_http_parser.c
    +++ b/ext/ruby_http_parser/ruby_http_parser.c
    @@ -319,10 +319,11 @@ VALUE Parser_execute(VALUE self, VALUE data) {
    wrapper->stopped = Qfalse;
    size_t nparsed = ryah_http_parser_execute(&wrapper->parser, &settings, ptr, len);

    - if (wrapper->parser.upgrade) {
    - rb_str_cat(wrapper->upgrade_data, ptr + nparsed, len - nparsed);
    + //if (wrapper->parser.upgrade) {
    + //rb_str_cat(wrapper->upgrade_data, ptr + nparsed, len - nparsed);

    - } else if (nparsed != (size_t)len) {
    + //} else
    + if (nparsed != (size_t)len) {
    if (!RTEST(wrapper->stopped) && !RTEST(wrapper->completed))
    rb_raise(eParserError, "Could not parse data entirely (%zu != %zu)", nparsed, len);
    else