锐英源软件
第一信赖

精通

英语

开源

擅长

开发

培训

胸怀四海 

第一信赖

当前位置:锐英源 / 英语翻译 / Apache / Apache的请求处理
服务方向
人工智能数据处理
人工智能培训
kaldi数据准备
小语种语音识别
语音识别标注
语音识别系统
语音识别转文字
kaldi开发技术服务
软件开发
运动控制卡上位机
机械加工软件
软件开发培训
Java 安卓移动开发
VC++
C#软件
汇编和破解
驱动开发
联系方式
固话:0371-63888850
手机:138-0381-0136
Q Q:396806883
微信:ryysoft

锐英源精品开源心得,转载请注明:“锐英源www.wisestudy.cn,孙老师作品,电话13803810136。需要全文内容也请联系孙老师。

Apache的请求处理

As the Apache server processes a request, it takes it through ten (10) different stages, called phases. At each phase, any modules that have registered a callback for that phase are invoked and given an opportunity to work their will upon the request. 作为Apache服务器处理一个请求,它需要它通过十(10)不同的阶段,称为阶段。在每个阶段,已注册该阶段回调的模块调用,并有机会按照自己的意愿行事。

The phases in Apache 1.3.9 are, in order: 在Apache中1.3.9的阶段,按顺序:
1. Post-read request post阅读请求
2. URI translation URI的翻译
3. Header field parsing 头字段解析
4. Mandatory access checking 强制访问检查
5. Discretionary authentication 可自由支配的身份验证
6. Discretionary authorisation 可自由支配的授权
7. MIME/IMT type determination or setting MIME类型/ IMT决心或设置
8. Last-chance ‘fixups’最后“修正”
9. Content emission 内容发送
10. Logging 日志记录

All of these phases are described in the sections that follow.所有这些将在随后的章节中描述。

Module Order 模块顺序

Before we actually get to the phase descriptions, something should be said about module invocation order. 实际上在我们的描述阶段,应该说模块调用的顺序。

The list of active modules that Apache keeps internally is just that – a linked list of the module structures from all of them. This list is handled as a push-down or LIFO list, meaning that the modules listed earliest are the ones invoked last.

Apache保持内部活动模块的列表就是这些所有的其中一个链接列表模块的结构。这个列表被作为下推或后进先出列表处理,这意味着所列最早模块是最后调用的那些。

One of the consequences of having a single list is that modules are always called in the same order regardless of the current phase. For involved or complex modules this may require careful placement in the src/Configuration and/or conf/httpd.conf files (depending upon whether the modules are statically or dynamically loaded); you may want to have the post-read phase of your module called before that of mod_foobar, but you want your fixup phase called after that of mod bletch.

一个具有单列表的后果之一是,模块以相同的顺序始终调用,而不用关注当前阶段,对参与或复杂的模块,这可能对src/Configuration和/或conf/httpd.conf需要仔细放置(根据模块是否被静态或动态加载),您可能想要您的模块称为mod_fooba之前的阶段,但你希望称为mod bletch之后修正阶段。

Any module hook is called at most one time per request. The changes it makes to the request_rec structure are how it communicates its effects to other modules and later phases. In some cases, not all modules will even get a chance at a request; the most common example is if an earlier module returns an error; the phase processing (and indeed the whole request processing mechanism) aborts at that point.

任何模块钩子在请求内最多调用一次。它对request_rec结构的修改是它传达其影响到其他模块和后期阶段。在某些情况下,不是所有的模块都有机会访问请求结构;最常见的例子是,如果一个较早模块返回一个错误;阶段处理(和实际上整个请求处理机构)中止在该点。

Hook Return Values 钩返回值

Each hook or callback returns a value of some kind. The value returned tells the server about the success or failure of the hook’s processing. Return values may either be pointers (NULL, a pointer to a string, or a pointer to a structure) or numbers.

每个钩子或回调返回某种值。返回的值告诉服务器了钩的处理的成功或失败。返回值可以是指针(NULL,指针指向一个字符串,或指向结构的指针}或数字。

· Directive handlers return either NULL (meaning success), a pointer to an error message string, or the magic constant DECLINE_CMD, which means that this module doesn’t want to handle the directive but the server should see if any others do. This is a highly underused facility, but probably for good reason: how can a particular module tell whether the syntax is wrong because it’s wrong, or because it’s correct but for a different module?

指令处理程序返回NULL(成功),一个指针指向一个错误消息的字符串,或DECLINE_CMD不变,这意味着这个模块不想处理指令,但如果任何人这样做,服务器应该可以看到。这是一个高度未充分利用的设施,但可能有很好原因:一个特定的模块是怎么判断语法是错误的,因为它是错误的,或者因为这是正确的,但对于不同的模块?

· Config record handlers, like the record creation and merge handlers, return either a pointer to the new structure or NULL. 配置记录处理程序,比如记录创建和处理程序合并,返回一个指向新结构或NULL。

· All other handlers return either on of the magic constants OK, DECLINED, or DONE, or else an HTTP error status code. OK means the handler accepted the challenge and did something eiwith the request; DECLINED means that it didn’t do anything with it and the server should keep looking for a module to accept it, and DONE means the handler did whatever was necessary to complete the request and the server can short-circuit calling any other handlers or phases.

所有其他处理程序返回magic常量之一,比如OK,DECLINED或DONE,或者一个HTTP错误状态代码。OK表示处理程序接受了这个挑战,对请求有所处理;,DECLINED意味着它什么也没做,服务器应该继续寻找模块来接受它,DONE意味着处理器做了一切必要措施来完成请求,服务器可以短路调用任何其他处理程序或阶段。

All phases will stop and the request will be aborted if a handler returns an error status. Some phases will end, and processing will advance to the next phase, as soon as any handler returns OK; some phases will continue through the list until all modules have been called or an error has been returned. Some phases will abort the request if no module returns OK (i.e., if no modules will touch the request).

如果处理程序返回一个错误状态,所有阶段将停止,请求将被中止。有些阶段结束,处理将推进到下一个阶段,只要任何处理器返回OK;某些阶段将继续通过列表,直至所有的模块都被调用了或已经返回了一个错误。如果没有模块返回OK某些阶段会中止请求(即,如没有模块要应答要求)。

友情链接
版权所有 Copyright(c)2004-2021 锐英源软件
公司注册号:410105000449586 豫ICP备08007559号 最佳分辨率 1024*768
地址:郑州大学北校区院(文化路97号院)内