Skip to content

Commit 74e74ac

Browse files
committed
Don't set last_buf=1 (duplicated last chunk issue).
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.
1 parent 9a7ee95 commit 74e74ac

File tree

1 file changed

+0
-4
lines changed

1 file changed

+0
-4
lines changed

src/ngx_postgres_output.c

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,6 @@ ngx_postgres_output_value(ngx_http_request_t *r, PGresult *res,
124124
cl->buf = b;
125125
b->memory = 1;
126126
b->tag = r->upstream->output.tag;
127-
b->last_buf = 1;
128127

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

@@ -209,7 +208,6 @@ ngx_postgres_output_row(ngx_http_request_t *r, PGresult *res,
209208
cl->buf = b;
210209
b->memory = 1;
211210
b->tag = r->upstream->output.tag;
212-
b->last_buf = 1;
213211

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

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

@@ -557,7 +554,6 @@ ngx_postgres_render_rds_row_terminator(ngx_http_request_t *r, ngx_pool_t *pool)
557554
cl->buf = b;
558555
b->memory = 1;
559556
b->tag = r->upstream->output.tag;
560-
b->last_buf = 1;
561557

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

0 commit comments

Comments
 (0)