Skip to content

Commit d510ac8

Browse files
committed
fix endless loop on sync connection error when writing
1 parent 3d4b839 commit d510ac8

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

src/ngx_http_redirectionio_module.c

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -316,6 +316,19 @@ static ngx_int_t ngx_http_redirectionio_redirect_handler(ngx_http_request_t *r)
316316
ngx_log_debug0(NGX_LOG_DEBUG_HTTP, r->connection->log, 0, "http redirectionio call match action");
317317
ngx_http_redirectionio_write_match_action_handler(ctx->resource->peer.connection->write);
318318

319+
// Handle when direct error after write
320+
if (ctx->connection_error) {
321+
if (ctx->resource != NULL) {
322+
ngx_http_redirectionio_release_resource(conf->connection_pool, ctx, 1);
323+
}
324+
325+
ctx->wait_for_connection = 0;
326+
ctx->resource = NULL;
327+
ctx->connection_error = 0;
328+
329+
return NGX_DECLINED;
330+
}
331+
319332
return NGX_AGAIN;
320333
}
321334

0 commit comments

Comments
 (0)