comparison src/http/modules/ngx_http_static_handler.c @ 403:ea3113b181d1

nginx-0.0.9-2004-07-28-23:21:26 import
author Igor Sysoev <igor@sysoev.ru>
date Wed, 28 Jul 2004 19:21:26 +0000
parents 69e851f83522
children 3c56e834be46
comparison
equal deleted inserted replaced
402:f209f3391020 403:ea3113b181d1
481 481
482 r->headers_out.status = NGX_HTTP_OK; 482 r->headers_out.status = NGX_HTTP_OK;
483 r->headers_out.content_length_n = ngx_file_size(&fi); 483 r->headers_out.content_length_n = ngx_file_size(&fi);
484 r->headers_out.last_modified_time = ngx_file_mtime(&fi); 484 r->headers_out.last_modified_time = ngx_file_mtime(&fi);
485 485
486 if (r->headers_out.content_length_n == 0) {
487 r->header_only = 1;
488 }
489
486 if (ngx_http_set_content_type(r) != NGX_OK) { 490 if (ngx_http_set_content_type(r) != NGX_OK) {
487 return NGX_HTTP_INTERNAL_SERVER_ERROR; 491 return NGX_HTTP_INTERNAL_SERVER_ERROR;
488 } 492 }
489 493
490 494 #if (NGX_SUPPRESS_WARN)
491 /* we need to allocate all before the header would be sent */ 495 b = NULL;
492 496 #endif
493 if (!(b = ngx_pcalloc(r->pool, sizeof(ngx_buf_t)))) { 497
494 return NGX_HTTP_INTERNAL_SERVER_ERROR; 498 if (!r->header_only) {
495 } 499 /* we need to allocate all before the header would be sent */
496 500
497 if (!(b->file = ngx_pcalloc(r->pool, sizeof(ngx_file_t)))) { 501 if (!(b = ngx_pcalloc(r->pool, sizeof(ngx_buf_t)))) {
498 return NGX_HTTP_INTERNAL_SERVER_ERROR; 502 return NGX_HTTP_INTERNAL_SERVER_ERROR;
499 } 503 }
500 504
501 r->filter_allow_ranges = 1; 505 if (!(b->file = ngx_pcalloc(r->pool, sizeof(ngx_file_t)))) {
506 return NGX_HTTP_INTERNAL_SERVER_ERROR;
507 }
508
509 r->filter_allow_ranges = 1;
510 }
511
502 rc = ngx_http_send_header(r); 512 rc = ngx_http_send_header(r);
503 513
504 if (rc == NGX_ERROR || rc > NGX_OK || r->header_only) { 514 if (rc == NGX_ERROR || rc > NGX_OK || r->header_only) {
505 return rc; 515 return rc;
506 } 516 }