comparison src/mail/ngx_mail_auth_http_module.c @ 328:390b8f8309d6 NGINX_0_6_8

nginx 0.6.8 *) Change: now nginx tries to set the "worker_priority", "worker_rlimit_nofile", "worker_rlimit_core", and "worker_rlimit_sigpending" without super-user privileges. *) Change: now nginx escapes space and "%" in request to a mail proxy authentication server. *) Change: now nginx escapes "%" in $memcached_key variable. *) Bugfix: nginx used path relative to configuration prefix for non-absolute configuration file path specified in the "-c" key; bug appeared in 0.6.6. *) Bugfix: nginx did not work on FreeBSD/sparc64.
author Igor Sysoev <http://sysoev.ru>
date Mon, 20 Aug 2007 00:00:00 +0400
parents 9fc4ab6673f9
children 1c519aff5c0c
comparison
equal deleted inserted replaced
327:be18d26e067c 328:390b8f8309d6
1249 1249
1250 1250
1251 static ngx_int_t 1251 static ngx_int_t
1252 ngx_mail_auth_http_escape(ngx_pool_t *pool, ngx_str_t *text, ngx_str_t *escaped) 1252 ngx_mail_auth_http_escape(ngx_pool_t *pool, ngx_str_t *text, ngx_str_t *escaped)
1253 { 1253 {
1254 u_char ch, *p; 1254 u_char *p;
1255 ngx_uint_t i, n; 1255 uintptr_t n;
1256 1256
1257 n = 0; 1257 n = ngx_escape_uri(NULL, text->data, text->len, NGX_ESCAPE_MAIL_AUTH);
1258
1259 for (i = 0; i < text->len; i++) {
1260 ch = text->data[i];
1261
1262 if (ch == CR || ch == LF) {
1263 n++;
1264 }
1265 }
1266 1258
1267 if (n == 0) { 1259 if (n == 0) {
1268 *escaped = *text; 1260 *escaped = *text;
1269 return NGX_OK; 1261 return NGX_OK;
1270 } 1262 }
1274 p = ngx_palloc(pool, escaped->len); 1266 p = ngx_palloc(pool, escaped->len);
1275 if (p == NULL) { 1267 if (p == NULL) {
1276 return NGX_ERROR; 1268 return NGX_ERROR;
1277 } 1269 }
1278 1270
1271 (void) ngx_escape_uri(p, text->data, text->len, NGX_ESCAPE_MAIL_AUTH);
1272
1279 escaped->data = p; 1273 escaped->data = p;
1280
1281 for (i = 0; i < text->len; i++) {
1282 ch = text->data[i];
1283
1284 if (ch == CR) {
1285 *p++ = '%';
1286 *p++ = '0';
1287 *p++ = 'D';
1288 continue;
1289 }
1290
1291 if (ch == LF) {
1292 *p++ = '%';
1293 *p++ = '0';
1294 *p++ = 'A';
1295 continue;
1296 }
1297
1298 *p++ = ch;
1299 }
1300 1274
1301 return NGX_OK; 1275 return NGX_OK;
1302 } 1276 }
1303 1277
1304 1278