51代码网ORACLEMYSQLSQL SERVER其它数据库java/jspasp/asp.netC/C++/VC++APP应用其它语言服务器应用
您现在的位置: 51代码网 >> 服务器 >> 文章正文

ubuntu的boa服务器,html页面上调用avcon_set()总是提示502 - Bad Gateway 错误

更新时间:2012-1-12:  来源:51代码网

我在ubuntu下架了一个boa的服务器
html页面上调用avcon_set()总是提示502 - Bad Gateway 错误。  

服务器的cgi-bin/admin下放了一个avconsetting.lua的服务本,内容为

#!/usr/bin/lua

print("succeed")
客户端js脚本如下:
function createxmlhttprequest(){

var xmlhttp=false;  

try{  

xmlhttp=new ActiveXObject("Msxm12.XMLHTTP");

}catch(e){  

try{  

xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");  

}  

catch(e){

try{  

xmlhttp=new XMLHttpRequest();

}catch(e){  
}   }   }  
return xmlhttp;  

}
function avcon_set()
{
var xmlhttp=createxmlhttprequest();  
//xmlhttp.responseXML;

xmlhttp.open("POST", "/cgi-bin/admin/avconsetting.lua", true);  

xmlhttp.onreadystatechange=function(){

if(xmlhttp.readyState==4){

if(xmlhttp.status==200){
alert("ok");

/*if (s==2 && unescape(xmlhttp.responseText) == "succeed"){

alert("succeed");

}else if(s !=2 || unescape(xmlhttp.responseText) == "failed"){

alert("failed");
}*/
}
else
{
alert("error:"+ xmlhttp.status + ":" + xmlhttp.statusText);
}}}
xmlhttp.send(null);  
}

html页面上调用avcon_set()总是提示502 - Bad Gateway 错误。

你可以试试在lua脚本前面加上 

io.write("Content-Type: text/plain\n\n")

对于CGI来说 Content-Type 是必不可少

  • 上一篇文章:
  • 下一篇文章: 没有了
  • 赞助商链接
    推荐文章
  • 此栏目下没有推荐文章
  • {
    设为首页 | 加入收藏 | 友情链接 | 网站地图 | 联系站长 |