使用C CGI程序的Apache错误

时间:2014-12-15 10:52:25

标签: c apache cgi

我正在尝试用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";

启用了'debug'级别日志记录的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

我一直在努力解决这个问题几天,我只是不能让它与那一行很好玩,即使对我来说,它看起来几乎与它下面的其他几行相同。

1 个答案:

答案 0 :(得分:0)

您缺少\ r \ n \ r \ n表示标题的结尾。