mirror of
https://github.com/nginx/nginx.git
synced 2025-06-08 02:02:38 +08:00
nginx-0.0.9-2004-07-28-23:21:26 import
This commit is contained in:
parent
5ec68f6453
commit
00d433f4f8
@ -59,6 +59,17 @@ ngx_int_t ngx_output_chain(ngx_output_chain_ctx_t *ctx, ngx_chain_t *in)
|
|||||||
* or there are the free output bufs to copy in
|
* or there are the free output bufs to copy in
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
bsize = ngx_buf_size(ctx->in->buf);
|
||||||
|
|
||||||
|
if (bsize == 0 && !ngx_buf_special(ctx->in->buf)) {
|
||||||
|
|
||||||
|
ngx_log_error(NGX_LOG_ALERT, ctx->pool->log, 0,
|
||||||
|
"zero size buf");
|
||||||
|
|
||||||
|
ctx->in = ctx->in->next;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
if (!ngx_output_chain_need_to_copy(ctx, ctx->in->buf)) {
|
if (!ngx_output_chain_need_to_copy(ctx, ctx->in->buf)) {
|
||||||
|
|
||||||
/* move the chain link to the output chain */
|
/* move the chain link to the output chain */
|
||||||
@ -73,13 +84,6 @@ ngx_int_t ngx_output_chain(ngx_output_chain_ctx_t *ctx, ngx_chain_t *in)
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
bsize = ngx_buf_size(ctx->in->buf);
|
|
||||||
|
|
||||||
if (bsize == 0) {
|
|
||||||
ctx->in = ctx->in->next;
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (ctx->buf == NULL) {
|
if (ctx->buf == NULL) {
|
||||||
|
|
||||||
/* get the free buf */
|
/* get the free buf */
|
||||||
|
@ -483,22 +483,32 @@ static ngx_int_t ngx_http_static_handler(ngx_http_request_t *r)
|
|||||||
r->headers_out.content_length_n = ngx_file_size(&fi);
|
r->headers_out.content_length_n = ngx_file_size(&fi);
|
||||||
r->headers_out.last_modified_time = ngx_file_mtime(&fi);
|
r->headers_out.last_modified_time = ngx_file_mtime(&fi);
|
||||||
|
|
||||||
|
if (r->headers_out.content_length_n == 0) {
|
||||||
|
r->header_only = 1;
|
||||||
|
}
|
||||||
|
|
||||||
if (ngx_http_set_content_type(r) != NGX_OK) {
|
if (ngx_http_set_content_type(r) != NGX_OK) {
|
||||||
return NGX_HTTP_INTERNAL_SERVER_ERROR;
|
return NGX_HTTP_INTERNAL_SERVER_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if (NGX_SUPPRESS_WARN)
|
||||||
|
b = NULL;
|
||||||
|
#endif
|
||||||
|
|
||||||
/* we need to allocate all before the header would be sent */
|
if (!r->header_only) {
|
||||||
|
/* we need to allocate all before the header would be sent */
|
||||||
|
|
||||||
if (!(b = ngx_pcalloc(r->pool, sizeof(ngx_buf_t)))) {
|
if (!(b = ngx_pcalloc(r->pool, sizeof(ngx_buf_t)))) {
|
||||||
return NGX_HTTP_INTERNAL_SERVER_ERROR;
|
return NGX_HTTP_INTERNAL_SERVER_ERROR;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!(b->file = ngx_pcalloc(r->pool, sizeof(ngx_file_t)))) {
|
||||||
|
return NGX_HTTP_INTERNAL_SERVER_ERROR;
|
||||||
|
}
|
||||||
|
|
||||||
|
r->filter_allow_ranges = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!(b->file = ngx_pcalloc(r->pool, sizeof(ngx_file_t)))) {
|
|
||||||
return NGX_HTTP_INTERNAL_SERVER_ERROR;
|
|
||||||
}
|
|
||||||
|
|
||||||
r->filter_allow_ranges = 1;
|
|
||||||
rc = ngx_http_send_header(r);
|
rc = ngx_http_send_header(r);
|
||||||
|
|
||||||
if (rc == NGX_ERROR || rc > NGX_OK || r->header_only) {
|
if (rc == NGX_ERROR || rc > NGX_OK || r->header_only) {
|
||||||
|
@ -40,7 +40,7 @@ ngx_module_t ngx_http_write_filter_module = {
|
|||||||
ngx_int_t ngx_http_write_filter(ngx_http_request_t *r, ngx_chain_t *in)
|
ngx_int_t ngx_http_write_filter(ngx_http_request_t *r, ngx_chain_t *in)
|
||||||
{
|
{
|
||||||
int last;
|
int last;
|
||||||
off_t size, flush, sent, bsize;
|
off_t size, flush, sent;
|
||||||
ngx_chain_t *cl, *ln, **ll, *chain;
|
ngx_chain_t *cl, *ln, **ll, *chain;
|
||||||
ngx_connection_t *c;
|
ngx_connection_t *c;
|
||||||
ngx_http_core_loc_conf_t *clcf;
|
ngx_http_core_loc_conf_t *clcf;
|
||||||
@ -82,13 +82,7 @@ ngx_int_t ngx_http_write_filter(ngx_http_request_t *r, ngx_chain_t *in)
|
|||||||
*ll = cl;
|
*ll = cl;
|
||||||
ll = &cl->next;
|
ll = &cl->next;
|
||||||
|
|
||||||
bsize = ngx_buf_size(cl->buf);
|
size += ngx_buf_size(cl->buf);
|
||||||
|
|
||||||
if (bsize == 0 && cl->buf->in_file) {
|
|
||||||
cl->buf->in_file = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
size += bsize;
|
|
||||||
|
|
||||||
if (cl->buf->flush || cl->buf->recycled) {
|
if (cl->buf->flush || cl->buf->recycled) {
|
||||||
flush = size;
|
flush = size;
|
||||||
|
Loading…
Reference in New Issue
Block a user