我的开发板是EPC287
我用shell脚本编写的cgi 运行后
浏览器显示的错误是
502 Bad GatewayThe CGI was not CGI/1.1 compliant。
终端显示的是
cgi_header: unable to find LFLF
但是用c语言编写的cgi却可以
找个一天终于找到了原因
还是shell的格式错了
附上调试成功的源码
#!/bin/bash
PATH=/bin:/sbin:/usr/bin:/usr/sbin
echo -e "Content-type: text/html \n\n"
echo "<html>"
echo "<head>"
echo "<title>重启系统</title>"
echo "<meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\" />"
echo "</head>"
echo "<body>"
echo "<center>"
echo "<h3>重启系统</h3>"
echo "</center>"
echo "<hr>"
echo "<center>"
echo "<br><br>"
echo "<form action=\"/cgi-bin/doreboot.cgi\" method=POST>"
echo "<table>"
echo "<tr>"
echo "<td><input type=\"hidden\" name=\"time\" value=\"1\" ></td>"
echo "<td><input type=\"submit\" value="立即重启" ></td>"
echo "</tr>"
echo "</table>"
echo "</form>"
echo "</center>"
echo "</body>"
echo "</html>"
都是因为
echo -e "Content-type: text/html \n\n"
少了一个 -e