lpereira / lwan

Experimental, scalable, high performance HTTP server
https://lwan.ws
GNU General Public License v2.0
5.94k stars 548 forks source link

mime type is detected wrongly for js #159

Closed Mandar12 closed 8 years ago

Mandar12 commented 8 years ago

For extension ".js" mime type is supposed to be "application/javascript" but lwan_determine_mime_type_for_file_name function returns "application/octet-stream". The enum value of EXT_JS is 0x00736a2e but switch statement evaluates to 0x20736a2e. This is expected as we are doing bitwise OR with 0x20202020. To fix we can change EXT_JS to 0x20736a2e. I am attaching unit test which fails for current code and passes after proposed change. test_mime_type.c.txt

lpereira commented 8 years ago

This was working purely by chance before, since the slow path using bsearch() used to include the MIME type for JavaScript files. Thanks for noticing this. Should be fixed now.