rack/rack — pull request #560 by mattwildig (2013-05-20 23:13:42+00:00)
Title: Make Rack::Static custom headers thread safe

See #558.

In addition to manipulating the instance var of the `Rack::File` instance, `Rack::Static` was using an instance var, `@path`, to pass the request path around, which was another source of thread un-safety.

After fixing the two issues, this code is starting to look a bit unwieldy with the parameter lists getting long. Another approach might be to have another method `_call(env)` and use the `dup._call(env)` idiom in order to make use of instance vars. Any preferences on this?

I haven’t added any tests for this – I don’t know how to go about adding tests for threading issues like this. Any ideas? All existing tests are passing (except for two dealing with the `X-Accel-Redirect ` header which are failing on master on my machine as well).

---
* Do not manipulate instance variables of Rack::File, add new headers
after return from the file server.

* Do not use instance variable to store path, use local vars and params
instead.

Fixes #558