celluloid / reel

UNMAINTAINED: See celluloid/celluloid#779 - Celluloid::IO-powered web server
https://celluloid.io
MIT License
596 stars 87 forks source link

Pipelining Fix/Refactoring #73

Closed adstage-david closed 11 years ago

adstage-david commented 11 years ago

Did some refactoring and made it so the request parser can handle pipelining. This closes #69 and #55 and makes #56 obsolete.

All of the specs pass, and I've run most of the examples and they all seem to work as well as they do on master (Rackup handler examples seem to be broken on master?)

Cleanup Changes:

API Changes:

Parser Details:

The Reel::Request::Parser maintains an internal buffer of incoming requests still reading (if body hasn't been read in yet), one currently awaiting response, and a queue of requests to be responded to after the current request is handled. The underlying http parser calls the callbacks on this class when bytes buffered to it add to headers or body.

Reel::Request::Parser has #current_request, which will return the current request being read/responded to, or block and read from the raw socket until a full set of headers has been discovered and the body is ready to read.

coveralls commented 11 years ago

Coverage Status

Coverage increased (+0%) when pulling 607a696127fe355e59728648d9f293557a5a9c88 on adstage-david:pipeline_fix into 341b23fa23edd57e2698302cb8ac61f4aab34ed5 on celluloid:master.

coveralls commented 11 years ago

Coverage Status

Coverage increased (+0%) when pulling 8f0c5b882f20eba829f16c8d17a9c9e8299e0c2d on adstage-david:pipeline_fix into 341b23fa23edd57e2698302cb8ac61f4aab34ed5 on celluloid:master.

adstage-david commented 11 years ago

Thanks for the feedback - everything you mentioned should be fixed now.

coveralls commented 11 years ago

Coverage Status

Coverage increased (+0%) when pulling 8f0c5b882f20eba829f16c8d17a9c9e8299e0c2d on adstage-david:pipeline_fix into 341b23fa23edd57e2698302cb8ac61f4aab34ed5 on celluloid:master.

tarcieri commented 11 years ago

Looks good now, thanks! :thumbsup:

tarcieri commented 11 years ago

Looking over this again, I'm really not a fan of the callback-driven body API. I think that Reel should support a Body object that supports a #read/#readpartial-style API.

I already landed this and will be keeping it around, but I'll probably try to make that change today.

tarcieri commented 11 years ago

Okay, I see that API was my fault ;)