@@ -14,12 +14,14 @@ static ngx_int_t ngx_http_lambda_handler(ngx_http_request_t *r);
14
14
*/
15
15
static ngx_command_t ngx_http_lambda_commands [] = {
16
16
17
- { ngx_string ("lambda" ), /* directive */
18
- NGX_HTTP_LOC_CONF |NGX_CONF_TAKE1 , /* location context and takes 1 argument the lambda function ARN*/
17
+ {
18
+ ngx_string ("lambda" ), /* directive */
19
+ NGX_HTTP_LOC_CONF |NGX_CONF_TAKE1 , /* location context and takes 1 argument the lambda function ARN */
19
20
ngx_http_lambda , /* configuration setup function */
20
21
0 , /* No offset. Only one context is supported. */
21
22
0 , /* No offset when storing the module configuration on struct. */
22
- NULL },
23
+ NULL
24
+ },
23
25
24
26
ngx_null_command /* command termination */
25
27
};
@@ -65,35 +67,35 @@ ngx_module_t ngx_http_lambda_module = {
65
67
* @return
66
68
* The status of the response generation.
67
69
*/
68
- static ngx_int_t ngx_http_lambda_handler (ngx_http_request_t * r )
70
+ static ngx_int_t ngx_http_lambda_handler (ngx_http_request_t * req )
69
71
{
70
- ngx_buf_t * b ;
72
+ ngx_buf_t * buf ;
71
73
ngx_chain_t out ;
72
74
73
75
/* Set the Content-Type header. */
74
- r -> headers_out .content_type .len = sizeof ("text/plain " ) - 1 ;
75
- r -> headers_out .content_type .data = (u_char * ) "text/plain " ;
76
+ req -> headers_out .content_type .len = sizeof ("text/html " ) - 1 ;
77
+ req -> headers_out .content_type .data = (u_char * ) "text/html " ;
76
78
77
79
/* Allocate a new buffer for sending out the reply. */
78
- b = ngx_pcalloc (r -> pool , sizeof (ngx_buf_t ));
80
+ buf = ngx_pcalloc (req -> pool , sizeof (ngx_buf_t ));
79
81
80
82
/* Insertion in the buffer chain. */
81
- out .buf = b ;
83
+ out .buf = buf ;
82
84
out .next = NULL ; /* just one buffer */
83
85
84
- b -> pos = ngx_lambda ; /* first position in memory of the data */
85
- b -> last = ngx_lambda + sizeof (ngx_lambda ); /* last position in memory of the data */
86
- b -> memory = 1 ; /* content is in read-only memory */
87
- b -> last_buf = 1 ; /* there will be no more buffers in the request */
86
+ buf -> pos = ngx_lambda ; /* first position in memory of the data */
87
+ buf -> last = ngx_lambda + sizeof (ngx_lambda ); /* last position in memory of the data */
88
+ buf -> memory = 1 ; /* content is in read-only memory */
89
+ buf -> last_buf = 1 ; /* there will be no more buffers in the request */
88
90
89
91
/* Sending the headers for the reply. */
90
- r -> headers_out .status = NGX_HTTP_OK ; /* 200 status code */
92
+ req -> headers_out .status = NGX_HTTP_OK ; /* 200 status code */
91
93
/* Get the content length of the body. */
92
- r -> headers_out .content_length_n = sizeof (ngx_lambda );
93
- ngx_http_send_header (r ); /* Send the headers */
94
+ req -> headers_out .content_length_n = sizeof (ngx_lambda );
95
+ ngx_http_send_header (req ); /* Send the headers */
94
96
95
97
/* Send the body, and return the status code of the output filter chain. */
96
- return ngx_http_output_filter (r , & out );
98
+ return ngx_http_output_filter (req , & out );
97
99
}
98
100
99
101
/**
0 commit comments