lib/rack/sendfile.rb in rack-1.3.10 vs lib/rack/sendfile.rb in rack-1.4.0

- old
+ new

@@ -44,14 +44,15 @@ # proxy_set_header X-Accel-Mapping /var/www/=/files/; # # proxy_pass http://127.0.0.1:8080/; # } # - # Note that the X-Sendfile-Type header must be set exactly as shown above. The - # X-Accel-Mapping header should specify the internal URI path, followed by an - # equals sign (=), followed name of the location in the file system that it maps - # to. The middleware performs a simple substitution on the resulting path. + # Note that the X-Sendfile-Type header must be set exactly as shown above. + # The X-Accel-Mapping header should specify the location on the file system, + # followed by an equals sign (=), followed name of the private URL pattern + # that it maps to. The middleware performs a simple substitution on the + # resulting path. # # See Also: http://wiki.codemongers.com/NginxXSendfile # # === lighttpd # @@ -102,22 +103,23 @@ if body.respond_to?(:to_path) case type = variation(env) when 'X-Accel-Redirect' path = F.expand_path(body.to_path) if url = map_accel_path(env, path) + headers['Content-Length'] = '0' headers[type] = url body = [] else - env['rack.errors'] << "X-Accel-Mapping header missing" + env['rack.errors'].puts "X-Accel-Mapping header missing" end when 'X-Sendfile', 'X-Lighttpd-Send-File' path = F.expand_path(body.to_path) headers['Content-Length'] = '0' headers[type] = path body = [] when '', nil else - env['rack.errors'] << "Unknown x-sendfile variation: '#{variation}'.\n" + env['rack.errors'].puts "Unknown x-sendfile variation: '#{variation}'.\n" end end [status, headers, body] end