gpt4 book ai didi

c - Apache C CGI 程序错误

转载 作者:行者123 更新时间:2023-11-30 17:23:34 26 4
gpt4 key购买 nike

我正在尝试用 C 语言编写一个 CGI 程序(我正在学习,这似乎是一件有趣的事情),但我遇到了 Apache/CGI 错误的问题,但仅限于一个非常特定的行。如果这一行被注释或删除,它工作得很好,但如果包含它,它每次都会崩溃。

struct site_link
{
char *name;
char *url;
};

struct blog_data
{
char *blog_name;
struct site_link *links;
} blog;

blog.blog_name = "richardwagner.io";
blog.links[0].url = "Home"; // <-- this line right here
blog.links[0].name = "Home";
blog.links[1].url = "Posts";
blog.links[1].name = "Posts";
blog.links[2].url = "About";
blog.links[2].name = "About";

并且 Apache 日志的“调试”级别日志记录已打开。

[Mon Dec 15 10:27:38.906961 2014] [authz_core:debug] [pid 63010] mod_authz_core.c(799): [client 192.168.1.104:49922] AH01626: authorization result of Require all granted: granted
[Mon Dec 15 10:27:38.906982 2014] [authz_core:debug] [pid 63010] mod_authz_core.c(799): [client 192.168.1.104:49922] AH01626: authorization result of <RequireAny>: granted
[Mon Dec 15 10:27:38.907020 2014] [authz_core:debug] [pid 63010] mod_authz_core.c(799): [client 192.168.1.104:49922] AH01626: authorization result of Require all granted: granted
[Mon Dec 15 10:27:38.907026 2014] [authz_core:debug] [pid 63010] mod_authz_core.c(799): [client 192.168.1.104:49922] AH01626: authorization result of <RequireAny>: granted
[Mon Dec 15 10:27:39.186804 2014] [cgi:error] [pid 63010] [client 192.168.1.104:49922] End of script output before headers: tblog

几天来我一直在尝试解决这个问题,但我就是无法让它与这一行很好地配合,尽管对我来说,它看起来与它下面的其他几行几乎相同。

最佳答案

您缺少\r\n\r\n 来表示 header 结束。

关于c - Apache C CGI 程序错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27482399/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com