aboutsummaryrefslogtreecommitdiff
path: root/src/stream/ngx_stream_proxy_module.c
diff options
context:
space:
mode:
authorVladimir Homutov <vl@nginx.com>2020-06-08 11:40:34 +0300
committerVladimir Homutov <vl@nginx.com>2020-06-08 11:40:34 +0300
commit58d1412f0df08a90cc4df9bb3e5fb8a550daf63e (patch)
tree964e150f245910c0b07b32b35b78d80abe89cb45 /src/stream/ngx_stream_proxy_module.c
parent2d4f04bba0613292d8b51bf0de959e88afc72c54 (diff)
downloadnginx-58d1412f0df08a90cc4df9bb3e5fb8a550daf63e.tar.gz
nginx-58d1412f0df08a90cc4df9bb3e5fb8a550daf63e.zip
Stream: fixed processing of zero length UDP packets (ticket #1982).
Diffstat (limited to 'src/stream/ngx_stream_proxy_module.c')
-rw-r--r--src/stream/ngx_stream_proxy_module.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/stream/ngx_stream_proxy_module.c b/src/stream/ngx_stream_proxy_module.c
index 7484a728a..db11dd865 100644
--- a/src/stream/ngx_stream_proxy_module.c
+++ b/src/stream/ngx_stream_proxy_module.c
@@ -839,7 +839,7 @@ ngx_stream_proxy_init_upstream(ngx_stream_session_t *s)
u->upstream_buf.last = p;
}
- if (c->buffer && c->buffer->pos < c->buffer->last) {
+ if (c->buffer && c->buffer->pos <= c->buffer->last) {
ngx_log_debug1(NGX_LOG_DEBUG_STREAM, c->log, 0,
"stream proxy add preread buffer: %uz",
c->buffer->last - c->buffer->pos);
@@ -853,6 +853,7 @@ ngx_stream_proxy_init_upstream(ngx_stream_session_t *s)
*cl->buf = *c->buffer;
cl->buf->tag = (ngx_buf_tag_t) &ngx_stream_proxy_module;
+ cl->buf->temporary = (cl->buf->pos == cl->buf->last) ? 0 : 1;
cl->buf->flush = 1;
cl->next = u->upstream_out;