Why the Content-Type for *.jpg and *.JPG is different?

143 views
Skip to first unread message

Alexander Bolychev

unread,
Jan 28, 2014, 11:18:06 PM1/28/14
to mojol...@googlegroups.com
The Mojolicious::Lite app, serving static files from public:

HEAD http://127.0.0.1:3000/public/file.jpg
...
Content-Type: image/jpeg
...

HEAD http://127.0.0.1:3000/public/file.JPG
...
Content-Type: text/plain
...

sri

unread,
Feb 8, 2014, 4:25:45 PM2/8/14
to mojol...@googlegroups.com
HEAD http://127.0.0.1:3000/public/file.JPG
...
Content-Type: text/plain

Fixed in Mojolicious 4.78.

Btw. It would be nice if someone turned MIME::Types into a Mojolicious plugin that registers all types in existence with app->types. ;)

--
sebastian 

Stefan Adams

unread,
Feb 8, 2014, 6:38:12 PM2/8/14
to mojolicious

On Sat, Feb 8, 2014 at 3:25 PM, sri <kra...@googlemail.com> wrote:
Btw. It would be nice if someone turned MIME::Types into a Mojolicious plugin that registers all types in existence with app->types. ;)

Has anyone started this yet?

I've been looking for something to contribute.  Seems like something I could manage.

----------------------------------------------------------------
Keystone IT made the following notation
----------------------------------------------------------------
Email Confidentiality Notice: The information contained in this transmission is confidential, proprietary or privileged and may be subject to protection under the law, including the Health Insurance Portability and Accountability Act (HIPAA). 

This message is for the sole use of the intended individual or entity to whom it is addressed. If you are not the intended recipient, you are notified that any use, distribution or copying of the message is strictly prohibited and may subject you to criminal or civil penalties. If you received this transmission in error, please contact the sender immediately at (314) 621-9500 and delete the material from all computers.

Jonathan Otsuka

unread,
Feb 8, 2014, 6:43:49 PM2/8/14
to mojol...@googlegroups.com
No but I was looking at Mojo:Types recent and now interested in helping build this too  

Jonathan Otsuka
--
You received this message because you are subscribed to the Google Groups "Mojolicious" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mojolicious...@googlegroups.com.
To post to this group, send email to mojol...@googlegroups.com.
Visit this group at http://groups.google.com/group/mojolicious.
For more options, visit https://groups.google.com/groups/opt_out.

Stefan Adams

unread,
Mar 3, 2014, 11:05:56 AM3/3/14
to mojolicious
On Sat, Feb 8, 2014 at 3:25 PM, sri <kra...@googlemail.com> wrote:
Btw. It would be nice if someone turned MIME::Types into a Mojolicious plugin that registers all types in existence with app->types. ;)

I think this is done.  Much more simple than I expected, assuming I understood the request properly.


There's a test file in the package, too. But for a real world demonstration, see lines 14 and 21 of https://gist.github.com/s1037989/9328210

What should be done about conflicting types?  e.g. dwg is application/x-acad, image/x-dwg, and image/vnd.dwg

Keystone IT NOTICE:  This e-mail (including attachments) is covered by the Electronic Communications Privacy Act, 18 U.S.C. 2510-2521, is confidential and is legally privileged.  If you are not the intended recipient, you are hereby notified that the unauthorized use, in any way, of this communication is strictly prohibited.  If you have received this e-mail in error, please delete it immediately and call us at  (314) 621-9500 to correct the problem.

sri

unread,
Mar 6, 2014, 2:24:48 AM3/6/14
to mojol...@googlegroups.com
What should be done about conflicting types?  e.g. dwg is application/x-acad, image/x-dwg, and image/vnd.dwg

Stefan Adams

unread,
Mar 6, 2014, 4:30:35 PM3/6/14
to mojolicious

Thanks, sri! I'll do that!  Because alternatives are only used for detection, do all valid options need to be ordered in anyway?  That is, is it necessary that application/xml be listed before text/xml?

I trust then that everything else is OK with the plugin?

Oh, I didn't consider... What happens when you register a type that's already registered? That is, core registers xml and certainly the plugin does too. Is it important to skip already registered types, or, because it's running only on MIME::Types, it's just going to redefine it to the same thing so it doesn't matter that it redefines what what defined in core?

Stefan Adams

unread,
Feb 16, 2015, 7:49:03 PM2/16/15
to mojol...@googlegroups.com, ste...@cogentinnovators.com
I think I've addressed all these issues.  Multiple mime types per extension and a test file to go along with it.  Any suggestions welcome, but I think this is a final working product.  This is what you had in mind, right sri?

Brian Manning

unread,
Mar 2, 2015, 12:46:55 PM3/2/15
to mojol...@googlegroups.com


On Saturday, February 8, 2014 at 1:25:45 PM UTC-8, sri wrote:
Btw. It would be nice if someone turned MIME::Types into a Mojolicious plugin that registers all types in existence with app->types. ;)

Be careful; if you're looking to make/keep Mojolicious fat-packable (via App::FatPacker), the MIME::Types module creates a binary file called 'types.db' that is binary, and therefore not fatpackable.

You can get around the non-fatpacked MIME::Types database file by copying the binary 'types.db' file to the same directory as you run your fatpacked Mojolicious app from, but to me, that's kind of a pain.

The Dancer Advent calendar mentions this, which is where I found out about it.  Unfortunately, the main Dancer Advent calendar site is down right now, but here's the cached page from Google:


Thanks,

Brian

Reply all
Reply to author
Forward
0 new messages