comparison src/stream/ngx_stream_proxy_module.c @ 7665:d127837c714f

Stream: fixed processing of zero length UDP packets (ticket #1982).
author Vladimir Homutov <vl@nginx.com>
date Mon, 08 Jun 2020 11:40:34 +0300
parents 16a1adadf437
children fd0b2226919b
comparison
equal deleted inserted replaced
7664:699f6e55bbb4 7665:d127837c714f
837 u->upstream_buf.end = p + pscf->buffer_size; 837 u->upstream_buf.end = p + pscf->buffer_size;
838 u->upstream_buf.pos = p; 838 u->upstream_buf.pos = p;
839 u->upstream_buf.last = p; 839 u->upstream_buf.last = p;
840 } 840 }
841 841
842 if (c->buffer && c->buffer->pos < c->buffer->last) { 842 if (c->buffer && c->buffer->pos <= c->buffer->last) {
843 ngx_log_debug1(NGX_LOG_DEBUG_STREAM, c->log, 0, 843 ngx_log_debug1(NGX_LOG_DEBUG_STREAM, c->log, 0,
844 "stream proxy add preread buffer: %uz", 844 "stream proxy add preread buffer: %uz",
845 c->buffer->last - c->buffer->pos); 845 c->buffer->last - c->buffer->pos);
846 846
847 cl = ngx_chain_get_free_buf(c->pool, &u->free); 847 cl = ngx_chain_get_free_buf(c->pool, &u->free);
851 } 851 }
852 852
853 *cl->buf = *c->buffer; 853 *cl->buf = *c->buffer;
854 854
855 cl->buf->tag = (ngx_buf_tag_t) &ngx_stream_proxy_module; 855 cl->buf->tag = (ngx_buf_tag_t) &ngx_stream_proxy_module;
856 cl->buf->temporary = (cl->buf->pos == cl->buf->last) ? 0 : 1;
856 cl->buf->flush = 1; 857 cl->buf->flush = 1;
857 858
858 cl->next = u->upstream_out; 859 cl->next = u->upstream_out;
859 u->upstream_out = cl; 860 u->upstream_out = cl;
860 } 861 }