Mercurial > hg > nginx
annotate src/http/modules/ngx_http_gzip_static_module.c @ 6362:28bb9683dd9a stable-1.8
release-1.8.1 tag
author | Maxim Dounin <mdounin@mdounin.ru> |
---|---|
date | Tue, 26 Jan 2016 17:39:31 +0300 |
parents | fcb0420f90de |
children | a72886067bbb |
rev | line source |
---|---|
441
da8c5707af39
nginx-0.1.0-2004-09-28-12:34:51 import; set copyright and remove unused files
Igor Sysoev <igor@sysoev.ru>
parents:
416
diff
changeset
|
1 |
da8c5707af39
nginx-0.1.0-2004-09-28-12:34:51 import; set copyright and remove unused files
Igor Sysoev <igor@sysoev.ru>
parents:
416
diff
changeset
|
2 /* |
444
42d11f017717
nginx-0.1.0-2004-09-29-20:00:49 import; remove years from copyright
Igor Sysoev <igor@sysoev.ru>
parents:
441
diff
changeset
|
3 * Copyright (C) Igor Sysoev |
4412 | 4 * Copyright (C) Nginx, Inc. |
441
da8c5707af39
nginx-0.1.0-2004-09-28-12:34:51 import; set copyright and remove unused files
Igor Sysoev <igor@sysoev.ru>
parents:
416
diff
changeset
|
5 */ |
da8c5707af39
nginx-0.1.0-2004-09-28-12:34:51 import; set copyright and remove unused files
Igor Sysoev <igor@sysoev.ru>
parents:
416
diff
changeset
|
6 |
1
d220029ac7f3
nginx-0.0.1-2002-08-15-21:20:26 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
7 |
d220029ac7f3
nginx-0.0.1-2002-08-15-21:20:26 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
8 #include <ngx_config.h> |
87
5f6d848dcbef
nginx-0.0.1-2003-05-13-20:02:32 import
Igor Sysoev <igor@sysoev.ru>
parents:
74
diff
changeset
|
9 #include <ngx_core.h> |
3
34a521b1a148
nginx-0.0.1-2002-08-20-18:48:28 import
Igor Sysoev <igor@sysoev.ru>
parents:
1
diff
changeset
|
10 #include <ngx_http.h> |
34a521b1a148
nginx-0.0.1-2002-08-20-18:48:28 import
Igor Sysoev <igor@sysoev.ru>
parents:
1
diff
changeset
|
11 |
1
d220029ac7f3
nginx-0.0.1-2002-08-15-21:20:26 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
12 |
4836
e368b822d034
Gzip static: "always" parameter in "gzip_static" directive.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4748
diff
changeset
|
13 #define NGX_HTTP_GZIP_STATIC_OFF 0 |
e368b822d034
Gzip static: "always" parameter in "gzip_static" directive.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4748
diff
changeset
|
14 #define NGX_HTTP_GZIP_STATIC_ON 1 |
e368b822d034
Gzip static: "always" parameter in "gzip_static" directive.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4748
diff
changeset
|
15 #define NGX_HTTP_GZIP_STATIC_ALWAYS 2 |
e368b822d034
Gzip static: "always" parameter in "gzip_static" directive.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4748
diff
changeset
|
16 |
e368b822d034
Gzip static: "always" parameter in "gzip_static" directive.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4748
diff
changeset
|
17 |
1790
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1772
diff
changeset
|
18 typedef struct { |
4836
e368b822d034
Gzip static: "always" parameter in "gzip_static" directive.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4748
diff
changeset
|
19 ngx_uint_t enable; |
1790
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1772
diff
changeset
|
20 } ngx_http_gzip_static_conf_t; |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1772
diff
changeset
|
21 |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1772
diff
changeset
|
22 |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1772
diff
changeset
|
23 static ngx_int_t ngx_http_gzip_static_handler(ngx_http_request_t *r); |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1772
diff
changeset
|
24 static void *ngx_http_gzip_static_create_conf(ngx_conf_t *cf); |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1772
diff
changeset
|
25 static char *ngx_http_gzip_static_merge_conf(ngx_conf_t *cf, void *parent, |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1772
diff
changeset
|
26 void *child); |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1772
diff
changeset
|
27 static ngx_int_t ngx_http_gzip_static_init(ngx_conf_t *cf); |
148
5afee0074707
nginx-0.0.1-2003-10-17-00:19:16 import
Igor Sysoev <igor@sysoev.ru>
parents:
143
diff
changeset
|
28 |
5afee0074707
nginx-0.0.1-2003-10-17-00:19:16 import
Igor Sysoev <igor@sysoev.ru>
parents:
143
diff
changeset
|
29 |
4836
e368b822d034
Gzip static: "always" parameter in "gzip_static" directive.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4748
diff
changeset
|
30 static ngx_conf_enum_t ngx_http_gzip_static[] = { |
e368b822d034
Gzip static: "always" parameter in "gzip_static" directive.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4748
diff
changeset
|
31 { ngx_string("off"), NGX_HTTP_GZIP_STATIC_OFF }, |
e368b822d034
Gzip static: "always" parameter in "gzip_static" directive.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4748
diff
changeset
|
32 { ngx_string("on"), NGX_HTTP_GZIP_STATIC_ON }, |
e368b822d034
Gzip static: "always" parameter in "gzip_static" directive.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4748
diff
changeset
|
33 { ngx_string("always"), NGX_HTTP_GZIP_STATIC_ALWAYS }, |
e368b822d034
Gzip static: "always" parameter in "gzip_static" directive.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4748
diff
changeset
|
34 { ngx_null_string, 0 } |
e368b822d034
Gzip static: "always" parameter in "gzip_static" directive.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4748
diff
changeset
|
35 }; |
e368b822d034
Gzip static: "always" parameter in "gzip_static" directive.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4748
diff
changeset
|
36 |
e368b822d034
Gzip static: "always" parameter in "gzip_static" directive.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4748
diff
changeset
|
37 |
1790
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1772
diff
changeset
|
38 static ngx_command_t ngx_http_gzip_static_commands[] = { |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1772
diff
changeset
|
39 |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1772
diff
changeset
|
40 { ngx_string("gzip_static"), |
5587
ceecde39853f
Gzip static: fixed NGX_CONF_FLAG misuse.
Valentin Bartenev <vbart@nginx.com>
parents:
4836
diff
changeset
|
41 NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_TAKE1, |
4836
e368b822d034
Gzip static: "always" parameter in "gzip_static" directive.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4748
diff
changeset
|
42 ngx_conf_set_enum_slot, |
1790
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1772
diff
changeset
|
43 NGX_HTTP_LOC_CONF_OFFSET, |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1772
diff
changeset
|
44 offsetof(ngx_http_gzip_static_conf_t, enable), |
4836
e368b822d034
Gzip static: "always" parameter in "gzip_static" directive.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4748
diff
changeset
|
45 &ngx_http_gzip_static }, |
1790
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1772
diff
changeset
|
46 |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1772
diff
changeset
|
47 ngx_null_command |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1772
diff
changeset
|
48 }; |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1772
diff
changeset
|
49 |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1772
diff
changeset
|
50 |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1772
diff
changeset
|
51 ngx_http_module_t ngx_http_gzip_static_module_ctx = { |
509 | 52 NULL, /* preconfiguration */ |
1790
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1772
diff
changeset
|
53 ngx_http_gzip_static_init, /* postconfiguration */ |
177
4db54fdbcbe7
nginx-0.0.1-2003-11-10-20:17:31 import
Igor Sysoev <igor@sysoev.ru>
parents:
176
diff
changeset
|
54 |
148
5afee0074707
nginx-0.0.1-2003-10-17-00:19:16 import
Igor Sysoev <igor@sysoev.ru>
parents:
143
diff
changeset
|
55 NULL, /* create main configuration */ |
5afee0074707
nginx-0.0.1-2003-10-17-00:19:16 import
Igor Sysoev <igor@sysoev.ru>
parents:
143
diff
changeset
|
56 NULL, /* init main configuration */ |
577 | 57 |
148
5afee0074707
nginx-0.0.1-2003-10-17-00:19:16 import
Igor Sysoev <igor@sysoev.ru>
parents:
143
diff
changeset
|
58 NULL, /* create server configuration */ |
5afee0074707
nginx-0.0.1-2003-10-17-00:19:16 import
Igor Sysoev <igor@sysoev.ru>
parents:
143
diff
changeset
|
59 NULL, /* merge server configuration */ |
577 | 60 |
1790
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1772
diff
changeset
|
61 ngx_http_gzip_static_create_conf, /* create location configuration */ |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1772
diff
changeset
|
62 ngx_http_gzip_static_merge_conf /* merge location configuration */ |
577 | 63 }; |
148
5afee0074707
nginx-0.0.1-2003-10-17-00:19:16 import
Igor Sysoev <igor@sysoev.ru>
parents:
143
diff
changeset
|
64 |
5afee0074707
nginx-0.0.1-2003-10-17-00:19:16 import
Igor Sysoev <igor@sysoev.ru>
parents:
143
diff
changeset
|
65 |
1790
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1772
diff
changeset
|
66 ngx_module_t ngx_http_gzip_static_module = { |
509 | 67 NGX_MODULE_V1, |
1790
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1772
diff
changeset
|
68 &ngx_http_gzip_static_module_ctx, /* module context */ |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1772
diff
changeset
|
69 ngx_http_gzip_static_commands, /* module directives */ |
148
5afee0074707
nginx-0.0.1-2003-10-17-00:19:16 import
Igor Sysoev <igor@sysoev.ru>
parents:
143
diff
changeset
|
70 NGX_HTTP_MODULE, /* module type */ |
541 | 71 NULL, /* init master */ |
681 | 72 NULL, /* init module */ |
541 | 73 NULL, /* init process */ |
74 NULL, /* init thread */ | |
75 NULL, /* exit thread */ | |
76 NULL, /* exit process */ | |
77 NULL, /* exit master */ | |
78 NGX_MODULE_V1_PADDING | |
148
5afee0074707
nginx-0.0.1-2003-10-17-00:19:16 import
Igor Sysoev <igor@sysoev.ru>
parents:
143
diff
changeset
|
79 }; |
5afee0074707
nginx-0.0.1-2003-10-17-00:19:16 import
Igor Sysoev <igor@sysoev.ru>
parents:
143
diff
changeset
|
80 |
5afee0074707
nginx-0.0.1-2003-10-17-00:19:16 import
Igor Sysoev <igor@sysoev.ru>
parents:
143
diff
changeset
|
81 |
509 | 82 static ngx_int_t |
1790
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1772
diff
changeset
|
83 ngx_http_gzip_static_handler(ngx_http_request_t *r) |
148
5afee0074707
nginx-0.0.1-2003-10-17-00:19:16 import
Igor Sysoev <igor@sysoev.ru>
parents:
143
diff
changeset
|
84 { |
1790
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1772
diff
changeset
|
85 u_char *p; |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1772
diff
changeset
|
86 size_t root; |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1772
diff
changeset
|
87 ngx_str_t path; |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1772
diff
changeset
|
88 ngx_int_t rc; |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1772
diff
changeset
|
89 ngx_uint_t level; |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1772
diff
changeset
|
90 ngx_log_t *log; |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1772
diff
changeset
|
91 ngx_buf_t *b; |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1772
diff
changeset
|
92 ngx_chain_t out; |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1772
diff
changeset
|
93 ngx_table_elt_t *h; |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1772
diff
changeset
|
94 ngx_open_file_info_t of; |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1772
diff
changeset
|
95 ngx_http_core_loc_conf_t *clcf; |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1772
diff
changeset
|
96 ngx_http_gzip_static_conf_t *gzcf; |
201
267ea1d98683
nginx-0.0.1-2003-11-30-23:03:18 import
Igor Sysoev <igor@sysoev.ru>
parents:
200
diff
changeset
|
97 |
645 | 98 if (!(r->method & (NGX_HTTP_GET|NGX_HTTP_HEAD))) { |
1832
2547ef00c722
ngx_http_gzip_static_module should DECLINE request
Igor Sysoev <igor@sysoev.ru>
parents:
1799
diff
changeset
|
99 return NGX_DECLINED; |
639 | 100 } |
101 | |
201
267ea1d98683
nginx-0.0.1-2003-11-30-23:03:18 import
Igor Sysoev <igor@sysoev.ru>
parents:
200
diff
changeset
|
102 if (r->uri.data[r->uri.len - 1] == '/') { |
267ea1d98683
nginx-0.0.1-2003-11-30-23:03:18 import
Igor Sysoev <igor@sysoev.ru>
parents:
200
diff
changeset
|
103 return NGX_DECLINED; |
267ea1d98683
nginx-0.0.1-2003-11-30-23:03:18 import
Igor Sysoev <igor@sysoev.ru>
parents:
200
diff
changeset
|
104 } |
148
5afee0074707
nginx-0.0.1-2003-10-17-00:19:16 import
Igor Sysoev <igor@sysoev.ru>
parents:
143
diff
changeset
|
105 |
1790
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1772
diff
changeset
|
106 gzcf = ngx_http_get_module_loc_conf(r, ngx_http_gzip_static_module); |
201
267ea1d98683
nginx-0.0.1-2003-11-30-23:03:18 import
Igor Sysoev <igor@sysoev.ru>
parents:
200
diff
changeset
|
107 |
4836
e368b822d034
Gzip static: "always" parameter in "gzip_static" directive.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4748
diff
changeset
|
108 if (gzcf->enable == NGX_HTTP_GZIP_STATIC_OFF) { |
3135
784126370092
nginx always sent "Vary: Accept-Encoding",
Igor Sysoev <igor@sysoev.ru>
parents:
2912
diff
changeset
|
109 return NGX_DECLINED; |
784126370092
nginx always sent "Vary: Accept-Encoding",
Igor Sysoev <igor@sysoev.ru>
parents:
2912
diff
changeset
|
110 } |
784126370092
nginx always sent "Vary: Accept-Encoding",
Igor Sysoev <igor@sysoev.ru>
parents:
2912
diff
changeset
|
111 |
4836
e368b822d034
Gzip static: "always" parameter in "gzip_static" directive.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4748
diff
changeset
|
112 if (gzcf->enable == NGX_HTTP_GZIP_STATIC_ON) { |
e368b822d034
Gzip static: "always" parameter in "gzip_static" directive.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4748
diff
changeset
|
113 rc = ngx_http_gzip_ok(r); |
e368b822d034
Gzip static: "always" parameter in "gzip_static" directive.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4748
diff
changeset
|
114 |
e368b822d034
Gzip static: "always" parameter in "gzip_static" directive.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4748
diff
changeset
|
115 } else { |
e368b822d034
Gzip static: "always" parameter in "gzip_static" directive.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4748
diff
changeset
|
116 /* always */ |
e368b822d034
Gzip static: "always" parameter in "gzip_static" directive.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4748
diff
changeset
|
117 rc = NGX_OK; |
e368b822d034
Gzip static: "always" parameter in "gzip_static" directive.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4748
diff
changeset
|
118 } |
3312
dddca6f42e7b
nginx sent gzipped responses to clients those do not support gzip,
Igor Sysoev <igor@sysoev.ru>
parents:
3178
diff
changeset
|
119 |
3135
784126370092
nginx always sent "Vary: Accept-Encoding",
Igor Sysoev <igor@sysoev.ru>
parents:
2912
diff
changeset
|
120 clcf = ngx_http_get_module_loc_conf(r, ngx_http_core_module); |
784126370092
nginx always sent "Vary: Accept-Encoding",
Igor Sysoev <igor@sysoev.ru>
parents:
2912
diff
changeset
|
121 |
3312
dddca6f42e7b
nginx sent gzipped responses to clients those do not support gzip,
Igor Sysoev <igor@sysoev.ru>
parents:
3178
diff
changeset
|
122 if (!clcf->gzip_vary && rc != NGX_OK) { |
1790
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1772
diff
changeset
|
123 return NGX_DECLINED; |
201
267ea1d98683
nginx-0.0.1-2003-11-30-23:03:18 import
Igor Sysoev <igor@sysoev.ru>
parents:
200
diff
changeset
|
124 } |
267ea1d98683
nginx-0.0.1-2003-11-30-23:03:18 import
Igor Sysoev <igor@sysoev.ru>
parents:
200
diff
changeset
|
125 |
267ea1d98683
nginx-0.0.1-2003-11-30-23:03:18 import
Igor Sysoev <igor@sysoev.ru>
parents:
200
diff
changeset
|
126 log = r->connection->log; |
267ea1d98683
nginx-0.0.1-2003-11-30-23:03:18 import
Igor Sysoev <igor@sysoev.ru>
parents:
200
diff
changeset
|
127 |
1790
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1772
diff
changeset
|
128 p = ngx_http_map_uri_to_path(r, &path, &root, sizeof(".gz") - 1); |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1772
diff
changeset
|
129 if (p == NULL) { |
557 | 130 return NGX_HTTP_INTERNAL_SERVER_ERROR; |
400
69e851f83522
nginx-0.0.8-2004-07-26-20:21:18 import
Igor Sysoev <igor@sysoev.ru>
parents:
396
diff
changeset
|
131 } |
148
5afee0074707
nginx-0.0.1-2003-10-17-00:19:16 import
Igor Sysoev <igor@sysoev.ru>
parents:
143
diff
changeset
|
132 |
1790
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1772
diff
changeset
|
133 *p++ = '.'; |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1772
diff
changeset
|
134 *p++ = 'g'; |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1772
diff
changeset
|
135 *p++ = 'z'; |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1772
diff
changeset
|
136 *p = '\0'; |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1772
diff
changeset
|
137 |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1772
diff
changeset
|
138 path.len = p - path.data; |
1454 | 139 |
201
267ea1d98683
nginx-0.0.1-2003-11-30-23:03:18 import
Igor Sysoev <igor@sysoev.ru>
parents:
200
diff
changeset
|
140 ngx_log_debug1(NGX_LOG_DEBUG_HTTP, log, 0, |
557 | 141 "http filename: \"%s\"", path.data); |
148
5afee0074707
nginx-0.0.1-2003-10-17-00:19:16 import
Igor Sysoev <igor@sysoev.ru>
parents:
143
diff
changeset
|
142 |
2068
75a8d34459c5
ngx_memzero() ngx_open_file_info_t
Igor Sysoev <igor@sysoev.ru>
parents:
2063
diff
changeset
|
143 ngx_memzero(&of, sizeof(ngx_open_file_info_t)); |
75a8d34459c5
ngx_memzero() ngx_open_file_info_t
Igor Sysoev <igor@sysoev.ru>
parents:
2063
diff
changeset
|
144 |
3178 | 145 of.read_ahead = clcf->read_ahead; |
2129 | 146 of.directio = clcf->directio; |
1767
c42431762903
open_file_cache_retest > open_file_cache_valid
Igor Sysoev <igor@sysoev.ru>
parents:
1696
diff
changeset
|
147 of.valid = clcf->open_file_cache_valid; |
1772 | 148 of.min_uses = clcf->open_file_cache_min_uses; |
1454 | 149 of.errors = clcf->open_file_cache_errors; |
1457 | 150 of.events = clcf->open_file_cache_events; |
4494
13e09cf11d4e
Disable symlinks: initialization of the "disable_symlinks" field in
Valentin Bartenev <vbart@nginx.com>
parents:
4478
diff
changeset
|
151 |
13e09cf11d4e
Disable symlinks: initialization of the "disable_symlinks" field in
Valentin Bartenev <vbart@nginx.com>
parents:
4478
diff
changeset
|
152 if (ngx_http_set_disable_symlinks(r, clcf, &path, &of) != NGX_OK) { |
13e09cf11d4e
Disable symlinks: initialization of the "disable_symlinks" field in
Valentin Bartenev <vbart@nginx.com>
parents:
4478
diff
changeset
|
153 return NGX_HTTP_INTERNAL_SERVER_ERROR; |
13e09cf11d4e
Disable symlinks: initialization of the "disable_symlinks" field in
Valentin Bartenev <vbart@nginx.com>
parents:
4478
diff
changeset
|
154 } |
1454 | 155 |
1799 | 156 if (ngx_open_cached_file(clcf->open_file_cache, &path, &of, r->pool) |
157 != NGX_OK) | |
158 { | |
1454 | 159 switch (of.err) { |
160 | |
161 case 0: | |
162 return NGX_HTTP_INTERNAL_SERVER_ERROR; | |
148
5afee0074707
nginx-0.0.1-2003-10-17-00:19:16 import
Igor Sysoev <igor@sysoev.ru>
parents:
143
diff
changeset
|
163 |
1454 | 164 case NGX_ENOENT: |
165 case NGX_ENOTDIR: | |
166 case NGX_ENAMETOOLONG: | |
167 | |
1790
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1772
diff
changeset
|
168 return NGX_DECLINED; |
148
5afee0074707
nginx-0.0.1-2003-10-17-00:19:16 import
Igor Sysoev <igor@sysoev.ru>
parents:
143
diff
changeset
|
169 |
1454 | 170 case NGX_EACCES: |
4478
08713bac87fc
Support for disable_symlinks in various modules.
Andrey Belov <defan@nginx.com>
parents:
4412
diff
changeset
|
171 #if (NGX_HAVE_OPENAT) |
08713bac87fc
Support for disable_symlinks in various modules.
Andrey Belov <defan@nginx.com>
parents:
4412
diff
changeset
|
172 case NGX_EMLINK: |
08713bac87fc
Support for disable_symlinks in various modules.
Andrey Belov <defan@nginx.com>
parents:
4412
diff
changeset
|
173 case NGX_ELOOP: |
08713bac87fc
Support for disable_symlinks in various modules.
Andrey Belov <defan@nginx.com>
parents:
4412
diff
changeset
|
174 #endif |
1454 | 175 |
170
c42be4185301
nginx-0.0.1-2003-11-03-01:56:18 import
Igor Sysoev <igor@sysoev.ru>
parents:
165
diff
changeset
|
176 level = NGX_LOG_ERR; |
1454 | 177 break; |
148
5afee0074707
nginx-0.0.1-2003-10-17-00:19:16 import
Igor Sysoev <igor@sysoev.ru>
parents:
143
diff
changeset
|
178 |
1454 | 179 default: |
180 | |
170
c42be4185301
nginx-0.0.1-2003-11-03-01:56:18 import
Igor Sysoev <igor@sysoev.ru>
parents:
165
diff
changeset
|
181 level = NGX_LOG_CRIT; |
1454 | 182 break; |
148
5afee0074707
nginx-0.0.1-2003-10-17-00:19:16 import
Igor Sysoev <igor@sysoev.ru>
parents:
143
diff
changeset
|
183 } |
170
c42be4185301
nginx-0.0.1-2003-11-03-01:56:18 import
Igor Sysoev <igor@sysoev.ru>
parents:
165
diff
changeset
|
184 |
1790
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1772
diff
changeset
|
185 ngx_log_error(level, log, of.err, |
2756
09cab3f8d92e
*) of.test_only to not open file if only stat() is enough
Igor Sysoev <igor@sysoev.ru>
parents:
2721
diff
changeset
|
186 "%s \"%s\" failed", of.failed, path.data); |
170
c42be4185301
nginx-0.0.1-2003-11-03-01:56:18 import
Igor Sysoev <igor@sysoev.ru>
parents:
165
diff
changeset
|
187 |
1799 | 188 return NGX_DECLINED; |
148
5afee0074707
nginx-0.0.1-2003-10-17-00:19:16 import
Igor Sysoev <igor@sysoev.ru>
parents:
143
diff
changeset
|
189 } |
5afee0074707
nginx-0.0.1-2003-10-17-00:19:16 import
Igor Sysoev <igor@sysoev.ru>
parents:
143
diff
changeset
|
190 |
4836
e368b822d034
Gzip static: "always" parameter in "gzip_static" directive.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4748
diff
changeset
|
191 if (gzcf->enable == NGX_HTTP_GZIP_STATIC_ON) { |
e368b822d034
Gzip static: "always" parameter in "gzip_static" directive.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4748
diff
changeset
|
192 r->gzip_vary = 1; |
3313 | 193 |
4836
e368b822d034
Gzip static: "always" parameter in "gzip_static" directive.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4748
diff
changeset
|
194 if (rc != NGX_OK) { |
e368b822d034
Gzip static: "always" parameter in "gzip_static" directive.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4748
diff
changeset
|
195 return NGX_DECLINED; |
e368b822d034
Gzip static: "always" parameter in "gzip_static" directive.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4748
diff
changeset
|
196 } |
3312
dddca6f42e7b
nginx sent gzipped responses to clients those do not support gzip,
Igor Sysoev <igor@sysoev.ru>
parents:
3178
diff
changeset
|
197 } |
dddca6f42e7b
nginx sent gzipped responses to clients those do not support gzip,
Igor Sysoev <igor@sysoev.ru>
parents:
3178
diff
changeset
|
198 |
1696 | 199 ngx_log_debug1(NGX_LOG_DEBUG_HTTP, log, 0, "http static fd: %d", of.fd); |
148
5afee0074707
nginx-0.0.1-2003-10-17-00:19:16 import
Igor Sysoev <igor@sysoev.ru>
parents:
143
diff
changeset
|
200 |
1454 | 201 if (of.is_dir) { |
201
267ea1d98683
nginx-0.0.1-2003-11-30-23:03:18 import
Igor Sysoev <igor@sysoev.ru>
parents:
200
diff
changeset
|
202 ngx_log_debug0(NGX_LOG_DEBUG_HTTP, log, 0, "http dir"); |
1790
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1772
diff
changeset
|
203 return NGX_DECLINED; |
148
5afee0074707
nginx-0.0.1-2003-10-17-00:19:16 import
Igor Sysoev <igor@sysoev.ru>
parents:
143
diff
changeset
|
204 } |
5afee0074707
nginx-0.0.1-2003-10-17-00:19:16 import
Igor Sysoev <igor@sysoev.ru>
parents:
143
diff
changeset
|
205 |
461 | 206 #if !(NGX_WIN32) /* the not regular files are probably Unix specific */ |
176
c0552e5ab567
nginx-0.0.1-2003-11-09-23:03:38 import; separate building
Igor Sysoev <igor@sysoev.ru>
parents:
170
diff
changeset
|
207 |
1454 | 208 if (!of.is_file) { |
3498
9f20a6e758c3
do not log misleading errno in "not a regular file" error
Igor Sysoev <igor@sysoev.ru>
parents:
3313
diff
changeset
|
209 ngx_log_error(NGX_LOG_CRIT, log, 0, |
557 | 210 "\"%s\" is not a regular file", path.data); |
176
c0552e5ab567
nginx-0.0.1-2003-11-09-23:03:38 import; separate building
Igor Sysoev <igor@sysoev.ru>
parents:
170
diff
changeset
|
211 |
c0552e5ab567
nginx-0.0.1-2003-11-09-23:03:38 import; separate building
Igor Sysoev <igor@sysoev.ru>
parents:
170
diff
changeset
|
212 return NGX_HTTP_NOT_FOUND; |
c0552e5ab567
nginx-0.0.1-2003-11-09-23:03:38 import; separate building
Igor Sysoev <igor@sysoev.ru>
parents:
170
diff
changeset
|
213 } |
c0552e5ab567
nginx-0.0.1-2003-11-09-23:03:38 import; separate building
Igor Sysoev <igor@sysoev.ru>
parents:
170
diff
changeset
|
214 |
c0552e5ab567
nginx-0.0.1-2003-11-09-23:03:38 import; separate building
Igor Sysoev <igor@sysoev.ru>
parents:
170
diff
changeset
|
215 #endif |
c0552e5ab567
nginx-0.0.1-2003-11-09-23:03:38 import; separate building
Igor Sysoev <igor@sysoev.ru>
parents:
170
diff
changeset
|
216 |
2444
aee735f41627
set r->root_tested for non-error_page response only
Igor Sysoev <igor@sysoev.ru>
parents:
2231
diff
changeset
|
217 r->root_tested = !r->error_page; |
2087
c8039b26a949
always test root existence for access_log with variables
Igor Sysoev <igor@sysoev.ru>
parents:
2068
diff
changeset
|
218 |
1790
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1772
diff
changeset
|
219 rc = ngx_http_discard_request_body(r); |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1772
diff
changeset
|
220 |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1772
diff
changeset
|
221 if (rc != NGX_OK) { |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1772
diff
changeset
|
222 return rc; |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1772
diff
changeset
|
223 } |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1772
diff
changeset
|
224 |
509 | 225 log->action = "sending response to client"; |
148
5afee0074707
nginx-0.0.1-2003-10-17-00:19:16 import
Igor Sysoev <igor@sysoev.ru>
parents:
143
diff
changeset
|
226 |
201
267ea1d98683
nginx-0.0.1-2003-11-30-23:03:18 import
Igor Sysoev <igor@sysoev.ru>
parents:
200
diff
changeset
|
227 r->headers_out.status = NGX_HTTP_OK; |
1454 | 228 r->headers_out.content_length_n = of.size; |
229 r->headers_out.last_modified_time = of.mtime; | |
201
267ea1d98683
nginx-0.0.1-2003-11-30-23:03:18 import
Igor Sysoev <igor@sysoev.ru>
parents:
200
diff
changeset
|
230 |
4748
192f54280a7a
Entity tags: set for static respones.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4611
diff
changeset
|
231 if (ngx_http_set_etag(r) != NGX_OK) { |
192f54280a7a
Entity tags: set for static respones.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4611
diff
changeset
|
232 return NGX_HTTP_INTERNAL_SERVER_ERROR; |
192f54280a7a
Entity tags: set for static respones.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4611
diff
changeset
|
233 } |
192f54280a7a
Entity tags: set for static respones.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4611
diff
changeset
|
234 |
201
267ea1d98683
nginx-0.0.1-2003-11-30-23:03:18 import
Igor Sysoev <igor@sysoev.ru>
parents:
200
diff
changeset
|
235 if (ngx_http_set_content_type(r) != NGX_OK) { |
200
abeaebe0a33c
nginx-0.0.1-2003-11-28-20:41:47 import
Igor Sysoev <igor@sysoev.ru>
parents:
199
diff
changeset
|
236 return NGX_HTTP_INTERNAL_SERVER_ERROR; |
abeaebe0a33c
nginx-0.0.1-2003-11-28-20:41:47 import
Igor Sysoev <igor@sysoev.ru>
parents:
199
diff
changeset
|
237 } |
abeaebe0a33c
nginx-0.0.1-2003-11-28-20:41:47 import
Igor Sysoev <igor@sysoev.ru>
parents:
199
diff
changeset
|
238 |
1790
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1772
diff
changeset
|
239 h = ngx_list_push(&r->headers_out.headers); |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1772
diff
changeset
|
240 if (h == NULL) { |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1772
diff
changeset
|
241 return NGX_ERROR; |
583 | 242 } |
243 | |
1790
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1772
diff
changeset
|
244 h->hash = 1; |
3516
dd1570b6f237
ngx_str_set() and ngx_str_null()
Igor Sysoev <igor@sysoev.ru>
parents:
3498
diff
changeset
|
245 ngx_str_set(&h->key, "Content-Encoding"); |
dd1570b6f237
ngx_str_set() and ngx_str_null()
Igor Sysoev <igor@sysoev.ru>
parents:
3498
diff
changeset
|
246 ngx_str_set(&h->value, "gzip"); |
dd1570b6f237
ngx_str_set() and ngx_str_null()
Igor Sysoev <igor@sysoev.ru>
parents:
3498
diff
changeset
|
247 r->headers_out.content_encoding = h; |
1790
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1772
diff
changeset
|
248 |
577 | 249 /* we need to allocate all before the header would be sent */ |
1
d220029ac7f3
nginx-0.0.1-2002-08-15-21:20:26 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
250 |
577 | 251 b = ngx_pcalloc(r->pool, sizeof(ngx_buf_t)); |
252 if (b == NULL) { | |
253 return NGX_HTTP_INTERNAL_SERVER_ERROR; | |
254 } | |
26
53cb81681040
nginx-0.0.1-2002-12-15-09:25:09 import
Igor Sysoev <igor@sysoev.ru>
parents:
24
diff
changeset
|
255 |
577 | 256 b->file = ngx_pcalloc(r->pool, sizeof(ngx_file_t)); |
257 if (b->file == NULL) { | |
258 return NGX_HTTP_INTERNAL_SERVER_ERROR; | |
259 } | |
403
ea3113b181d1
nginx-0.0.9-2004-07-28-23:21:26 import
Igor Sysoev <igor@sysoev.ru>
parents:
400
diff
changeset
|
260 |
96
a23d010f356d
nginx-0.0.1-2003-05-27-16:18:54 import
Igor Sysoev <igor@sysoev.ru>
parents:
89
diff
changeset
|
261 rc = ngx_http_send_header(r); |
143
5526213be452
nginx-0.0.1-2003-10-10-19:10:50 import
Igor Sysoev <igor@sysoev.ru>
parents:
142
diff
changeset
|
262 |
585 | 263 if (rc == NGX_ERROR || rc > NGX_OK || r->header_only) { |
143
5526213be452
nginx-0.0.1-2003-10-10-19:10:50 import
Igor Sysoev <igor@sysoev.ru>
parents:
142
diff
changeset
|
264 return rc; |
99
a059e1aa65d4
nginx-0.0.1-2003-06-02-19:24:30 import
Igor Sysoev <igor@sysoev.ru>
parents:
96
diff
changeset
|
265 } |
96
a23d010f356d
nginx-0.0.1-2003-05-27-16:18:54 import
Igor Sysoev <igor@sysoev.ru>
parents:
89
diff
changeset
|
266 |
343
6bdf858bff8c
nginx-0.0.3-2004-05-28-19:49:23 import; rename ngx_hunk_t to ngx_buf_t
Igor Sysoev <igor@sysoev.ru>
parents:
334
diff
changeset
|
267 b->file_pos = 0; |
1454 | 268 b->file_last = of.size; |
1
d220029ac7f3
nginx-0.0.1-2002-08-15-21:20:26 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
269 |
1790
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1772
diff
changeset
|
270 b->in_file = b->file_last ? 1 : 0; |
4611
2b6cb7528409
Allows particular modules to handle subrequests properly.
Andrey Belov <defan@nginx.com>
parents:
4494
diff
changeset
|
271 b->last_buf = (r == r->main) ? 1 : 0; |
577 | 272 b->last_in_chain = 1; |
273 | |
1696 | 274 b->file->fd = of.fd; |
557 | 275 b->file->name = path; |
343
6bdf858bff8c
nginx-0.0.3-2004-05-28-19:49:23 import; rename ngx_hunk_t to ngx_buf_t
Igor Sysoev <igor@sysoev.ru>
parents:
334
diff
changeset
|
276 b->file->log = log; |
2231
8564129d49b6
*) handle unaligned file part for directio
Igor Sysoev <igor@sysoev.ru>
parents:
2129
diff
changeset
|
277 b->file->directio = of.is_directio; |
343
6bdf858bff8c
nginx-0.0.3-2004-05-28-19:49:23 import; rename ngx_hunk_t to ngx_buf_t
Igor Sysoev <igor@sysoev.ru>
parents:
334
diff
changeset
|
278 |
6bdf858bff8c
nginx-0.0.3-2004-05-28-19:49:23 import; rename ngx_hunk_t to ngx_buf_t
Igor Sysoev <igor@sysoev.ru>
parents:
334
diff
changeset
|
279 out.buf = b; |
153
c71aeb75c071
nginx-0.0.1-2003-10-21-20:49:56 import
Igor Sysoev <igor@sysoev.ru>
parents:
148
diff
changeset
|
280 out.next = NULL; |
c71aeb75c071
nginx-0.0.1-2003-10-21-20:49:56 import
Igor Sysoev <igor@sysoev.ru>
parents:
148
diff
changeset
|
281 |
c71aeb75c071
nginx-0.0.1-2003-10-21-20:49:56 import
Igor Sysoev <igor@sysoev.ru>
parents:
148
diff
changeset
|
282 return ngx_http_output_filter(r, &out); |
1
d220029ac7f3
nginx-0.0.1-2002-08-15-21:20:26 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
283 } |
148
5afee0074707
nginx-0.0.1-2003-10-17-00:19:16 import
Igor Sysoev <igor@sysoev.ru>
parents:
143
diff
changeset
|
284 |
5afee0074707
nginx-0.0.1-2003-10-17-00:19:16 import
Igor Sysoev <igor@sysoev.ru>
parents:
143
diff
changeset
|
285 |
1790
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1772
diff
changeset
|
286 static void * |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1772
diff
changeset
|
287 ngx_http_gzip_static_create_conf(ngx_conf_t *cf) |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1772
diff
changeset
|
288 { |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1772
diff
changeset
|
289 ngx_http_gzip_static_conf_t *conf; |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1772
diff
changeset
|
290 |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1772
diff
changeset
|
291 conf = ngx_palloc(cf->pool, sizeof(ngx_http_gzip_static_conf_t)); |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1772
diff
changeset
|
292 if (conf == NULL) { |
2912
c7d57b539248
return NULL instead of NGX_CONF_ERROR on a create conf failure
Igor Sysoev <igor@sysoev.ru>
parents:
2877
diff
changeset
|
293 return NULL; |
1790
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1772
diff
changeset
|
294 } |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1772
diff
changeset
|
295 |
4836
e368b822d034
Gzip static: "always" parameter in "gzip_static" directive.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4748
diff
changeset
|
296 conf->enable = NGX_CONF_UNSET_UINT; |
1790
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1772
diff
changeset
|
297 |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1772
diff
changeset
|
298 return conf; |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1772
diff
changeset
|
299 } |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1772
diff
changeset
|
300 |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1772
diff
changeset
|
301 |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1772
diff
changeset
|
302 static char * |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1772
diff
changeset
|
303 ngx_http_gzip_static_merge_conf(ngx_conf_t *cf, void *parent, void *child) |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1772
diff
changeset
|
304 { |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1772
diff
changeset
|
305 ngx_http_gzip_static_conf_t *prev = parent; |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1772
diff
changeset
|
306 ngx_http_gzip_static_conf_t *conf = child; |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1772
diff
changeset
|
307 |
4836
e368b822d034
Gzip static: "always" parameter in "gzip_static" directive.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4748
diff
changeset
|
308 ngx_conf_merge_uint_value(conf->enable, prev->enable, |
e368b822d034
Gzip static: "always" parameter in "gzip_static" directive.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4748
diff
changeset
|
309 NGX_HTTP_GZIP_STATIC_OFF); |
1790
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1772
diff
changeset
|
310 |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1772
diff
changeset
|
311 return NGX_CONF_OK; |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1772
diff
changeset
|
312 } |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1772
diff
changeset
|
313 |
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1772
diff
changeset
|
314 |
509 | 315 static ngx_int_t |
1790
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1772
diff
changeset
|
316 ngx_http_gzip_static_init(ngx_conf_t *cf) |
148
5afee0074707
nginx-0.0.1-2003-10-17-00:19:16 import
Igor Sysoev <igor@sysoev.ru>
parents:
143
diff
changeset
|
317 { |
5afee0074707
nginx-0.0.1-2003-10-17-00:19:16 import
Igor Sysoev <igor@sysoev.ru>
parents:
143
diff
changeset
|
318 ngx_http_handler_pt *h; |
5afee0074707
nginx-0.0.1-2003-10-17-00:19:16 import
Igor Sysoev <igor@sysoev.ru>
parents:
143
diff
changeset
|
319 ngx_http_core_main_conf_t *cmcf; |
396
6f3b20c1ac50
nginx-0.0.7-2004-07-18-23:11:20 import
Igor Sysoev <igor@sysoev.ru>
parents:
346
diff
changeset
|
320 |
681 | 321 cmcf = ngx_http_conf_get_module_main_conf(cf, ngx_http_core_module); |
577 | 322 |
501 | 323 h = ngx_array_push(&cmcf->phases[NGX_HTTP_CONTENT_PHASE].handlers); |
201
267ea1d98683
nginx-0.0.1-2003-11-30-23:03:18 import
Igor Sysoev <igor@sysoev.ru>
parents:
200
diff
changeset
|
324 if (h == NULL) { |
267ea1d98683
nginx-0.0.1-2003-11-30-23:03:18 import
Igor Sysoev <igor@sysoev.ru>
parents:
200
diff
changeset
|
325 return NGX_ERROR; |
267ea1d98683
nginx-0.0.1-2003-11-30-23:03:18 import
Igor Sysoev <igor@sysoev.ru>
parents:
200
diff
changeset
|
326 } |
267ea1d98683
nginx-0.0.1-2003-11-30-23:03:18 import
Igor Sysoev <igor@sysoev.ru>
parents:
200
diff
changeset
|
327 |
1790
775edc46ee66
ngx_http_gzip_static_module and gzip_disable
Igor Sysoev <igor@sysoev.ru>
parents:
1772
diff
changeset
|
328 *h = ngx_http_gzip_static_handler; |
148
5afee0074707
nginx-0.0.1-2003-10-17-00:19:16 import
Igor Sysoev <igor@sysoev.ru>
parents:
143
diff
changeset
|
329 |
5afee0074707
nginx-0.0.1-2003-10-17-00:19:16 import
Igor Sysoev <igor@sysoev.ru>
parents:
143
diff
changeset
|
330 return NGX_OK; |
5afee0074707
nginx-0.0.1-2003-10-17-00:19:16 import
Igor Sysoev <igor@sysoev.ru>
parents:
143
diff
changeset
|
331 } |