OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 // This file includes code SSLClientSocketNSS::DoVerifyCertComplete() derived | 5 // This file includes code SSLClientSocketNSS::DoVerifyCertComplete() derived |
6 // from AuthCertificateCallback() in | 6 // from AuthCertificateCallback() in |
7 // mozilla/security/manager/ssl/src/nsNSSCallbacks.cpp. | 7 // mozilla/security/manager/ssl/src/nsNSSCallbacks.cpp. |
8 | 8 |
9 /* ***** BEGIN LICENSE BLOCK ***** | 9 /* ***** BEGIN LICENSE BLOCK ***** |
10 * Version: MPL 1.1/GPL 2.0/LGPL 2.1 | 10 * Version: MPL 1.1/GPL 2.0/LGPL 2.1 |
(...skipping 1603 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1614 if (client_auth_cert_needed_) { | 1614 if (client_auth_cert_needed_) { |
1615 // We don't need to invalidate the non-client-authenticated SSL session | 1615 // We don't need to invalidate the non-client-authenticated SSL session |
1616 // because the server will renegotiate anyway. | 1616 // because the server will renegotiate anyway. |
1617 LeaveFunction(""); | 1617 LeaveFunction(""); |
1618 rv = ERR_SSL_CLIENT_AUTH_CERT_NEEDED; | 1618 rv = ERR_SSL_CLIENT_AUTH_CERT_NEEDED; |
1619 net_log_.AddEvent(NetLog::TYPE_SSL_READ_ERROR, | 1619 net_log_.AddEvent(NetLog::TYPE_SSL_READ_ERROR, |
1620 make_scoped_refptr(new SSLErrorParams(rv, 0))); | 1620 make_scoped_refptr(new SSLErrorParams(rv, 0))); |
1621 return rv; | 1621 return rv; |
1622 } | 1622 } |
1623 if (rv >= 0) { | 1623 if (rv >= 0) { |
1624 LogByteTransfer(net_log_, NetLog::TYPE_SSL_SOCKET_BYTES_RECEIVED, rv, | 1624 net_log_.AddByteTransferEvent(NetLog::TYPE_SSL_SOCKET_BYTES_RECEIVED, rv, |
1625 user_read_buf_->data()); | 1625 user_read_buf_->data()); |
1626 LeaveFunction(""); | 1626 LeaveFunction(""); |
1627 return rv; | 1627 return rv; |
1628 } | 1628 } |
1629 PRErrorCode prerr = PR_GetError(); | 1629 PRErrorCode prerr = PR_GetError(); |
1630 if (prerr == PR_WOULD_BLOCK_ERROR) { | 1630 if (prerr == PR_WOULD_BLOCK_ERROR) { |
1631 LeaveFunction(""); | 1631 LeaveFunction(""); |
1632 return ERR_IO_PENDING; | 1632 return ERR_IO_PENDING; |
1633 } | 1633 } |
1634 LeaveFunction(""); | 1634 LeaveFunction(""); |
1635 rv = HandleNSSError(prerr, false); | 1635 rv = HandleNSSError(prerr, false); |
1636 net_log_.AddEvent(NetLog::TYPE_SSL_READ_ERROR, | 1636 net_log_.AddEvent(NetLog::TYPE_SSL_READ_ERROR, |
1637 make_scoped_refptr(new SSLErrorParams(rv, prerr))); | 1637 make_scoped_refptr(new SSLErrorParams(rv, prerr))); |
1638 return rv; | 1638 return rv; |
1639 } | 1639 } |
1640 | 1640 |
1641 int SSLClientSocketNSS::DoPayloadWrite() { | 1641 int SSLClientSocketNSS::DoPayloadWrite() { |
1642 EnterFunction(user_write_buf_len_); | 1642 EnterFunction(user_write_buf_len_); |
1643 DCHECK(user_write_buf_); | 1643 DCHECK(user_write_buf_); |
1644 int rv = PR_Write(nss_fd_, user_write_buf_->data(), user_write_buf_len_); | 1644 int rv = PR_Write(nss_fd_, user_write_buf_->data(), user_write_buf_len_); |
1645 if (rv >= 0) { | 1645 if (rv >= 0) { |
1646 LogByteTransfer(net_log_, NetLog::TYPE_SSL_SOCKET_BYTES_SENT, rv, | 1646 net_log_.AddByteTransferEvent(NetLog::TYPE_SSL_SOCKET_BYTES_SENT, rv, |
1647 user_write_buf_->data()); | 1647 user_write_buf_->data()); |
1648 LeaveFunction(""); | 1648 LeaveFunction(""); |
1649 return rv; | 1649 return rv; |
1650 } | 1650 } |
1651 PRErrorCode prerr = PR_GetError(); | 1651 PRErrorCode prerr = PR_GetError(); |
1652 if (prerr == PR_WOULD_BLOCK_ERROR) { | 1652 if (prerr == PR_WOULD_BLOCK_ERROR) { |
1653 LeaveFunction(""); | 1653 LeaveFunction(""); |
1654 return ERR_IO_PENDING; | 1654 return ERR_IO_PENDING; |
1655 } | 1655 } |
1656 LeaveFunction(""); | 1656 LeaveFunction(""); |
1657 rv = HandleNSSError(prerr, false); | 1657 rv = HandleNSSError(prerr, false); |
(...skipping 606 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2264 valid_thread_id_ = base::PlatformThread::CurrentId(); | 2264 valid_thread_id_ = base::PlatformThread::CurrentId(); |
2265 } | 2265 } |
2266 | 2266 |
2267 bool SSLClientSocketNSS::CalledOnValidThread() const { | 2267 bool SSLClientSocketNSS::CalledOnValidThread() const { |
2268 EnsureThreadIdAssigned(); | 2268 EnsureThreadIdAssigned(); |
2269 base::AutoLock auto_lock(lock_); | 2269 base::AutoLock auto_lock(lock_); |
2270 return valid_thread_id_ == base::PlatformThread::CurrentId(); | 2270 return valid_thread_id_ == base::PlatformThread::CurrentId(); |
2271 } | 2271 } |
2272 | 2272 |
2273 } // namespace net | 2273 } // namespace net |
OLD | NEW |