comparison src/http/modules/ngx_http_index_module.c @ 252:644510700914 NGINX_0_4_11

nginx 0.4.11 *) Feature: the POP3 proxy supports the AUTH LOGIN PLAIN and CRAM-MD5. *) Feature: the ngx_http_perl_module supports the $r->allow_ranges method. *) Bugfix: if the APOP was enabled in the POP3 proxy, then the USER/PASS commands might not work; bug appeared in 0.4.10.
author Igor Sysoev <http://sysoev.ru>
date Wed, 25 Oct 2006 00:00:00 +0400
parents acd2ec3541cb
children 29a6403156b0
comparison
equal deleted inserted replaced
251:16ffa8ae5759 252:644510700914
313 313
314 314
315 static ngx_int_t 315 static ngx_int_t
316 ngx_http_index_test_dir(ngx_http_request_t *r, ngx_http_index_ctx_t *ctx) 316 ngx_http_index_test_dir(ngx_http_request_t *r, ngx_http_index_ctx_t *ctx)
317 { 317 {
318 u_char c;
319 ngx_uint_t i;
318 ngx_err_t err; 320 ngx_err_t err;
319 ngx_file_info_t fi; 321 ngx_file_info_t fi;
320 322
321 *(ctx->index.data - 1) = '\0'; 323 c = *(ctx->index.data - 1);
324 i = (c == '/') ? 1 : 0;
325 *(ctx->index.data - i) = '\0';
322 326
323 ngx_log_debug1(NGX_LOG_DEBUG_HTTP, r->connection->log, 0, 327 ngx_log_debug1(NGX_LOG_DEBUG_HTTP, r->connection->log, 0,
324 "http index check dir: \"%s\"", ctx->path.data); 328 "http index check dir: \"%s\"", ctx->path.data);
325 329
326 if (ngx_file_info(ctx->path.data, &fi) == -1) { 330 if (ngx_file_info(ctx->path.data, &fi) == -1) {
327 331
328 err = ngx_errno; 332 err = ngx_errno;
329 333
330 if (err == NGX_ENOENT) { 334 if (err == NGX_ENOENT) {
331 *(ctx->index.data - 1) = '/'; 335 *(ctx->index.data - i) = c;
332 return ngx_http_index_error(r, ctx, err); 336 return ngx_http_index_error(r, ctx, err);
333 } 337 }
334 338
335 ngx_log_error(NGX_LOG_CRIT, r->connection->log, err, 339 ngx_log_error(NGX_LOG_CRIT, r->connection->log, err,
336 ngx_file_info_n " \"%s\" failed", ctx->path.data); 340 ngx_file_info_n " \"%s\" failed", ctx->path.data);
337 341
338 return NGX_HTTP_INTERNAL_SERVER_ERROR; 342 return NGX_HTTP_INTERNAL_SERVER_ERROR;
339 } 343 }
340 344
341 *(ctx->index.data - 1) = '/'; 345 *(ctx->index.data - i) = c;
342 346
343 if (ngx_is_dir(&fi)) { 347 if (ngx_is_dir(&fi)) {
344 return NGX_OK; 348 return NGX_OK;
345 } 349 }
346 350