From: "Iñaki Baz Castillo" Date: 2011-08-23T05:36:43+09:00 Subject: Re: Possble bug in Ruby parser (Fixnum#times within "case" statement) 2011/8/22 Ryan Davis : >> It's much more complex than your code which cannot work in a real TCP >> server in which nobody can expect to receive the entire protocol >> message in a single TCP package. > > There is nothing in my code __example__ that implies that you receive the entire payload. You're inferring that on your own. The complexity you introduce at the level you do it at is unnecessary. Your code calls get_body() after the function parse_headers(), in any case: def receive_data(data) @buffer << data @parser.reset @parser_nbytes = 0 parse_headers get_body process_request end Why should you call get_body() when maybe parse_header() method has not finished receiving all the headers? -- Iñaki Baz Castillo