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

我的开发板是EPC287

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

浏览器显示的错误是

502 Bad Gateway

The 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

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值