comparison src/http/modules/ngx_http_rewrite_handler.c @ 10:46833bd150cb NGINX_0_1_5

nginx 0.1.5 *) Bugfix: on Solaris and Linux there may be too many "recvmsg() returned not enough data" alerts. *) Bugfix: there were the "writev() failed (22: Invalid argument)" errors on Solaris in proxy mode without sendfile. On other platforms that do not support sendfile at all the process got caught in an endless loop. *) Bugfix: segmentation fault on Solaris in proxy mode and using sendfile. *) Bugfix: segmentation fault on Solaris. *) Bugfix: on-line upgrade did not work on Linux. *) Bugfix: the ngx_http_autoindex_module module did not escape the spaces, the quotes, and the percent signs in the directory listing. *) Change: the decrease of the copy operations. *) Feature: the userid_p3p directive.
author Igor Sysoev <http://sysoev.ru>
date Thu, 11 Nov 2004 00:00:00 +0300
parents f0b350454894
children e1ada20fc595
comparison
equal deleted inserted replaced
9:77eee314ddbd 10:46833bd150cb
144 rc = ngx_regex_exec(rule[i].regex, &r->uri, matches, rule[i].msize); 144 rc = ngx_regex_exec(rule[i].regex, &r->uri, matches, rule[i].msize);
145 145
146 if (rc == NGX_DECLINED) { 146 if (rc == NGX_DECLINED) {
147 if (scf->log) { 147 if (scf->log) {
148 ngx_log_error(NGX_LOG_NOTICE, r->connection->log, 0, 148 ngx_log_error(NGX_LOG_NOTICE, r->connection->log, 0,
149 "\"%s\" does not match \"%s\"", 149 "\"%V\" does not match \"%V\"",
150 rule[i].re_name.data, r->uri.data); 150 &rule[i].re_name, &r->uri);
151 } 151 }
152 152
153 continue; 153 continue;
154 } 154 }
155 155
156 if (rc < 0) { 156 if (rc < 0) {
157 ngx_log_error(NGX_LOG_ALERT, r->connection->log, 0, 157 ngx_log_error(NGX_LOG_ALERT, r->connection->log, 0,
158 ngx_regex_exec_n 158 ngx_regex_exec_n
159 " failed: %d on \"%s\" using \"%s\"", 159 " failed: %d on \"%V\" using \"%V\"",
160 rc, r->uri.data, rule[i].re_name.data); 160 rc, &r->uri, &rule[i].re_name);
161 return NGX_HTTP_INTERNAL_SERVER_ERROR; 161 return NGX_HTTP_INTERNAL_SERVER_ERROR;
162 } 162 }
163 163
164 if (scf->log) { 164 if (scf->log) {
165 ngx_log_error(NGX_LOG_NOTICE, r->connection->log, 0, 165 ngx_log_error(NGX_LOG_NOTICE, r->connection->log, 0,
166 "\"%s\" matches \"%s\"", 166 "\"%V\" matches \"%V\"",
167 rule[i].re_name.data, r->uri.data); 167 &rule[i].re_name, &r->uri);
168 } 168 }
169 169
170 if (rule[i].status) { 170 if (rule[i].status) {
171 return rule[i].status; 171 return rule[i].status;
172 } 172 }
175 175
176 for (n = 1; n < (ngx_uint_t) rc; n++) { 176 for (n = 1; n < (ngx_uint_t) rc; n++) {
177 uri.len += matches[2 * n + 1] - matches[2 * n]; 177 uri.len += matches[2 * n + 1] - matches[2 * n];
178 } 178 }
179 179
180 if (!(uri.data = ngx_palloc(r->pool, uri.len + 1))) { 180 if (!(uri.data = ngx_palloc(r->pool, uri.len))) {
181 return NGX_HTTP_INTERNAL_SERVER_ERROR; 181 return NGX_HTTP_INTERNAL_SERVER_ERROR;
182 } 182 }
183 183
184 p = uri.data; 184 p = uri.data;
185 185
201 p = ngx_cpymem(p, &r->uri.data[matches[m]], 201 p = ngx_cpymem(p, &r->uri.data[matches[m]],
202 matches[m + 1] - matches[m]); 202 matches[m + 1] - matches[m]);
203 } 203 }
204 } 204 }
205 205
206 *p = '\0';
207
208 if (scf->log) { 206 if (scf->log) {
209 ngx_log_error(NGX_LOG_NOTICE, r->connection->log, 0, 207 ngx_log_error(NGX_LOG_NOTICE, r->connection->log, 0,
210 "rewritten uri: \"%s\"", uri.data); 208 "rewritten uri: \"%V\"", &uri);
211 } 209 }
212 210
213 r->uri = uri; 211 r->uri = uri;
214 212
215 if (ngx_http_set_exten(r) != NGX_OK) { 213 if (ngx_http_set_exten(r) != NGX_OK) {
351 rule->last = 1; 349 rule->last = 1;
352 return NGX_CONF_OK; 350 return NGX_CONF_OK;
353 } 351 }
354 352
355 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, 353 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
356 "invalid parameter \"%s\"", value[3].data); 354 "invalid parameter \"%V\"", &value[3]);
357 return NGX_CONF_ERROR; 355 return NGX_CONF_ERROR;
358 } 356 }
359 357
360 for (i = 0; i < value[2].len; /* void */) { 358 for (i = 0; i < value[2].len; /* void */) {
361 359
425 if (ngx_strcmp(value[3].data, "last") == 0) { 423 if (ngx_strcmp(value[3].data, "last") == 0) {
426 rule->last = 1; 424 rule->last = 1;
427 425
428 } else { 426 } else {
429 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, 427 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
430 "invalid parameter \"%s\"", value[3].data); 428 "invalid parameter \"%V\"", &value[3]);
431 return NGX_CONF_ERROR; 429 return NGX_CONF_ERROR;
432 } 430 }
433 } 431 }
434 } 432 }
435 433