comparison src/event/ngx_event_openssl.c @ 3283:52b1624b93c2

fix segfault in SSL if limit_rate is used
author Igor Sysoev <igor@sysoev.ru>
date Tue, 03 Nov 2009 15:38:33 +0000
parents d4cc5a450ee9
children 5a08dfb8d763
comparison
equal deleted inserted replaced
3282:c76b7a7959d5 3283:52b1624b93c2
944 send = 0; 944 send = 0;
945 flush = (in == NULL) ? 1 : 0; 945 flush = (in == NULL) ? 1 : 0;
946 946
947 for ( ;; ) { 947 for ( ;; ) {
948 948
949 while (in && buf->last < buf->end) { 949 while (in && buf->last < buf->end && send < limit) {
950 if (in->buf->last_buf || in->buf->flush) { 950 if (in->buf->last_buf || in->buf->flush) {
951 flush = 1; 951 flush = 1;
952 } 952 }
953 953
954 if (ngx_buf_special(in->buf)) { 954 if (ngx_buf_special(in->buf)) {
971 "SSL buf copy: %d", size); 971 "SSL buf copy: %d", size);
972 972
973 ngx_memcpy(buf->last, in->buf->pos, size); 973 ngx_memcpy(buf->last, in->buf->pos, size);
974 974
975 buf->last += size; 975 buf->last += size;
976
977 in->buf->pos += size; 976 in->buf->pos += size;
977 send += size;
978 978
979 if (in->buf->pos == in->buf->last) { 979 if (in->buf->pos == in->buf->last) {
980 in = in->next; 980 in = in->next;
981 } 981 }
982 } 982 }
997 c->buffered |= NGX_SSL_BUFFERED; 997 c->buffered |= NGX_SSL_BUFFERED;
998 return in; 998 return in;
999 } 999 }
1000 1000
1001 buf->pos += n; 1001 buf->pos += n;
1002 send += n;
1003 c->sent += n; 1002 c->sent += n;
1004 1003
1005 if (n < size) { 1004 if (n < size) {
1006 break; 1005 break;
1007 } 1006 }