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 // 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 2122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2133 | 2133 |
2134 // Return 0 if nss_bufs_ was empty, | 2134 // Return 0 if nss_bufs_ was empty, |
2135 // > 0 for bytes transferred immediately, | 2135 // > 0 for bytes transferred immediately, |
2136 // < 0 for error (or the non-error ERR_IO_PENDING). | 2136 // < 0 for error (or the non-error ERR_IO_PENDING). |
2137 int SSLClientSocketNSS::Core::BufferSend() { | 2137 int SSLClientSocketNSS::Core::BufferSend() { |
2138 DCHECK(OnNSSTaskRunner()); | 2138 DCHECK(OnNSSTaskRunner()); |
2139 | 2139 |
2140 if (transport_send_busy_) | 2140 if (transport_send_busy_) |
2141 return ERR_IO_PENDING; | 2141 return ERR_IO_PENDING; |
2142 | 2142 |
2143 // If there was an error, return it synchronously rather than call | |
wtc
2014/06/17 18:24:06
Nit: "return it" is no longer accurate because you
davidben
2014/06/17 20:27:43
Done.
| |
2144 // DoBufferSend on the network task runner. This is important to prevent | |
2145 // spinning infinitely in the off-thread NSS case. The error code itself is | |
2146 // ignored, so just return ERR_ABORTED. See https://crbug.com/381160. | |
2147 if (memio_LastWriteError(nss_bufs_) != 0) | |
2148 return ERR_ABORTED; | |
2149 | |
2143 const char* buf1; | 2150 const char* buf1; |
2144 const char* buf2; | 2151 const char* buf2; |
2145 unsigned int len1, len2; | 2152 unsigned int len1, len2; |
2146 memio_GetWriteParams(nss_bufs_, &buf1, &len1, &buf2, &len2); | 2153 memio_GetWriteParams(nss_bufs_, &buf1, &len1, &buf2, &len2); |
wtc
2014/06/17 18:24:06
Another option is to make memio_GetWriteParams ret
Ryan Sleevi
2014/06/17 19:43:39
+1
davidben
2014/06/17 20:27:43
Done.
| |
2147 const unsigned int len = len1 + len2; | 2154 const unsigned int len = len1 + len2; |
2148 | 2155 |
2149 int rv = 0; | 2156 int rv = 0; |
2150 if (len) { | 2157 if (len) { |
2151 scoped_refptr<IOBuffer> send_buffer(new IOBuffer(len)); | 2158 scoped_refptr<IOBuffer> send_buffer(new IOBuffer(len)); |
2152 memcpy(send_buffer->data(), buf1, len1); | 2159 memcpy(send_buffer->data(), buf1, len1); |
2153 memcpy(send_buffer->data() + len1, buf2, len2); | 2160 memcpy(send_buffer->data() + len1, buf2, len2); |
2154 | 2161 |
2155 if (OnNetworkTaskRunner()) { | 2162 if (OnNetworkTaskRunner()) { |
2156 rv = DoBufferSend(send_buffer.get(), len); | 2163 rv = DoBufferSend(send_buffer.get(), len); |
(...skipping 1457 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3614 scoped_refptr<X509Certificate> | 3621 scoped_refptr<X509Certificate> |
3615 SSLClientSocketNSS::GetUnverifiedServerCertificateChain() const { | 3622 SSLClientSocketNSS::GetUnverifiedServerCertificateChain() const { |
3616 return core_->state().server_cert.get(); | 3623 return core_->state().server_cert.get(); |
3617 } | 3624 } |
3618 | 3625 |
3619 ServerBoundCertService* SSLClientSocketNSS::GetServerBoundCertService() const { | 3626 ServerBoundCertService* SSLClientSocketNSS::GetServerBoundCertService() const { |
3620 return server_bound_cert_service_; | 3627 return server_bound_cert_service_; |
3621 } | 3628 } |
3622 | 3629 |
3623 } // namespace net | 3630 } // namespace net |
OLD | NEW |