From de85f6e0ee0d28fb9ebe4463348814e11d22ffb7 Mon Sep 17 00:00:00 2001 From: Dragoonwings Date: Fri, 20 Jan 2023 14:16:22 +0200 Subject: [PATCH 1/3] Delete unnecessary ssl buffer flush --- ngx_http_zip_file.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/ngx_http_zip_file.c b/ngx_http_zip_file.c index 3e0e482..ce47c0e 100644 --- a/ngx_http_zip_file.c +++ b/ngx_http_zip_file.c @@ -499,10 +499,7 @@ ngx_http_zip_file_header_chain_link(ngx_http_request_t *r, ngx_http_zip_ctx_t *c b->memory = 1; b->last = b->pos + len; -#if (NGX_HTTP_SSL) - b->flush = !!r->connection->ssl; -#endif - + /* A note about the ZIP format: in order to appease all ZIP software I * could find, the local file header contains the file sizes but not the * CRC-32, even though setting the third bit of the general purpose bit From ebc8d0af0ffa86cd165749f35972240b6025afe3 Mon Sep 17 00:00:00 2001 From: Dragoonwings Date: Fri, 20 Jan 2023 14:21:29 +0200 Subject: [PATCH 2/3] Fixed behaviour when summary sending buffer is more than postpone_output, less than ssl_buffer and request is not postponed --- ngx_http_zip_module.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/ngx_http_zip_module.c b/ngx_http_zip_module.c index c9d4838..0c90776 100644 --- a/ngx_http_zip_module.c +++ b/ngx_http_zip_module.c @@ -609,7 +609,7 @@ ngx_http_zip_send_piece(ngx_http_request_t *r, ngx_http_zip_ctx_t *ctx, rc = ngx_http_zip_send_trailer_piece(r, ctx, piece, req_range); } else if (piece->type == zip_central_directory_piece) { rc = ngx_http_zip_send_central_directory_piece(r, ctx, piece, req_range); - } + } return rc; } @@ -683,6 +683,9 @@ ngx_http_zip_send_pieces(ngx_http_request_t *r, pieces_sent++; ngx_log_debug1(NGX_LOG_DEBUG_HTTP, r->connection->log, 0, "mod_zip: no ranges / sending piece type %d", piece->type); rc = ngx_http_zip_send_piece(r, ctx, piece, NULL); + if (rc == NGX_AGAIN && r->connection->buffered && !r->postponed) { + rc = NGX_OK; + } } break; case 1: From 88da3c305b4b3f1c262720ff8b9cf07ff40ee503 Mon Sep 17 00:00:00 2001 From: Pavel <68112907+Dragoonwings@users.noreply.github.com> Date: Mon, 23 Jan 2023 08:25:38 +0200 Subject: [PATCH 3/3] Extra space deleted --- ngx_http_zip_module.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ngx_http_zip_module.c b/ngx_http_zip_module.c index 0c90776..6e0cdc2 100644 --- a/ngx_http_zip_module.c +++ b/ngx_http_zip_module.c @@ -609,7 +609,7 @@ ngx_http_zip_send_piece(ngx_http_request_t *r, ngx_http_zip_ctx_t *ctx, rc = ngx_http_zip_send_trailer_piece(r, ctx, piece, req_range); } else if (piece->type == zip_central_directory_piece) { rc = ngx_http_zip_send_central_directory_piece(r, ctx, piece, req_range); - } + } return rc; }