我正在尝试使用 lwIP 在我的 STM32 上运行 SSI 页面。当我打开一个 .html 页面时,一切都显示得很好。但是 .shtml 页面不会被渲染,只有源代码可见。
这篇文章引导我使用 wget 查找 mimetype:
$ wget http://192.168.15.12/index.html
--2021-12-23 22:32:10-- http://192.168.15.12/index.html
Connecting to 192.168.15.12:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: unspecified [text/html]
Saving to: ‘index.html’
index.html.1 [ <=> ] 1,92K --.-KB/s in 0,001s
2021-12-23 22:32:10 (3,29 MB/s) - ‘index.html’ saved [1971]
$ wget http://192.168.15.12/monitor.shtml
--2021-12-23 22:32:21-- http://192.168.15.12/monitor.shtml
Connecting to 192.168.15.12:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: unspecified [text/plain]
Saving to: ‘monitor.shtml’
monitor.shtml.1 [ <=> ] 1,92K --.-KB/s in 0,001s
2021-12-23 22:32:21 (2,03 MB/s) - ‘monitor.shtml’ saved [1965]
看来,shtml 的 mimetype 设置错误(text/plain
而不是text/html shtml
?)。
有谁知道如何纠正这个?
将元添加到 HTML 头部没有帮助:
<meta http-equiv="Content-Type" content="text/html shtml; charset=utf-8">
元内容类型似乎被忽略了......