Mercurial > hg > nginx
comparison src/event/ngx_event_openssl.c @ 1154:427de53e45c2
ngx_ssl_recv_chain() must not update buf->last,
it fixes proxy_pass https://...
author | Igor Sysoev <igor@sysoev.ru> |
---|---|
date | Sat, 31 Mar 2007 19:48:48 +0000 |
parents | 7073b87fa8e9 |
children | e5a3800c35cc |
comparison
equal
deleted
inserted
replaced
1153:c843f3df3b85 | 1154:427de53e45c2 |
---|---|
545 | 545 |
546 | 546 |
547 ssize_t | 547 ssize_t |
548 ngx_ssl_recv_chain(ngx_connection_t *c, ngx_chain_t *cl) | 548 ngx_ssl_recv_chain(ngx_connection_t *c, ngx_chain_t *cl) |
549 { | 549 { |
550 u_char *last; | |
550 ssize_t n, bytes; | 551 ssize_t n, bytes; |
551 ngx_buf_t *b; | 552 ngx_buf_t *b; |
552 | 553 |
553 bytes = 0; | 554 bytes = 0; |
554 | 555 |
555 while (cl) { | 556 b = cl->buf; |
556 b = cl->buf; | 557 last = b->last; |
557 | 558 |
558 n = ngx_ssl_recv(c, b->last, b->end - b->last); | 559 for ( ;; ) { |
560 | |
561 n = ngx_ssl_recv(c, last, b->end - last); | |
559 | 562 |
560 if (n > 0) { | 563 if (n > 0) { |
561 b->last += n; | 564 last += n; |
562 bytes += n; | 565 bytes += n; |
563 | 566 |
564 if (b->last == b->end) { | 567 if (last == b->end) { |
565 cl = cl->next; | 568 cl = cl->next; |
569 | |
570 if (cl == NULL) { | |
571 return bytes; | |
572 } | |
573 | |
574 b = cl->buf; | |
575 last = b->last; | |
566 } | 576 } |
567 | 577 |
568 continue; | 578 continue; |
569 } | 579 } |
570 | 580 |
572 return bytes; | 582 return bytes; |
573 } | 583 } |
574 | 584 |
575 return n; | 585 return n; |
576 } | 586 } |
577 | |
578 return bytes; | |
579 } | 587 } |
580 | 588 |
581 | 589 |
582 ssize_t | 590 ssize_t |
583 ngx_ssl_recv(ngx_connection_t *c, u_char *buf, size_t size) | 591 ngx_ssl_recv(ngx_connection_t *c, u_char *buf, size_t size) |