Coding With Fun
Home Docker Django Node.js Articles Python pip guide FAQ Policy

The basic structure of the Nginx handler module


May 23, 2021 Nginx Getting started


Table of contents


The basic structure of the handler module

In addition to the basic structure of the module described in the last section, the handler module must provide a real handler that is responsible for the real processing of requests from the client. T his function can be processed either by generating the content directly on its own, by rejecting processing, by a subsequent handler, or by dropping it to a subsequent filter. Take a look at the prototype statement of this function.

typedef ngx_int_t (*ngx_http_handler_pt)(ngx_http_request_t *r);

r is an http request. I t contains all the information requested, which is not detailed here, and can be described in other sections. T he function handles the successful return NGX_OK, processes an error returns NGX_ERROR, and rejects the processing (left for subsequent handler processing) to return NGX_DECLINE. Return NGX_OK means that the response to the client has been generated, otherwise an error NGX_ERROR returned to the client.