#include <ngx_config.h>
#include <ngx_core.h>
#include <ngx_http.h>
#define NGX_HTTP_CHARSET_OFF …
#define NGX_HTTP_NO_CHARSET …
#define NGX_HTTP_CHARSET_VAR …
#define NGX_UTF_LEN …
#define NGX_HTML_ENTITY_LEN …
ngx_http_charset_t;
ngx_http_charset_recode_t;
ngx_http_charset_tables_t;
ngx_http_charset_main_conf_t;
ngx_http_charset_loc_conf_t;
ngx_http_charset_ctx_t;
ngx_http_charset_conf_ctx_t;
static ngx_int_t ngx_http_destination_charset(ngx_http_request_t *r,
ngx_str_t *name);
static ngx_int_t ngx_http_main_request_charset(ngx_http_request_t *r,
ngx_str_t *name);
static ngx_int_t ngx_http_source_charset(ngx_http_request_t *r,
ngx_str_t *name);
static ngx_int_t ngx_http_get_charset(ngx_http_request_t *r, ngx_str_t *name);
static ngx_inline void ngx_http_set_charset(ngx_http_request_t *r,
ngx_str_t *charset);
static ngx_int_t ngx_http_charset_ctx(ngx_http_request_t *r,
ngx_http_charset_t *charsets, ngx_int_t charset, ngx_int_t source_charset);
static ngx_uint_t ngx_http_charset_recode(ngx_buf_t *b, u_char *table);
static ngx_chain_t *ngx_http_charset_recode_from_utf8(ngx_pool_t *pool,
ngx_buf_t *buf, ngx_http_charset_ctx_t *ctx);
static ngx_chain_t *ngx_http_charset_recode_to_utf8(ngx_pool_t *pool,
ngx_buf_t *buf, ngx_http_charset_ctx_t *ctx);
static ngx_chain_t *ngx_http_charset_get_buf(ngx_pool_t *pool,
ngx_http_charset_ctx_t *ctx);
static ngx_chain_t *ngx_http_charset_get_buffer(ngx_pool_t *pool,
ngx_http_charset_ctx_t *ctx, size_t size);
static char *ngx_http_charset_map_block(ngx_conf_t *cf, ngx_command_t *cmd,
void *conf);
static char *ngx_http_charset_map(ngx_conf_t *cf, ngx_command_t *dummy,
void *conf);
static char *ngx_http_set_charset_slot(ngx_conf_t *cf, ngx_command_t *cmd,
void *conf);
static ngx_int_t ngx_http_add_charset(ngx_array_t *charsets, ngx_str_t *name);
static void *ngx_http_charset_create_main_conf(ngx_conf_t *cf);
static void *ngx_http_charset_create_loc_conf(ngx_conf_t *cf);
static char *ngx_http_charset_merge_loc_conf(ngx_conf_t *cf,
void *parent, void *child);
static ngx_int_t ngx_http_charset_postconfiguration(ngx_conf_t *cf);
static ngx_str_t ngx_http_charset_default_types[] = …;
static ngx_command_t ngx_http_charset_filter_commands[] = …;
static ngx_http_module_t ngx_http_charset_filter_module_ctx = …;
ngx_module_t ngx_http_charset_filter_module = …;
static ngx_http_output_header_filter_pt ngx_http_next_header_filter;
static ngx_http_output_body_filter_pt ngx_http_next_body_filter;
static ngx_int_t
ngx_http_charset_header_filter(ngx_http_request_t *r)
{ … }
static ngx_int_t
ngx_http_destination_charset(ngx_http_request_t *r, ngx_str_t *name)
{ … }
static ngx_int_t
ngx_http_main_request_charset(ngx_http_request_t *r, ngx_str_t *src)
{ … }
static ngx_int_t
ngx_http_source_charset(ngx_http_request_t *r, ngx_str_t *name)
{ … }
static ngx_int_t
ngx_http_get_charset(ngx_http_request_t *r, ngx_str_t *name)
{ … }
static ngx_inline void
ngx_http_set_charset(ngx_http_request_t *r, ngx_str_t *charset)
{ … }
static ngx_int_t
ngx_http_charset_ctx(ngx_http_request_t *r, ngx_http_charset_t *charsets,
ngx_int_t charset, ngx_int_t source_charset)
{ … }
static ngx_int_t
ngx_http_charset_body_filter(ngx_http_request_t *r, ngx_chain_t *in)
{ … }
static ngx_uint_t
ngx_http_charset_recode(ngx_buf_t *b, u_char *table)
{ … }
static ngx_chain_t *
ngx_http_charset_recode_from_utf8(ngx_pool_t *pool, ngx_buf_t *buf,
ngx_http_charset_ctx_t *ctx)
{ … }
static ngx_chain_t *
ngx_http_charset_recode_to_utf8(ngx_pool_t *pool, ngx_buf_t *buf,
ngx_http_charset_ctx_t *ctx)
{ … }
static ngx_chain_t *
ngx_http_charset_get_buf(ngx_pool_t *pool, ngx_http_charset_ctx_t *ctx)
{ … }
static ngx_chain_t *
ngx_http_charset_get_buffer(ngx_pool_t *pool, ngx_http_charset_ctx_t *ctx,
size_t size)
{ … }
static char *
ngx_http_charset_map_block(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
{ … }
static char *
ngx_http_charset_map(ngx_conf_t *cf, ngx_command_t *dummy, void *conf)
{ … }
static char *
ngx_http_set_charset_slot(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
{ … }
static ngx_int_t
ngx_http_add_charset(ngx_array_t *charsets, ngx_str_t *name)
{ … }
static void *
ngx_http_charset_create_main_conf(ngx_conf_t *cf)
{ … }
static void *
ngx_http_charset_create_loc_conf(ngx_conf_t *cf)
{ … }
static char *
ngx_http_charset_merge_loc_conf(ngx_conf_t *cf, void *parent, void *child)
{ … }
static ngx_int_t
ngx_http_charset_postconfiguration(ngx_conf_t *cf)
{ … }