December 11th Tuesday (十二月 十一日 火曜日)

本文解析了Apache服务器模块的配置过程及关键字段含义,包括模块声明宏、目录配置创建与合并、主机配置创建与合并等。文章还介绍了如何通过返回值控制请求处理流程,包括完全处理请求、拒绝处理请求及指示错误状态。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

module AP_MODULE_DECLARE_DATA some_module = {
  STANDARD20_MODULE_STUFF,
  some_dir_cfg,     /* create per-directory config struct */
  some_dir_merge,   /* merge per-directory config struct */
  some_svr_cfg,     /* create per-host config struct */
  some_svr_merge,   /* merge per-host config struct */
  some_cmds,        /* configuration directives for this module */
  some_hooks        /* register module's hooks/etc. with the core */
};

  The STANDARD20_MODULE_STUFF macro expands to provide version information that ensures the compiled module
will load into a server build only when it is fully binary compatible, together with the filename and reserved
fields.  Most of the remaining fields are concerned with module configuration.

  Returning an error code here will cause Apache to return an error page to the client.  Note that the HTTP
standard defines HEAD as being identical to GET except for the response body, which is omitted in HEAD.

  Both methods are included in Apache’s M_GET, and content generator functions should treat them as identical.

Return Values

* OK, to indicate that the handler has fully and successfully dealt with the request. No further processing is necessary.

* DECLINED, to indicate that the handler takes no interest in the request and declines to process it. Apache will then
  try the next handler. The default handler, which simply returns a file from the local disk (or an error page if that fails),
  never return DECLINED, so requests are always handled by some function.

* An HTTP status code, to indicate an error. The handler has taken responsibility for the request, but was unable or unwilling
  to complete it.

  An HTTP status code diverts the entire processing chain within Apache. Normal processing of the request is aborted, and
Apache sets up an internal redirect to an error document, which may either be one of Apache’s predefined defaults or be a
ErrorDocument directive in the server configuration.  Note that this diversion works only if Apache hasn’t already started to
send the response down the wire to the client--this can be an important design consideration in handling errors.  To ensure
correct behavior, any such diversion must take place before writing any data.

 
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值