boa 用shell脚本编写cgi 访问时终端出现cgi_header: unable to find LFLF

来源:互联网 发布:网络协议测试 编辑:程序博客网 时间:2024/05/12 11:30

我的开发板是EPC287

我用shell脚本编写的cgi 运行后

浏览器显示的错误是

502 Bad Gateway

The CGI was not CGI/1.1 compliant。

终端显示的是

cgi_header: unable to find LFLF


但是用c语言编写的cgi却可以

找个一天终于找到了原因

还是shell的格式错了

附上调试成功的源码

#!/bin/bashPATH=/bin:/sbin:/usr/bin:/usr/sbinecho  -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

0 0
原创粉丝点击