linux+goahead+cgi cgi源代码如何编译?
时间:2009-04-10
来源:互联网
最近在玩goahead,嵌入式开源web server,代码中有一cgitest.c的cgi例子代码,不知道如何编译,仿goahead编译(在标准FC8上)
cc -g -Wall -DWEBS -DUEMF -DOS="LINUX" -DLINUX -DUSER_MANAGEMENT_SUPPORT -DDIGEST_ACCESS_SUPPORT -I../.. -c cgitest.c -o cgitest.o
cc -o cgitest.cgi cgitest.o
编译完成之后,拷贝cgitest.cgi到ws031202/web/cgi-bin,跑起./webs,用IE连接http://192.168.13.198/cgi-bin/cgitest.cgi,服务器端出现Segmentation fault,
gdb调试信息如下:
(gdb) where
#0 0x0059d12b in strlen () from /lib/libc.so.6
#1 0x0804a391 in bstrdup (s=0xffffffff <Address 0xffffffff out of bounds>) at ../balloc.c:461
#2 0x080497af in websGetCgiCommName () at main.c:328
#3 0x0804aa07 in websCgiHandler (wp=0x9798c48, urlPrefix=0x9796bd8 "/cgi-bin", webDir=0x9796bf0 "", arg=0,
url=0x97994d0 "/cgi-bin/test.cgi", path=0x9799510 "/cgi-bin/test.cgi", query=0x9797288 "") at ../cgi.c:185
#4 0x0804e8c8 in websUrlHandlerRequest (wp=0x9798c48) at ../handler.c:279
#5 0x0805778f in websGetInput (wp=0x9798c48, ptext=0xbfb40f40, pnbytes=0xbfb40f38) at ../webs.c:699
#6 0x08057090 in websReadEvent (wp=0x9798c48) at ../webs.c:362
#7 0x08056fed in websSocketEvent (sid=1, mask=2, iwp=158960712) at ../webs.c:319
#8 0x0805157d in socketDoEvent (sp=0x97972a0) at ../sockGen.c:933
#9 0x08051424 in socketProcess (sid=1) at ../sockGen.c:875
#10 0x080492d9 in main (argc=1, argv=0xbfb41074) at main.c:96
好像是strlen的问题。
请教cgi高手代码应该如何编译,谢谢!
如果能够给出Makefile例子,那就更好了。
cc -g -Wall -DWEBS -DUEMF -DOS="LINUX" -DLINUX -DUSER_MANAGEMENT_SUPPORT -DDIGEST_ACCESS_SUPPORT -I../.. -c cgitest.c -o cgitest.o
cc -o cgitest.cgi cgitest.o
编译完成之后,拷贝cgitest.cgi到ws031202/web/cgi-bin,跑起./webs,用IE连接http://192.168.13.198/cgi-bin/cgitest.cgi,服务器端出现Segmentation fault,
gdb调试信息如下:
(gdb) where
#0 0x0059d12b in strlen () from /lib/libc.so.6
#1 0x0804a391 in bstrdup (s=0xffffffff <Address 0xffffffff out of bounds>) at ../balloc.c:461
#2 0x080497af in websGetCgiCommName () at main.c:328
#3 0x0804aa07 in websCgiHandler (wp=0x9798c48, urlPrefix=0x9796bd8 "/cgi-bin", webDir=0x9796bf0 "", arg=0,
url=0x97994d0 "/cgi-bin/test.cgi", path=0x9799510 "/cgi-bin/test.cgi", query=0x9797288 "") at ../cgi.c:185
#4 0x0804e8c8 in websUrlHandlerRequest (wp=0x9798c48) at ../handler.c:279
#5 0x0805778f in websGetInput (wp=0x9798c48, ptext=0xbfb40f40, pnbytes=0xbfb40f38) at ../webs.c:699
#6 0x08057090 in websReadEvent (wp=0x9798c48) at ../webs.c:362
#7 0x08056fed in websSocketEvent (sid=1, mask=2, iwp=158960712) at ../webs.c:319
#8 0x0805157d in socketDoEvent (sp=0x97972a0) at ../sockGen.c:933
#9 0x08051424 in socketProcess (sid=1) at ../sockGen.c:875
#10 0x080492d9 in main (argc=1, argv=0xbfb41074) at main.c:96
好像是strlen的问题。
请教cgi高手代码应该如何编译,谢谢!
如果能够给出Makefile例子,那就更好了。
作者: hgy1234 发布时间: 2009-04-10
cgi的编译是不是和普通应用程序的编译是一样的?
作者: hgy1234 发布时间: 2009-04-15
一样吧
作者: dd_zhouqian 发布时间: 2009-11-03
你的 CGI 沒有處理無效的 input 吧。
作者: suanyuan 发布时间: 2010-02-15
该回复于2010-02-23 09:42:31被管理员删除
- 对我有用[0]
- 丢个板砖[0]
- 引用
- 举报
- 管理
- TOP
|
#5楼 得分:0回复于:2010-10-29 14:30:09
|
作者: qq_525093551 发布时间: 2010-02-22
相关阅读 更多
热门阅读
-
office 2019专业增强版最新2021版激活秘钥/序列号/激活码推荐 附激活工具
阅读:74
-
如何安装mysql8.0
阅读:31
-
Word快速设置标题样式步骤详解
阅读:28
-
20+道必知必会的Vue面试题(附答案解析)
阅读:37
-
HTML如何制作表单
阅读:22
-
百词斩可以改天数吗?当然可以,4个步骤轻松修改天数!
阅读:31
-
ET文件格式和XLS格式文件之间如何转化?
阅读:24
-
react和vue的区别及优缺点是什么
阅读:121
-
支付宝人脸识别如何关闭?
阅读:21
-
腾讯微云怎么修改照片或视频备份路径?
阅读:28