免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 2081 | 回复: 1
打印 上一主题 下一主题

[WebServer] cgi出错问题,求高手指点 [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2013-06-07 20:36 |只看该作者 |倒序浏览
我在板子上移植了一个boa服务器和cgic库, 然后自己写了个cgi程序,调用接口,响应客户端的请求,可是一直调不通,老是出现这个错误:502 Bad Gateway
The CGI was not CGI/1.1 compliant.

查了一天,查不出问题,好烦躁啊。求高手指点一二。这是源码


#include <stdio.h>
#include "cgic.h"
#include <string.h>
#include <stdlib.h>
#include "sw.h"
#include "sw_ioctl.h"
#include "fal_mirror.h"
#include "fal_uk_if.h"

extern char *cgiQueryString;

int cgiMain()
{
        int ret = -1;
        int i=0;
        fal_port_t *dest_portid;
        fal_port_t src_ingress_portid=0;
        fal_port_t src_egress_portid=0;
        a_bool_t status;
        
        

cgiHeaderContentType("text/html");
fprintf(cgiOut, "<HTML><HEAD>\n");
  fprintf(cgiOut, "<TITLE></TITLE></HEAD>\n");
  
fprintf(cgiOut, "<BODY>\n");

  //显示目的端口
fal_mirr_analysis_port_get(0,dest_portid);

fprintf(cgiOut, "目的端口:");
  if((*dest_portid<2) || (*dest_portid>5))
  {
                   printf(" ");
  }
  else
  {
          printf("%d",*dest_portid);
  }
  

fprintf(cgiOut, "<br>\n");

  //显示源端入口
for(i=2; i<=6; i++)
{
         fal_mirr_port_in_get(0,i, &status);
         if(status == 1)
         {
                         src_ingress_portid = i;
                         break;
         }
}

  fprintf(cgiOut, "源端入口:");
if((dest_portid<2) || (dest_portid>5) || (src_ingress_portid==0))
  {
                   printf(" ");
  }
  else
  {
          printf("%d",src_ingress_portid);
  }
  

        fprintf(cgiOut, "<br>\n");
        
        
         //显示源端出口
        for(i=2; i<=6; i++)
{
         fal_mirr_port_eg_get(0,i, &status);
         if(status == 1)
         {
                         src_egress_portid = i;
                         break;
         }
}
        
         fprintf(cgiOut, "源端出口:");
         

if((dest_portid<2) || (dest_portid>5) || (src_ingress_portid==0))
  {
                   printf(" ");
  }
  else
  {
          printf("%d",src_egress_portid);
  }
  
        
fprintf(cgiOut, "</BODY>\n");
fprintf(cgiOut, "</HTML>\n");
  return 0;
}

论坛徽章:
0
2 [报告]
发表于 2013-06-07 21:28 |只看该作者
串口打印的错误信息是:cgi_header:unable to  find LFLF。 有没有高手能帮忙解决啊
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP