celluloid / reel

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

Reel::Response.new modifies callers body_or_headers headers hash #81

Closed CootCraig closed 11 years ago

CootCraig commented 11 years ago

In particular

https://github.com/celluloid/reel/blob/master/lib/reel/response.rb#L29

sets CONTENT_LENGTH, which is then not modified on subsequent responses.

A proposed fix is a change to

https://github.com/celluloid/reel/blob/master/lib/reel/response.rb#L20

headers = {}.merge body_or_headers

This will cause the setting of CONTENT_LENGTH to be local to this response.

This gist has a test script with notes:

https://gist.github.com/CootCraig/6395964