免费注册 查看新帖 |

Chinaunix

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

[WebServer] 调试 CGI+BOA的时候,出现cgi_header错误,啥意思啊? [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2012-05-07 16:42 |只看该作者 |倒序浏览
我也是按照网上的知道手册步骤来的,能访问静态网页,但我测试CGI程序的时候,
却提示:cgi_header:unable to  find LFLF,
这是什么什么意思? 谢谢!!!

论坛徽章:
0
2 [报告]
发表于 2012-05-07 17:56 |只看该作者
是不是代码输出格式不对?!

论坛徽章:
5
摩羯座
日期:2014-07-22 09:03:552015元宵节徽章
日期:2015-03-06 15:50:392015亚冠之大阪钢巴
日期:2015-06-12 16:01:352015年中国系统架构师大会
日期:2015-06-29 16:11:2815-16赛季CBA联赛之四川
日期:2018-12-17 14:10:21
3 [报告]
发表于 2012-05-07 18:37 |只看该作者
\n\n?
\r\n?
\n\r?

论坛徽章:
0
4 [报告]
发表于 2012-05-08 00:17 |只看该作者
本帖最后由 雪中的紫诺 于 2012-05-08 00:23 编辑
tobealinuxer 发表于 2012-05-07 17:56
是不是代码输出格式不对?!



# include <stdio.h>
# include <stdlib.h>



int main()
  {
     char *data;
     long  m,n;
     
     printf("Content-Type:text/html \r\n\r\n");

     printf("<html> <head>\n");
     printf("<title> hello world  </title> \n");
     printf("</head>\n");
     printf("<body> \n");
     data = getenv("QUERY_STRING");
     if(sscanf(data,"m=%ld&n=%ld",&m,&n)!=2)

     printf("< P >错误!输入数据非法。表单中输入的必须是数字。</p>");

     else

     printf("< P >%ld和%ld的成绩是:%ld。",m,n,m*n);
     printf("</body> </html> \n");       
     return 0;   
  
  }



我是才接触CGI+boa,我是在网上找的test程序,我把这程序在虚拟机上交叉编译,移植到ARM-linux板上。运行的时候,就提示上面的错误,我找其它的事例程序也是如此。我的项目的目的是想通过CGI+BOA方式,对arm-linux板上的xml文件进行配置。因为我程序里面调用xml配置文件里的参数。求指点思路!谢谢!

论坛徽章:
0
5 [报告]
发表于 2012-05-08 00:18 |只看该作者
本帖最后由 雪中的紫诺 于 2012-05-08 00:24 编辑
T-Bagwell 发表于 2012-05-07 18:37
\n\n?
\r\n?
\n\r?


高手,我测试的代码是:

# include <stdio.h>
# include <stdlib.h>



int main()
  {
     char *data;
     long  m,n;
     
     printf("Content-Type:text/html \r\n\r\n");

     printf("<html> <head>\n");
     printf("<title> hello world  </title> \n");
     printf("</head>\n");
     printf("<body> \n");
     data = getenv("QUERY_STRING");
     if(sscanf(data,"m=%ld&n=%ld",&m,&n)!=2)

     printf("< P >错误!输入数据非法。表单中输入的必须是数字。</p>");

     else

     printf("< P >%ld和%ld的成绩是:%ld。",m,n,m*n);
     printf("</body> </html> \n");       
     return 0;   
  
  }

这是我在网上找的事例,因为我是第一次接触,我的项目的目的是想通过CGI+BOA方式,对arm-linux板上的xml文件进行配置。因为我程序里面调用xml配置文件里的参数。请指点思路。谢谢!

论坛徽章:
5
摩羯座
日期:2014-07-22 09:03:552015元宵节徽章
日期:2015-03-06 15:50:392015亚冠之大阪钢巴
日期:2015-06-12 16:01:352015年中国系统架构师大会
日期:2015-06-29 16:11:2815-16赛季CBA联赛之四川
日期:2018-12-17 14:10:21
6 [报告]
发表于 2012-05-08 09:35 |只看该作者
最后多加些 printf("\r\n\r\n");

论坛徽章:
0
7 [报告]
发表于 2012-05-25 13:17 |只看该作者
本帖最后由 daniel_kohler 于 2012-05-25 13:18 编辑

回复 5# 雪中的紫诺

  1. #include <stdio.h>
  2. #include <stdlib.h>
  3. #include <string.h>


  4. int main()
  5. {
  6.         char *data;
  7.         long  m = 0, n = 0;
  8.    
  9.         printf("%s\n\n", "Content-Type:text/html;charset=gb2312");
  10.         printf("<html> <head>\n");
  11.         printf("<title> hello world  </title> \n");
  12.         printf("</head>\n");
  13.         printf("<body> \n");
  14.    
  15.         data = getenv("QUERY_STRING");
  16.         if(data != NULL){
  17.                 if(sscanf(data,"m=%ld&n=%ld",&m,&n)!=2){
  18.                         printf("< P >错误!输入数据非法。表单中输入的必须是数字。</p>");
  19.                 }else{
  20.                          printf("< P >%ld和%ld的成绩是:%ld。</p>",m,n,m*n);
  21.                 }
  22.         }else{
  23.                 printf("data is null");
  24.         }
  25.        
  26.         printf("</body> </html> \n");        
  27.         return 0;   

  28. }

复制代码

论坛徽章:
0
8 [报告]
发表于 2012-05-27 20:28 |只看该作者
daniel_kohler 发表于 2012-05-25 13:17
回复 5# 雪中的紫诺


什么意思? 我的QQ297101000.希望能得到你的指点。
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

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

清除 Cookies - ChinaUnix - Archiver - WAP - TOP