Skip Menu |

This queue is for tickets about the HTTP-Server-Simple-Static CPAN distribution.

Report information
The Basics
Id: 91321
Status: resolved
Priority: 0/
Queue: HTTP-Server-Simple-Static

People
Owner: Nobody in particular
Requestors: ra.jones [...] hmds.org.uk
Cc: ribasushi [...] leporine.io
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: 0.10



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
My 2c on this - for some type of file *extensions*, in particular .htm(l), .css, .txt it seems utterly counterproductive to rely on the (inherently imprecise) LibMagic approach. There ought to be an "assumed content type" for a small set of filenames.
On Wed Dec 11 11:18:56 2013, RIBASUSHI wrote: Show quoted text
> My 2c on this - for some type of file *extensions*, in particular > .htm(l), .css, .txt it seems utterly counterproductive to rely on the > (inherently imprecise) LibMagic approach. There ought to be an > "assumed content type" for a small set of filenames.
I think that is an excellent suggestion. I'll have a think about the best approach and hopefully push out an update fairly soon. Stephen Quinney
This was fixed in version 0.10. Regards, Stephen Quinney On Wed Dec 11 11:30:02 2013, SJQUINNEY wrote: Show quoted text
> On Wed Dec 11 11:18:56 2013, RIBASUSHI wrote:
> > My 2c on this - for some type of file *extensions*, in particular > > .htm(l), .css, .txt it seems utterly counterproductive to rely on the > > (inherently imprecise) LibMagic approach. There ought to be an > > "assumed content type" for a small set of filenames.
> > I think that is an excellent suggestion. I'll have a think about the > best approach and hopefully push out an update fairly soon. > > > Stephen Quinney