Project

General

Profile

Bug #7957 ยป unicorn_http.patch

proposed patch to unicorn - normalperson (Eric Wong), 02/25/2013 09:54 PM

View differences:

ext/unicorn_http/unicorn_http.rl
924 924
      assert(hp->s.dest_offset <= hp->offset &&
925 925
             "destination buffer overflow");
926 926
      advance_str(src, hp->offset);
927
      rb_str_set_len(dst, hp->s.dest_offset);
927

  
928
      if (0) {
929
        /*
930
         * the following should work, but raises:
931
         *  can't set length of shared string (RuntimeError)
932
         */
933
        rb_str_modify(dst);
934
        rb_str_set_len(dst, hp->s.dest_offset);
935
      } else {
936
        /* this does not raise */
937
        rb_str_resize(dst, hp->s.dest_offset);
938
      }
928 939

  
929 940
      if (RSTRING_LEN(dst) == 0 && chunked_eof(hp)) {
930 941
        assert(hp->len.chunk == 0 && "chunk at EOF but more to parse");