Content-Length header is wrong
Closed this issue · 5 comments
der-flo commented
I'm getting an error from Rack::Lint:
ERROR Rack::Lint::LintError: Content-Length header was 599, but should be 261
My simple rackup file contains:
require 'rubygems'
require 'bundler/setup'
require 'rack-livereload'
use Rack::LiveReload
run Rack::Directory.new('.')
What I'm doing wrong? Do I misunderstand the middleware concept?
johnbintz commented
Do you get the same error with a basic Rack app, like say:
run lambda { |env| [ 200, {}, [ 'hi' ] ] }
der-flo commented
Your sample misses a content type. The following works:
use Rack::LiveReload
run lambda { |env| [ 200, { 'Content-Type' => 'text/html' }, [ '<html><head></head><body>hi</body></html>' ] ] }
I (think that I) need Rack::Directory
for reloading my static HTML files for a live HTML course. Other suggestions?
BTW: I think the difference in content length results from adding the js script tags.
afiore commented
Same problem here, I get the following message in the web server log:
!!Unexpected error while processing request: Content-Length header was 2175, but should be 1837
johnbintz commented
I was making a bad assumption about the returns from Rack apps, and that is now fixed. Take it for a spin.
der-flo commented
Jep, works perfectly!