44#include <ngx_http_realip_module.h>
55#include "ngx_http_apisix_module.h"
66
7+
78#define NGX_HTTP_APISIX_SSL_ENC 1
89#define NGX_HTTP_APISIX_SSL_SIGN 2
910
@@ -53,7 +54,7 @@ static ngx_command_t ngx_http_apisix_cmds[] = {
5354
5455static ngx_http_module_t ngx_http_apisix_module_ctx = {
5556 NULL , /* preconfiguration */
56- ngx_http_apisix_init , /* postconfiguration */
57+ ngx_http_apisix_init , /* postconfiguration */
5758
5859 ngx_http_apisix_create_main_conf , /* create main configuration */
5960 NULL , /* init main configuration */
@@ -81,6 +82,7 @@ ngx_module_t ngx_http_apisix_module = {
8182 NGX_MODULE_V1_PADDING
8283};
8384
85+
8486static void *
8587ngx_http_apisix_create_main_conf (ngx_conf_t * cf )
8688{
@@ -100,7 +102,6 @@ ngx_http_apisix_create_main_conf(ngx_conf_t *cf)
100102 return acf ;
101103}
102104
103- //These below functions are responsible for translating genertic configuration into our specific struct.
104105static void *
105106ngx_http_apisix_create_loc_conf (ngx_conf_t * cf )
106107{
@@ -840,11 +841,6 @@ ngx_http_apisix_is_ntls_enabled(ngx_http_conf_ctx_t *conf_ctx)
840841}
841842
842843/*******************Log handler***************** */
843- /*
844- * This function contains the logic to append the Request ID to
845- * the error log line when being called.
846- * Get the location configuration from helper function. Find indexed variable with the loc_conf->apisix_request_id_var_index. and add that to buffer.
847- */
848844static u_char *
849845ngx_http_apisix_error_log_handler (ngx_http_request_t * r , u_char * buf , size_t len )
850846{
@@ -865,12 +861,6 @@ ngx_http_apisix_error_log_handler(ngx_http_request_t *r, u_char *buf, size_t len
865861}
866862
867863
868- /*
869- * This function replaces the original HTTP error
870- * log handler (r->log_handler). It executes the original logic
871- * and then our error log handler: ngx_http_apisix_error_log_handler
872- * This function returns the final message.
873- */
874864static u_char *
875865ngx_http_apisix_combined_error_log_handler (ngx_http_request_t * r , ngx_http_request_t * sr , u_char * buf , size_t len )
876866{
@@ -894,8 +884,6 @@ ngx_http_apisix_combined_error_log_handler(ngx_http_request_t *r, ngx_http_reque
894884}
895885
896886
897- //It replaces the r->log_handler which is the log handler of the request with the combined log handler.
898- // Creates the apisix context we need from the request to act on it.
899887static ngx_int_t
900888ngx_http_apisix_replace_error_log_handler (ngx_http_request_t * r )
901889{
@@ -921,8 +909,7 @@ ngx_http_apisix_replace_error_log_handler(ngx_http_request_t *r)
921909 return NGX_DECLINED ;
922910}
923911
924- //This function is part of postconfiguration passed to module context and will override the post_read_phase with custom log handler.
925- // It extracts the pointer to log handler from the post read phase handlers and then override that with new function address.
912+
926913char *
927914ngx_http_apisix_error_log_init (ngx_conf_t * cf )
928915{
@@ -942,8 +929,7 @@ ngx_http_apisix_error_log_init(ngx_conf_t *cf)
942929 return NGX_CONF_OK ;
943930}
944931
945- // This function does the translation of the configuration file to the internal representation.
946- // So this will just set the value in loc_conf that it gets by reference.
932+
947933char *
948934ngx_http_apisix_error_log_request_id (ngx_conf_t * cf , ngx_command_t * cmd , void * conf )
949935{
0 commit comments