本文介绍了用CPP编写CGI的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我正在用CPP编写许多CGI,并且其中之一正在碰壁.我可以在标准调试器上对其进行测试,然后在main()处设置一个断点.这可以正常工作,并且可以解决问题.当我将其安装在本地主机Apache Server cgi-bin目录中时,它会在到达main()入口点之前退出.
产生了通常的错误日志"和响应"页面,(配置错误),(标题的结尾过早)这是按预期的,它的距离还远远不够,无法产生任何输出.

一个人怎么进攻呢?

顺便说一句,我的调试技术是将ASSERT(0)放到我想中断的位置.它允许我附加调试器,并逐步执行代码. main()的ASSERT(0)第一行在此CGI上没有得到期望的结果. (已工作且仍在工作)在其他所有服务器上.
这使我感到怀疑,要么int3的中断向量未正确设置,要么从未到达main().我很难相信前者.该向量是在创建执行环境时在CreateProcess()的早期阶段设置的,即,在与我的流程特别相关的任何事情发生很久之前.

我还将ASSERT(0)放入应用程序构造函数中.永不开火!

作为附带说明,我的main()埋在DLL的深处.它调用MyCgiApp :: CgiMain(),这是入口点
这可能不常见,但是可以在几十个CGI中使用.

拔头发,

谢谢您的帮助:)

它变得有趣了.从HTML表单调用它,它会命中main(),(现在可以了,它没有更早完成,我什么都没改变),如果我将ASSERT保留在那里.使用断言,它将打印页面,如果没有断言,它将失败!

Hi,

I am writing a number of CGI''s in CPP, and I am running into a Brick Wall with one of them. I can test run it under the Standard Debugger, and set a Breakpoint at main(). This works fine, and it gets there No Problem. When I install it in the Local Host Apache Server cgi-bin dir, it bails out BEFORE it hits the main() entry point.
The Usual Error Log, and response page are produced, (Misconfiguration),(Premature End of Header) Which is as expected, it never got far enough to produce any output.

How does one Attack this.

BTW My Debug tecnique is to put an ASSERT(0) where I want to break. It allows me to attach the Debugger, and step tru the Code. An ASSERT(0) first line of main() does not give the desired result on this CGI. (Worked and Still Works) on All Others.
It makes me surmise that either the Interrupt vector for int3 is not set up correctly, or, that main() is never reached. The Former I would find hard to believe. That vector is set in the early stages of CreateProcess()when the execution environment is created, i.e. Long before anything in particular relating to my process takes place.

I also put an ASSERT(0) in the App Constructor. Never Fires!

As a Side Note, my main() is burried deep inside a DLL. It calls MyCgiApp::CgiMain(), which is the entry point
This may be unusual, but, works in Several dozens of CGI''s.

Pulling my Hair Out,

Thanks for Any Help at All :)

It gets Funnier. Called it from a HTML Form, and it Hits main(), (Now it does, It Didn''t do so earlier, I changed Nothing) if I keep the ASSERT There. With the Assert it prints the Page, without the Assert, it Fails! Why is all this so Thin and Fragile!

推荐答案



这篇关于用CPP编写CGI的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-18 13:05