mcavage/node-restify — pull request #299 by nebhale (2013-01-18 11:15:24+00:00)
Title: GZip prevents Content-Length from being set

Currently the GZip plugin fails if the Content-Length header is set. To compensate for this, implementations of various plugins (static) and infrastructure (response) have to take this fact into account. The side-effect of this is that gzip knowledge isn't completely contained inside of the GZip plugin (poor isolation and cohesion). In addition, it means that any library used with restify (e.g. filed) must also take this fact into account. In reality they shouldn't have to and generally don't.

The better solution is that the GZip plugin needs to enforce the Content-Length header requirement itself and should not depend on other parts of the code to do it. To this end, the implementation now decorates the writeHead() function such that the Content-Length header is always removed. In addition, other references to gzip throughout the code have been removed as they are no longer needed.