Latest update - 7546

This commit is contained in:
2019-08-02 17:47:18 +09:00
parent ae67e2622d
commit cbaaa317da
2 changed files with 54 additions and 4 deletions
+11 -4
View File
@@ -778,7 +778,7 @@ ngx_http_gzip_filter_deflate(ngx_http_request_t *r, ngx_http_gzip_ctx_t *ctx)
ctx->out_buf->last = ctx->zstream.next_out;
if (ctx->zstream.avail_out == 0) {
if (ctx->zstream.avail_out == 0 && rc != Z_STREAM_END) {
/* zlib wants to output some more gzipped data */
@@ -868,6 +868,7 @@ ngx_http_gzip_filter_deflate_end(ngx_http_request_t *r,
ngx_http_gzip_ctx_t *ctx)
{
int rc;
ngx_buf_t *b;
ngx_chain_t *cl;
ctx->zin = ctx->zstream.total_in;
@@ -888,13 +889,19 @@ ngx_http_gzip_filter_deflate_end(ngx_http_request_t *r,
return NGX_ERROR;
}
cl->buf = ctx->out_buf;
b = ctx->out_buf;
if (ngx_buf_size(b) == 0) {
b->temporary = 0;
}
b->last_buf = 1;
cl->buf = b;
cl->next = NULL;
*ctx->last_out = cl;
ctx->last_out = &cl->next;
ctx->out_buf->last_buf = 1;
ctx->zstream.avail_in = 0;
ctx->zstream.avail_out = 0;
+43
View File
@@ -15,6 +15,7 @@
static void ngx_mail_smtp_resolve_addr_handler(ngx_resolver_ctx_t *ctx);
static void ngx_mail_smtp_resolve_name(ngx_event_t *rev);
static void ngx_mail_smtp_resolve_name_handler(ngx_resolver_ctx_t *ctx);
static void ngx_mail_smtp_block_reading(ngx_event_t *rev);
static void ngx_mail_smtp_greeting(ngx_mail_session_t *s, ngx_connection_t *c);
static void ngx_mail_smtp_invalid_pipelining(ngx_event_t *rev);
static ngx_int_t ngx_mail_smtp_create_buffer(ngx_mail_session_t *s,
@@ -88,6 +89,9 @@ ngx_mail_smtp_init_session(ngx_mail_session_t *s, ngx_connection_t *c)
ctx->data = s;
ctx->timeout = cscf->resolver_timeout;
s->resolver_ctx = ctx;
c->read->handler = ngx_mail_smtp_block_reading;
if (ngx_resolve_addr(ctx) != NGX_OK) {
ngx_mail_close_connection(c);
}
@@ -169,6 +173,9 @@ ngx_mail_smtp_resolve_name(ngx_event_t *rev)
ctx->data = s;
ctx->timeout = cscf->resolver_timeout;
s->resolver_ctx = ctx;
c->read->handler = ngx_mail_smtp_block_reading;
if (ngx_resolve_name(ctx) != NGX_OK) {
ngx_mail_close_connection(c);
}
@@ -238,6 +245,38 @@ found:
}
static void
ngx_mail_smtp_block_reading(ngx_event_t *rev)
{
ngx_connection_t *c;
ngx_mail_session_t *s;
ngx_resolver_ctx_t *ctx;
c = rev->data;
s = c->data;
ngx_log_debug0(NGX_LOG_DEBUG_MAIL, c->log, 0, "smtp reading blocked");
if (ngx_handle_read_event(rev, 0) != NGX_OK) {
if (s->resolver_ctx) {
ctx = s->resolver_ctx;
if (ctx->handler == ngx_mail_smtp_resolve_addr_handler) {
ngx_resolve_addr_done(ctx);
} else if (ctx->handler == ngx_mail_smtp_resolve_name_handler) {
ngx_resolve_name_done(ctx);
}
s->resolver_ctx = NULL;
}
ngx_mail_close_connection(c);
}
}
static void
ngx_mail_smtp_greeting(ngx_mail_session_t *s, ngx_connection_t *c)
{
@@ -258,6 +297,10 @@ ngx_mail_smtp_greeting(ngx_mail_session_t *s, ngx_connection_t *c)
ngx_mail_close_connection(c);
}
if (c->read->ready) {
ngx_post_event(c->read, &ngx_posted_events);
}
if (sscf->greeting_delay) {
c->read->handler = ngx_mail_smtp_invalid_pipelining;
return;