Skip to content

Commit

Permalink
Don't set last_buf=1 (duplicated last chunk issue).
Browse files Browse the repository at this point in the history
Because ngx_http_upstream_finalize_request sends NGX_HTTP_LAST,
having last_buf=1 in our module meant that last two chains always
had last_buf=1, which resulted in duplicated last chunk sent for
HTTP/1.1 requests. This pretty much killed keep-alived requests.

Reported by Silly Sad, diagnosed by Maxim Dounin.

Same issue was independently diagnosed and fixed in ngx_drizzle
by Yichun Zhang (agentzh) few days ago.
  • Loading branch information
PiotrSikora committed Jun 17, 2011
1 parent 9a7ee95 commit 74e74ac
Showing 1 changed file with 0 additions and 4 deletions.
4 changes: 0 additions & 4 deletions src/ngx_postgres_output.c
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -124,7 +124,6 @@ ngx_postgres_output_value(ngx_http_request_t *r, PGresult *res,
cl->buf = b; cl->buf = b;
b->memory = 1; b->memory = 1;
b->tag = r->upstream->output.tag; b->tag = r->upstream->output.tag;
b->last_buf = 1;


b->last = ngx_copy(b->last, PQgetvalue(res, pgv->row, col), size); b->last = ngx_copy(b->last, PQgetvalue(res, pgv->row, col), size);


Expand Down Expand Up @@ -209,7 +208,6 @@ ngx_postgres_output_row(ngx_http_request_t *r, PGresult *res,
cl->buf = b; cl->buf = b;
b->memory = 1; b->memory = 1;
b->tag = r->upstream->output.tag; b->tag = r->upstream->output.tag;
b->last_buf = 1;


/* fill data */ /* fill data */
for (col = 0; col < col_count - 1; col++) { for (col = 0; col < col_count - 1; col++) {
Expand Down Expand Up @@ -521,7 +519,6 @@ ngx_postgres_render_rds_row(ngx_http_request_t *r, ngx_pool_t *pool,
} }


if (last_row) { if (last_row) {
b->last_buf = 1;
*b->last++ = (uint8_t) 0; /* row terminator */ *b->last++ = (uint8_t) 0; /* row terminator */
} }


Expand Down Expand Up @@ -557,7 +554,6 @@ ngx_postgres_render_rds_row_terminator(ngx_http_request_t *r, ngx_pool_t *pool)
cl->buf = b; cl->buf = b;
b->memory = 1; b->memory = 1;
b->tag = r->upstream->output.tag; b->tag = r->upstream->output.tag;
b->last_buf = 1;


/* fill data */ /* fill data */
*b->last++ = (uint8_t) 0; /* row terminator */ *b->last++ = (uint8_t) 0; /* row terminator */
Expand Down

0 comments on commit 74e74ac

Please sign in to comment.