Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "net/socket/ssl_client_socket_impl.h" | 5 #include "net/socket/ssl_client_socket_impl.h" |
| 6 | 6 |
| 7 #include <errno.h> | 7 #include <errno.h> |
| 8 #include <string.h> | 8 #include <string.h> |
| 9 | 9 |
| 10 #include <algorithm> | 10 #include <algorithm> |
| (...skipping 1429 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1440 return rv; | 1440 return rv; |
| 1441 } | 1441 } |
| 1442 | 1442 |
| 1443 int total_bytes_read = 0; | 1443 int total_bytes_read = 0; |
| 1444 int ssl_ret; | 1444 int ssl_ret; |
| 1445 do { | 1445 do { |
| 1446 ssl_ret = SSL_read(ssl_.get(), user_read_buf_->data() + total_bytes_read, | 1446 ssl_ret = SSL_read(ssl_.get(), user_read_buf_->data() + total_bytes_read, |
| 1447 user_read_buf_len_ - total_bytes_read); | 1447 user_read_buf_len_ - total_bytes_read); |
| 1448 if (ssl_ret > 0) | 1448 if (ssl_ret > 0) |
| 1449 total_bytes_read += ssl_ret; | 1449 total_bytes_read += ssl_ret; |
| 1450 } while (total_bytes_read < user_read_buf_len_ && ssl_ret > 0); | 1450 // Continue processing records as long as there is more data available |
|
svaldez
2017/03/07 22:05:54
Move this comment before the do-while loop.
| |
| 1451 // synchronously. | |
| 1452 } while (total_bytes_read < user_read_buf_len_ && ssl_ret > 0 && | |
| 1453 transport_adapter_->HasPendingReadData()); | |
| 1451 | 1454 |
| 1452 // Although only the final SSL_read call may have failed, the failure needs to | 1455 // Although only the final SSL_read call may have failed, the failure needs to |
| 1453 // processed immediately, while the information still available in OpenSSL's | 1456 // processed immediately, while the information still available in OpenSSL's |
| 1454 // error queue. | 1457 // error queue. |
| 1455 if (ssl_ret <= 0) { | 1458 if (ssl_ret <= 0) { |
| 1456 // A zero return from SSL_read may mean any of: | 1459 // A zero return from SSL_read may mean any of: |
| 1457 // - The underlying BIO_read returned 0. | 1460 // - The underlying BIO_read returned 0. |
| 1458 // - The peer sent a close_notify. | 1461 // - The peer sent a close_notify. |
| 1459 // - Any arbitrary error. https://crbug.com/466303 | 1462 // - Any arbitrary error. https://crbug.com/466303 |
| 1460 // | 1463 // |
| (...skipping 590 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2051 if (ERR_GET_REASON(info->error_code) == SSL_R_TLSV1_ALERT_ACCESS_DENIED && | 2054 if (ERR_GET_REASON(info->error_code) == SSL_R_TLSV1_ALERT_ACCESS_DENIED && |
| 2052 !certificate_requested_) { | 2055 !certificate_requested_) { |
| 2053 net_error = ERR_SSL_PROTOCOL_ERROR; | 2056 net_error = ERR_SSL_PROTOCOL_ERROR; |
| 2054 } | 2057 } |
| 2055 } | 2058 } |
| 2056 | 2059 |
| 2057 return net_error; | 2060 return net_error; |
| 2058 } | 2061 } |
| 2059 | 2062 |
| 2060 } // namespace net | 2063 } // namespace net |
| OLD | NEW |