summaryrefslogtreecommitdiffhomepage
path: root/src/event/ngx_event_openssl.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/event/ngx_event_openssl.c')
-rw-r--r--src/event/ngx_event_openssl.c16
1 files changed, 4 insertions, 12 deletions
diff --git a/src/event/ngx_event_openssl.c b/src/event/ngx_event_openssl.c
index 9e8dd0b1f..0116787a2 100644
--- a/src/event/ngx_event_openssl.c
+++ b/src/event/ngx_event_openssl.c
@@ -118,13 +118,13 @@ ngx_chain_t *ngx_ssl_send_chain(ngx_connection_t *c, ngx_chain_t *in,
off_t limit)
{
int n;
- ngx_uint_t flush, last;
+ ngx_uint_t flush;
ssize_t send, size;
ngx_buf_t *buf;
buf = c->ssl->buf;
- if (in && in->next == NULL && buf->pos == buf->last && !c->ssl->buffer) {
+ if (in && in->next == NULL && !c->buffered && !c->ssl->buffer) {
/*
* we avoid a buffer copy if the incoming buf is a single,
@@ -148,14 +148,12 @@ ngx_chain_t *ngx_ssl_send_chain(ngx_connection_t *c, ngx_chain_t *in,
send = 0;
flush = (in == NULL) ? 1 : 0;
- last = (in == NULL) ? 1 : 0;
for ( ;; ) {
while (in && buf->last < buf->end) {
if (in->buf->last_buf) {
flush = 1;
- last = 1;
}
if (ngx_buf_special(in->buf)) {
@@ -226,15 +224,9 @@ ngx_chain_t *ngx_ssl_send_chain(ngx_connection_t *c, ngx_chain_t *in,
}
}
- if (in) {
- return in;
- }
-
- if (buf->pos == buf->last || !last) {
- return NULL;
- }
+ c->buffered = (buf->pos < buf->last) ? 1 : 0;
- return NGX_CHAIN_AGAIN;
+ return in;
}