Subject: | css content-type mishandling |
Date: | Wed, 11 Dec 2013 14:20:39 +0000 |
To: | bug-HTTP-Server-Simple-Static [...] rt.cpan.org |
From: | Richard Jones <ra.jones [...] hmds.org.uk> |
Some css files are returned as wrong content-type and cause browser to
open 'save as' dialog box instead of rendering.
Problem seems to be in serve_static(), where File::LibMagic
checktype_filename() returns 'text/x-asm; charset=us-ascii' in response
to certain css content:
perl -Mstrictures -MFile::LibMagic -E 'say
File::LibMagic->new->describe_filename("renderable.css")'
# ASCII text
perl -Mstrictures -MFile::LibMagic -E 'say
File::LibMagic->new->describe_filename("non_renderable.css")'
# assembler source, ASCII text
For a quick check, create css file (omit css comment) and run through
one-liner above:
p {
text-align: center; /* 2 spaces */
}
then edit that:
p {
text-align: center; /* tab */
}
Behaviour is apparent in HTTP-Server-Simple-Static v0.08 and v0.09.
v0.07 is OK.
--
Richard Jones