mirror of
https://github.com/nginx/nginx.git
synced 2025-06-10 19:42:39 +08:00
nginx-0.0.1-2003-04-15-19:06:52 import
This commit is contained in:
parent
9e4920b810
commit
153d743b07
@ -18,8 +18,10 @@ ngx_hunk_t *ngx_create_temp_hunk(ngx_pool_t *pool, int size,
|
|||||||
h->post_end = h->end + after;
|
h->post_end = h->end + after;
|
||||||
|
|
||||||
h->type = NGX_HUNK_TEMP|NGX_HUNK_IN_MEMORY;
|
h->type = NGX_HUNK_TEMP|NGX_HUNK_IN_MEMORY;
|
||||||
h->tag = 0;
|
|
||||||
h->file = NULL;
|
h->file = NULL;
|
||||||
|
h->shadow = NULL;
|
||||||
|
|
||||||
|
h->tag = 0;
|
||||||
|
|
||||||
return h;
|
return h;
|
||||||
}
|
}
|
||||||
@ -38,8 +40,10 @@ ngx_hunk_t *ngx_create_hunk_before(ngx_pool_t *pool, ngx_hunk_t *hunk, int size)
|
|||||||
h->file_pos = h->file_last = 0;
|
h->file_pos = h->file_last = 0;
|
||||||
|
|
||||||
h->type = NGX_HUNK_TEMP|NGX_HUNK_IN_MEMORY;
|
h->type = NGX_HUNK_TEMP|NGX_HUNK_IN_MEMORY;
|
||||||
h->tag = 0;
|
|
||||||
h->file = NULL;
|
h->file = NULL;
|
||||||
|
h->shadow = NULL;
|
||||||
|
|
||||||
|
h->tag = 0;
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
ngx_test_null(h->pre_start, ngx_palloc(pool, size), NULL);
|
ngx_test_null(h->pre_start, ngx_palloc(pool, size), NULL);
|
||||||
@ -48,8 +52,10 @@ ngx_hunk_t *ngx_create_hunk_before(ngx_pool_t *pool, ngx_hunk_t *hunk, int size)
|
|||||||
h->file_pos = h->file_last = 0;
|
h->file_pos = h->file_last = 0;
|
||||||
|
|
||||||
h->type = NGX_HUNK_TEMP|NGX_HUNK_IN_MEMORY;
|
h->type = NGX_HUNK_TEMP|NGX_HUNK_IN_MEMORY;
|
||||||
h->tag = 0;
|
|
||||||
h->file = NULL;
|
h->file = NULL;
|
||||||
|
h->shadow = NULL;
|
||||||
|
|
||||||
|
h->tag = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
return h;
|
return h;
|
||||||
@ -71,8 +77,10 @@ ngx_hunk_t *ngx_create_hunk_after(ngx_pool_t *pool, ngx_hunk_t *hunk, int size)
|
|||||||
h->file_pos = h->file_last = 0;
|
h->file_pos = h->file_last = 0;
|
||||||
|
|
||||||
h->type = NGX_HUNK_TEMP|NGX_HUNK_IN_MEMORY;
|
h->type = NGX_HUNK_TEMP|NGX_HUNK_IN_MEMORY;
|
||||||
h->tag = 0;
|
|
||||||
h->file = NULL;
|
h->file = NULL;
|
||||||
|
h->shadow = NULL;
|
||||||
|
|
||||||
|
h->tag = 0;
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
ngx_test_null(h->pre_start, ngx_palloc(pool, size), NULL);
|
ngx_test_null(h->pre_start, ngx_palloc(pool, size), NULL);
|
||||||
@ -81,8 +89,10 @@ ngx_hunk_t *ngx_create_hunk_after(ngx_pool_t *pool, ngx_hunk_t *hunk, int size)
|
|||||||
h->file_pos = h->file_last = 0;
|
h->file_pos = h->file_last = 0;
|
||||||
|
|
||||||
h->type = NGX_HUNK_TEMP|NGX_HUNK_IN_MEMORY;
|
h->type = NGX_HUNK_TEMP|NGX_HUNK_IN_MEMORY;
|
||||||
h->tag = 0;
|
|
||||||
h->file = NULL;
|
h->file = NULL;
|
||||||
|
h->shadow = NULL;
|
||||||
|
|
||||||
|
h->tag = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
return h;
|
return h;
|
||||||
|
@ -79,7 +79,7 @@ ngx_hunk_t *ngx_create_temp_hunk(ngx_pool_t *pool, int size,
|
|||||||
|
|
||||||
#define ngx_add_hunk_to_chain(chain, h, pool, error) \
|
#define ngx_add_hunk_to_chain(chain, h, pool, error) \
|
||||||
do { \
|
do { \
|
||||||
ngx_test_null(chain, ngx_create_chain_entry(pool), error); \
|
ngx_test_null(chain, ngx_alloc_chain_entry(pool), error); \
|
||||||
chain->hunk = h; \
|
chain->hunk = h; \
|
||||||
chain->next = NULL; \
|
chain->next = NULL; \
|
||||||
} while (0);
|
} while (0);
|
||||||
|
@ -2,12 +2,29 @@
|
|||||||
#include <ngx_event_proxy.h>
|
#include <ngx_event_proxy.h>
|
||||||
|
|
||||||
|
|
||||||
|
#define NGX_EVENT_COPY_FILTER 0
|
||||||
|
|
||||||
|
#if (NGX_EVENT_COPY_FILTER)
|
||||||
|
static int ngx_event_proxy_copy_input_filter(ngx_event_proxy_t *p,
|
||||||
|
ngx_chain_t *chain);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
int ngx_event_proxy_read_upstream(ngx_event_proxy_t *p)
|
int ngx_event_proxy_read_upstream(ngx_event_proxy_t *p)
|
||||||
{
|
{
|
||||||
int n, rc, size;
|
int n, rc, size;
|
||||||
ngx_hunk_t *h, *nh;
|
ngx_hunk_t *h, *nh;
|
||||||
ngx_chain_t *chain, *temp, *entry, *next;
|
ngx_chain_t *chain, *temp, *entry, *next;
|
||||||
|
|
||||||
|
#if (NGX_EVENT_COPY_FILTER)
|
||||||
|
|
||||||
|
if (p->input_filter == NULL) {
|
||||||
|
p->input_filter = ngx_event_proxy_copy_input_filter;
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
p->level++;
|
p->level++;
|
||||||
|
|
||||||
ngx_log_debug(p->log, "read upstream");
|
ngx_log_debug(p->log, "read upstream");
|
||||||
@ -45,7 +62,8 @@ ngx_log_debug(p->log, "new hunk: %08X" _ chain->hunk);
|
|||||||
chain = p->shadow_hunks;
|
chain = p->shadow_hunks;
|
||||||
p->shadow_hunks = NULL;
|
p->shadow_hunks = NULL;
|
||||||
|
|
||||||
ngx_log_debug(p->log, "shadow hunk: %08X" _ chain->hunk);
|
ngx_log_debug(p->log, "shadow hunk: %08X" _ chain->hunk _
|
||||||
|
chain->hunk->end - chain->hunk->last);
|
||||||
|
|
||||||
/* if it's allowed then save the incoming hunks to a temporary file,
|
/* if it's allowed then save the incoming hunks to a temporary file,
|
||||||
move the saved hunks to a shadow chain,
|
move the saved hunks to a shadow chain,
|
||||||
@ -63,7 +81,8 @@ ngx_log_debug(p->log, "temp offset: %d" _ p->temp_offset);
|
|||||||
chain = p->shadow_hunks;
|
chain = p->shadow_hunks;
|
||||||
p->shadow_hunks = NULL;
|
p->shadow_hunks = NULL;
|
||||||
|
|
||||||
ngx_log_debug(p->log, "new shadow hunk: %08X" _ chain->hunk);
|
ngx_log_debug(p->log, "new shadow hunk: %08X:%d" _ chain->hunk _
|
||||||
|
chain->hunk->end - chain->hunk->last);
|
||||||
|
|
||||||
/* if there're no hunks to read in then disable a level event */
|
/* if there're no hunks to read in then disable a level event */
|
||||||
|
|
||||||
@ -97,7 +116,9 @@ ngx_log_debug(p->log, "recv_chain: %d" _ n);
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (n == 0) {
|
if (n == 0) {
|
||||||
p->free_hunks = chain;
|
if (chain->hunk->shadow == NULL) {
|
||||||
|
p->free_hunks = chain;
|
||||||
|
}
|
||||||
p->upstream_eof = 1;
|
p->upstream_eof = 1;
|
||||||
p->block_upstream = 0;
|
p->block_upstream = 0;
|
||||||
break;
|
break;
|
||||||
@ -147,29 +168,35 @@ ngx_log_debug(p->log, "recv_chain: %d" _ n);
|
|||||||
|
|
||||||
n -= size;
|
n -= size;
|
||||||
|
|
||||||
/* the copy input filter */
|
#if !(NGX_EVENT_COPY_FILTER)
|
||||||
|
|
||||||
if (p->input_filter == NULL) {
|
if (p->input_filter) {
|
||||||
ngx_test_null(h, ngx_alloc_hunk(p->pool), NGX_ERROR);
|
continue;
|
||||||
ngx_memcpy(h, entry->hunk, sizeof(ngx_hunk_t));
|
|
||||||
h->shadow = entry->hunk;
|
|
||||||
h->type |= NGX_HUNK_LAST_SHADOW;
|
|
||||||
|
|
||||||
ngx_test_null(temp, ngx_alloc_chain_entry(p->pool),
|
|
||||||
NGX_ERROR);
|
|
||||||
temp->hunk = h;
|
|
||||||
temp->next = NULL;
|
|
||||||
|
|
||||||
if (p->in_hunks) {
|
|
||||||
p->last_in_hunk->next = temp;
|
|
||||||
|
|
||||||
} else {
|
|
||||||
p->in_hunks = temp;
|
|
||||||
}
|
|
||||||
|
|
||||||
p->last_in_hunk = temp;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* the inline copy input filter */
|
||||||
|
|
||||||
|
ngx_test_null(h, ngx_alloc_hunk(p->pool), NGX_ERROR);
|
||||||
|
ngx_memcpy(h, entry->hunk, sizeof(ngx_hunk_t));
|
||||||
|
h->shadow = entry->hunk;
|
||||||
|
h->type |= NGX_HUNK_LAST_SHADOW;
|
||||||
|
entry->hunk->shadow = h;
|
||||||
|
|
||||||
|
ngx_test_null(temp, ngx_alloc_chain_entry(p->pool),
|
||||||
|
NGX_ERROR);
|
||||||
|
temp->hunk = h;
|
||||||
|
temp->next = NULL;
|
||||||
|
|
||||||
|
if (p->in_hunks) {
|
||||||
|
p->last_in_hunk->next = temp;
|
||||||
|
|
||||||
|
} else {
|
||||||
|
p->in_hunks = temp;
|
||||||
|
}
|
||||||
|
|
||||||
|
p->last_in_hunk = temp;
|
||||||
|
#endif
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
entry->hunk->last += n;
|
entry->hunk->last += n;
|
||||||
p->free_hunks = entry;
|
p->free_hunks = entry;
|
||||||
@ -178,6 +205,19 @@ ngx_log_debug(p->log, "recv_chain: %d" _ n);
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (chain == p->free_hunks) {
|
||||||
|
chain = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* the input filter i.e. that moves HTTP/1.1 chunks
|
||||||
|
from a read chain to an incoming chain */
|
||||||
|
|
||||||
|
if (p->input_filter) {
|
||||||
|
if (p->input_filter(p, chain) == NGX_ERROR) {
|
||||||
|
return NGX_ERROR;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
ngx_log_debug(p->log, "rest chain: %08X" _ entry);
|
ngx_log_debug(p->log, "rest chain: %08X" _ entry);
|
||||||
|
|
||||||
/* if the rest hunks are shadow then move them to a shadow chain
|
/* if the rest hunks are shadow then move them to a shadow chain
|
||||||
@ -199,15 +239,6 @@ ngx_log_debug(p->log, "rest chain: %08X" _ entry);
|
|||||||
p->block_upstream = 0;
|
p->block_upstream = 0;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* the input filter i.e. that moves HTTP/1.1 chunks
|
|
||||||
from a read chain to an incoming chain */
|
|
||||||
|
|
||||||
if (p->input_filter) {
|
|
||||||
if (p->input_filter(p) == NGX_ERROR) {
|
|
||||||
return NGX_ERROR;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ngx_log_debug(p->log, "eof: %d block: %d" _
|
ngx_log_debug(p->log, "eof: %d block: %d" _
|
||||||
@ -222,8 +253,15 @@ ngx_log_debug(p->log, "eof: %d block: %d" _
|
|||||||
if (p->free_hunks
|
if (p->free_hunks
|
||||||
&& p->free_hunks->hunk->pos < p->free_hunks->hunk->last)
|
&& p->free_hunks->hunk->pos < p->free_hunks->hunk->last)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
#if (NGX_EVENT_COPY_FILTER)
|
||||||
|
|
||||||
|
if (p->input_filter(p, NULL) == NGX_ERROR) {
|
||||||
|
return NGX_ERROR;
|
||||||
|
}
|
||||||
|
#else
|
||||||
if (p->input_filter) {
|
if (p->input_filter) {
|
||||||
if (p->input_filter(p) == NGX_ERROR) {
|
if (p->input_filter(p, NULL) == NGX_ERROR) {
|
||||||
return NGX_ERROR;
|
return NGX_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -242,6 +280,7 @@ ngx_log_debug(p->log, "eof: %d block: %d" _
|
|||||||
|
|
||||||
p->free_hunks = entry->next;
|
p->free_hunks = entry->next;
|
||||||
entry->next = NULL;
|
entry->next = NULL;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
@ -314,6 +353,7 @@ ngx_log_debug(p->log, "write to client");
|
|||||||
entry = p->out_hunks;
|
entry = p->out_hunks;
|
||||||
p->out_hunks = entry->next;
|
p->out_hunks = entry->next;
|
||||||
h = entry->hunk;
|
h = entry->hunk;
|
||||||
|
entry->next = NULL;
|
||||||
|
|
||||||
if (p->shadow_hunks) {
|
if (p->shadow_hunks) {
|
||||||
if (p->shadow_hunks->hunk == h->shadow) {
|
if (p->shadow_hunks->hunk == h->shadow) {
|
||||||
@ -321,16 +361,24 @@ ngx_log_debug(p->log, "write to client");
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
entry->next = NULL;
|
|
||||||
|
|
||||||
} else if (p->cachable == 0 && p->in_hunks) {
|
} else if (p->cachable == 0 && p->in_hunks) {
|
||||||
entry = p->in_hunks;
|
entry = p->in_hunks;
|
||||||
p->in_hunks = entry->next;
|
p->in_hunks = entry->next;
|
||||||
h = entry->hunk;
|
h = entry->hunk;
|
||||||
entry->next = NULL;
|
entry->next = NULL;
|
||||||
|
|
||||||
|
if (p->read_hunks) {
|
||||||
|
if (p->read_hunks->hunk == h->shadow) {
|
||||||
|
p->read_hunks = p->read_hunks->next;
|
||||||
|
|
||||||
|
} else {
|
||||||
|
ngx_log_error(NGX_LOG_CRIT, p->log, 0, "ERROR !!!");
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ngx_log_debug(p->log, "event proxy write hunk: %08X:%08X" _ h _ h->pos);
|
ngx_log_debug(p->log, "event proxy write hunk: %08X" _ h);
|
||||||
|
|
||||||
if (h == NULL) {
|
if (h == NULL) {
|
||||||
if (p->upstream->read->ready) {
|
if (p->upstream->read->ready) {
|
||||||
@ -341,7 +389,9 @@ ngx_log_debug(p->log, "event proxy write hunk: %08X:%08X" _ h _ h->pos);
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if 0
|
||||||
ngx_log_debug(p->log, "event proxy write: %d" _ h->last - h->pos);
|
ngx_log_debug(p->log, "event proxy write: %d" _ h->last - h->pos);
|
||||||
|
#endif
|
||||||
|
|
||||||
rc = p->output_filter(p->output_data, h);
|
rc = p->output_filter(p->output_data, h);
|
||||||
|
|
||||||
@ -485,10 +535,10 @@ ngx_log_debug(p->log, "write to file");
|
|||||||
p->temp_offset += h->last - h->pos;
|
p->temp_offset += h->last - h->pos;
|
||||||
h->file_last = p->temp_offset;
|
h->file_last = p->temp_offset;
|
||||||
|
|
||||||
ngx_log_debug(p->log, "event proxy file hunk: %08X:%08X" _ h _ h->pos);
|
ngx_log_debug(p->log, "event proxy file hunk: %08X:%08X" _ h _ h->shadow);
|
||||||
|
|
||||||
if (entry->hunk->type & NGX_HUNK_LAST_SHADOW) {
|
if (h->type & NGX_HUNK_LAST_SHADOW) {
|
||||||
entry->hunk->shadow->last = entry->hunk->shadow->pos;
|
h->shadow->last = h->shadow->pos;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (p->out_hunks) {
|
if (p->out_hunks) {
|
||||||
@ -508,3 +558,57 @@ ngx_log_debug(p->log, "event proxy file hunk: %08X:%08X" _ h _ h->pos);
|
|||||||
|
|
||||||
return NGX_OK;
|
return NGX_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if (NGX_EVENT_COPY_FILTER)
|
||||||
|
|
||||||
|
/* the copy input filter */
|
||||||
|
|
||||||
|
static int ngx_event_proxy_copy_input_filter(ngx_event_proxy_t *p,
|
||||||
|
ngx_chain_t *chain)
|
||||||
|
{
|
||||||
|
ngx_hunk_t *h;
|
||||||
|
ngx_chain_t *entry, *temp;
|
||||||
|
|
||||||
|
if (p->upstream_eof) {
|
||||||
|
entry = p->free_hunks;
|
||||||
|
|
||||||
|
if (p->in_hunks) {
|
||||||
|
p->last_in_hunk->next = entry;
|
||||||
|
|
||||||
|
} else {
|
||||||
|
p->in_hunks = entry;
|
||||||
|
}
|
||||||
|
|
||||||
|
p->last_in_hunk = entry;
|
||||||
|
|
||||||
|
p->free_hunks = entry->next;
|
||||||
|
entry->next = NULL;
|
||||||
|
|
||||||
|
return NGX_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (entry = chain; entry; entry = entry->next) {
|
||||||
|
ngx_test_null(h, ngx_alloc_hunk(p->pool), NGX_ERROR);
|
||||||
|
ngx_memcpy(h, entry->hunk, sizeof(ngx_hunk_t));
|
||||||
|
h->shadow = entry->hunk;
|
||||||
|
h->type |= NGX_HUNK_LAST_SHADOW;
|
||||||
|
entry->hunk->shadow = h;
|
||||||
|
|
||||||
|
ngx_test_null(temp, ngx_alloc_chain_entry(p->pool), NGX_ERROR);
|
||||||
|
temp->hunk = h;
|
||||||
|
temp->next = NULL;
|
||||||
|
|
||||||
|
if (p->in_hunks) {
|
||||||
|
p->last_in_hunk->next = temp;
|
||||||
|
|
||||||
|
} else {
|
||||||
|
p->in_hunks = temp;
|
||||||
|
}
|
||||||
|
|
||||||
|
p->last_in_hunk = temp;
|
||||||
|
}
|
||||||
|
|
||||||
|
return NGX_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
|
@ -12,7 +12,8 @@
|
|||||||
|
|
||||||
typedef struct ngx_event_proxy_s ngx_event_proxy_t;
|
typedef struct ngx_event_proxy_s ngx_event_proxy_t;
|
||||||
|
|
||||||
typedef int (*ngx_event_proxy_input_filter_pt)(ngx_event_proxy_t *p);
|
typedef int (*ngx_event_proxy_input_filter_pt)(ngx_event_proxy_t *p,
|
||||||
|
ngx_chain_t *chain);
|
||||||
typedef int (*ngx_event_proxy_output_filter_pt)(void *data, ngx_hunk_t *hunk);
|
typedef int (*ngx_event_proxy_output_filter_pt)(void *data, ngx_hunk_t *hunk);
|
||||||
|
|
||||||
|
|
||||||
|
@ -871,7 +871,7 @@ static int ngx_http_proxy_read_upstream_header(ngx_http_proxy_ctx_t *p)
|
|||||||
ep->number = 10;
|
ep->number = 10;
|
||||||
ep->random = 5;
|
ep->random = 5;
|
||||||
|
|
||||||
ep->max_temp_size = 6000;
|
ep->max_temp_size = p->lcf->max_temp_file_size;
|
||||||
ep->temp_file_warn = "an upstream response is buffered "
|
ep->temp_file_warn = "an upstream response is buffered "
|
||||||
"to a temporary file";
|
"to a temporary file";
|
||||||
|
|
||||||
@ -1763,9 +1763,18 @@ static void *ngx_http_proxy_create_loc_conf(ngx_pool_t *pool)
|
|||||||
conf->send_timeout = 10000;
|
conf->send_timeout = 10000;
|
||||||
conf->read_timeout = 10000;
|
conf->read_timeout = 10000;
|
||||||
conf->header_size = 1024;
|
conf->header_size = 1024;
|
||||||
|
|
||||||
|
#if 0
|
||||||
conf->block_size = 4096;
|
conf->block_size = 4096;
|
||||||
conf->max_block_size = 4096 * 3;
|
conf->max_block_size = 4096 * 3;
|
||||||
conf->file_block_size = 4096;
|
conf->max_temp_file_size = 4096 * 5;
|
||||||
|
conf->file_block_size = 4096 * 2;
|
||||||
|
#else
|
||||||
|
conf->block_size = 2048;
|
||||||
|
conf->max_block_size = 4096 * 6;
|
||||||
|
conf->max_temp_file_size = 4096 * 5;
|
||||||
|
conf->file_block_size = 4096 * 5;
|
||||||
|
#endif
|
||||||
|
|
||||||
ngx_test_null(conf->temp_path, ngx_pcalloc(pool, sizeof(ngx_path_t)), NULL);
|
ngx_test_null(conf->temp_path, ngx_pcalloc(pool, sizeof(ngx_path_t)), NULL);
|
||||||
|
|
||||||
|
@ -71,6 +71,7 @@ typedef struct {
|
|||||||
|
|
||||||
int block_size;
|
int block_size;
|
||||||
int max_block_size;
|
int max_block_size;
|
||||||
|
int max_temp_file_size;
|
||||||
int file_block_size;
|
int file_block_size;
|
||||||
|
|
||||||
ngx_path_t *temp_path;
|
ngx_path_t *temp_path;
|
||||||
|
@ -157,7 +157,7 @@ int ngx_http_handler(ngx_http_request_t *r)
|
|||||||
|
|
||||||
r->connection->unexpected_eof = 0;
|
r->connection->unexpected_eof = 0;
|
||||||
|
|
||||||
r->keepalive = 1;
|
r->keepalive = 0;
|
||||||
r->lingering_close = 1;
|
r->lingering_close = 1;
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
|
@ -65,7 +65,7 @@ static int (*next_filter) (ngx_http_request_t *r, ngx_chain_t *ch);
|
|||||||
|
|
||||||
#define need_to_copy(r, hunk) \
|
#define need_to_copy(r, hunk) \
|
||||||
(((r->filter & NGX_HTTP_FILTER_NEED_IN_MEMORY) \
|
(((r->filter & NGX_HTTP_FILTER_NEED_IN_MEMORY) \
|
||||||
&& (hunk->type & NGX_HUNK_FILE)) \
|
&& (hunk->type & NGX_HUNK_IN_MEMORY) == 0) \
|
||||||
|| ((r->filter & NGX_HTTP_FILTER_NEED_TEMP) \
|
|| ((r->filter & NGX_HTTP_FILTER_NEED_TEMP) \
|
||||||
&& (hunk->type & (NGX_HUNK_MEMORY|NGX_HUNK_MMAP))))
|
&& (hunk->type & (NGX_HUNK_MEMORY|NGX_HUNK_MMAP))))
|
||||||
|
|
||||||
@ -257,12 +257,12 @@ static int ngx_http_output_filter_copy_hunk(ngx_hunk_t *dst, ngx_hunk_t *src)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (src->type & NGX_HUNK_IN_MEMORY) {
|
if (src->type & NGX_HUNK_IN_MEMORY) {
|
||||||
ngx_memcpy(src->pos, dst->pos, size);
|
ngx_memcpy(dst->pos, src->pos, size);
|
||||||
src->pos += size;
|
src->pos += size;
|
||||||
dst->last += size;
|
dst->last += size;
|
||||||
|
|
||||||
if (src->type & NGX_HUNK_FILE) {
|
if (src->type & NGX_HUNK_FILE) {
|
||||||
src->file_pos += n;
|
src->file_pos += size;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((src->type & NGX_HUNK_LAST) && src->pos == src->last) {
|
if ((src->type & NGX_HUNK_LAST) && src->pos == src->last) {
|
||||||
|
Loading…
Reference in New Issue
Block a user