libmagic을 사용하여 프로젝트의 웹 인터페이스에서 파일의 MIME 유형을 가져옵니다. 나는 css와 js 파일에 text/plain MIME 형식을 얻는다. 예를 들어 크롬libmagic. text/plain 대신 text/plain/javascript text/css
경고 아래 보여줍니다
Resource interpreted as Stylesheet but transferred with MIME type text/plain: "http://localhost:8000/jquery-ui.css".
Resource interpreted as Script but transferred with MIME type text/plain: "http://localhost:8000/jquery.timers.js".
HTTP를 대화
[email protected] ~ $ nc localhost 8000
GET /ui.css HTTP/1.1
HTTP/1.1 200 OK
Connection: close
Content-Length: 699
Content-Type: text/plain; charset=us-ascii
Date: Wed, 19 Sep 2012 11:41:48 GMT
...
어떻게이 문제를 해결할 수 있습니까?
을 * 왜 * libmagic을 사용합니까? .css 및 .js의 마임 유형은 잘 정의되어 있으므로 추측 할 필요가 없습니다 (libmagic이하는 것). –
다른 유형의 파일을 많이 사용합니다. 나는 그들의 마임 타입을 하드 코드하고 싶지 않다. –