summaryrefslogtreecommitdiffstats
path: root/net/base
diff options
context:
space:
mode:
Diffstat (limited to 'net/base')
-rw-r--r--net/base/cookie_monster.h2
-rw-r--r--net/base/cookie_monster_unittest.cc2
-rw-r--r--net/base/file_stream.h10
-rw-r--r--net/base/file_stream_posix.cc2
-rw-r--r--net/base/file_stream_unittest.cc30
-rw-r--r--net/base/gzip_filter.cc4
-rw-r--r--net/base/listen_socket.cc6
-rw-r--r--net/base/listen_socket_unittest.cc10
-rw-r--r--net/base/listen_socket_unittest.h4
-rw-r--r--net/base/mime_sniffer.cc6
-rw-r--r--net/base/mime_sniffer_unittest.cc2
-rw-r--r--net/base/nss_memio.c24
-rw-r--r--net/base/nss_memio.h8
-rw-r--r--net/base/sdch_manager.cc10
-rw-r--r--net/base/ssl_client_socket_mac.cc122
-rw-r--r--net/base/ssl_client_socket_mac.h12
-rw-r--r--net/base/telnet_server.cc4
-rw-r--r--net/base/test_completion_callback_unittest.cc6
-rw-r--r--net/base/x509_certificate_mac.cc40
19 files changed, 152 insertions, 152 deletions
diff --git a/net/base/cookie_monster.h b/net/base/cookie_monster.h
index c9e48d7..580e176 100644
--- a/net/base/cookie_monster.h
+++ b/net/base/cookie_monster.h
@@ -53,7 +53,7 @@ class CookieMonster {
public:
// Default is to exclude httponly, which means:
// - reading operations will not return httponly cookies.
- // - writing operations will not write httponly cookies.
+ // - writing operations will not write httponly cookies.
CookieOptions() : exclude_httponly_(true) {}
void set_exclude_httponly() { exclude_httponly_ = true; }
void set_include_httponly() { exclude_httponly_ = false; }
diff --git a/net/base/cookie_monster_unittest.cc b/net/base/cookie_monster_unittest.cc
index 48843d1..1878285 100644
--- a/net/base/cookie_monster_unittest.cc
+++ b/net/base/cookie_monster_unittest.cc
@@ -533,7 +533,7 @@ TEST(CookieMonsterTest, HttpOnlyTest) {
// Create a httponly cookie.
EXPECT_TRUE(cm.SetCookieWithOptions(url_google, "A=B; httponly", options));
-
+
// Check httponly read protection.
EXPECT_EQ("", cm.GetCookies(url_google));
EXPECT_EQ("A=B", cm.GetCookiesWithOptions(url_google, options));
diff --git a/net/base/file_stream.h b/net/base/file_stream.h
index eaf6a0d..28b40e7 100644
--- a/net/base/file_stream.h
+++ b/net/base/file_stream.h
@@ -70,12 +70,12 @@ class FileStream {
// not complete synchronously, then ERR_IO_PENDING is returned, and the
// callback will be notified on the current thread (via the MessageLoop) when
// the read has completed.
- //
+ //
// In the case of an asychronous read, the memory pointed to by |buf| must
// remain valid until the callback is notified. However, it is valid to
// destroy or close the file stream while there is an asynchronous read in
// progress. That will cancel the read and allow the buffer to be freed.
- //
+ //
// This method should not be called if the stream was opened WRITE_ONLY.
//
// You can pass NULL as the callback for synchronous I/O.
@@ -90,7 +90,7 @@ class FileStream {
// Call this method to write data at the current stream position. Up to
// buf_len bytes will be written from buf. (In other words, partial writes are
- // allowed.) Returns the number of bytes written, or an error code if the
+ // allowed.) Returns the number of bytes written, or an error code if the
// operation could not be performed.
//
// If opened with PLATFORM_FILE_ASYNC, then a non-null callback
@@ -98,12 +98,12 @@ class FileStream {
// not complete synchronously, then ERR_IO_PENDING is returned, and the
// callback will be notified on the current thread (via the MessageLoop) when
// the write has completed.
- //
+ //
// In the case of an asychronous write, the memory pointed to by |buf| must
// remain valid until the callback is notified. However, it is valid to
// destroy or close the file stream while there is an asynchronous write in
// progress. That will cancel the write and allow the buffer to be freed.
- //
+ //
// This method should not be called if the stream was opened READ_ONLY.
//
// You can pass NULL as the callback for synchronous I/O.
diff --git a/net/base/file_stream_posix.cc b/net/base/file_stream_posix.cc
index 151cf5d..34f7889 100644
--- a/net/base/file_stream_posix.cc
+++ b/net/base/file_stream_posix.cc
@@ -106,7 +106,7 @@ int64 FileStream::Seek(Whence whence, int64 offset) {
// If we're in async, make sure we don't have a request in flight.
DCHECK(!async_context_.get() || !async_context_->callback());
-
+
off_t res = lseek(file_, static_cast<off_t>(offset),
static_cast<int>(whence));
if (res == static_cast<off_t>(-1))
diff --git a/net/base/file_stream_unittest.cc b/net/base/file_stream_unittest.cc
index f96d57f..318eb93 100644
--- a/net/base/file_stream_unittest.cc
+++ b/net/base/file_stream_unittest.cc
@@ -35,7 +35,7 @@ class FileStreamTest : public PlatformTest {
TEST_F(FileStreamTest, BasicOpenClose) {
net::FileStream stream;
- int rv = stream.Open(temp_file_path(),
+ int rv = stream.Open(temp_file_path(),
base::PLATFORM_FILE_OPEN | base::PLATFORM_FILE_READ);
EXPECT_EQ(net::OK, rv);
}
@@ -103,7 +103,7 @@ TEST_F(FileStreamTest, BasicRead) {
EXPECT_TRUE(ok);
net::FileStream stream;
- int flags = base::PLATFORM_FILE_OPEN |
+ int flags = base::PLATFORM_FILE_OPEN |
base::PLATFORM_FILE_READ;
int rv = stream.Open(temp_file_path(), flags);
EXPECT_EQ(net::OK, rv);
@@ -133,8 +133,8 @@ TEST_F(FileStreamTest, AsyncRead) {
EXPECT_TRUE(ok);
net::FileStream stream;
- int flags = base::PLATFORM_FILE_OPEN |
- base::PLATFORM_FILE_READ |
+ int flags = base::PLATFORM_FILE_OPEN |
+ base::PLATFORM_FILE_READ |
base::PLATFORM_FILE_ASYNC;
int rv = stream.Open(temp_file_path(), flags);
EXPECT_EQ(net::OK, rv);
@@ -168,7 +168,7 @@ TEST_F(FileStreamTest, BasicRead_FromOffset) {
EXPECT_TRUE(ok);
net::FileStream stream;
- int flags = base::PLATFORM_FILE_OPEN |
+ int flags = base::PLATFORM_FILE_OPEN |
base::PLATFORM_FILE_READ;
int rv = stream.Open(temp_file_path(), flags);
EXPECT_EQ(net::OK, rv);
@@ -202,8 +202,8 @@ TEST_F(FileStreamTest, AsyncRead_FromOffset) {
EXPECT_TRUE(ok);
net::FileStream stream;
- int flags = base::PLATFORM_FILE_OPEN |
- base::PLATFORM_FILE_READ |
+ int flags = base::PLATFORM_FILE_OPEN |
+ base::PLATFORM_FILE_READ |
base::PLATFORM_FILE_ASYNC;
int rv = stream.Open(temp_file_path(), flags);
EXPECT_EQ(net::OK, rv);
@@ -237,7 +237,7 @@ TEST_F(FileStreamTest, AsyncRead_FromOffset) {
TEST_F(FileStreamTest, SeekAround) {
net::FileStream stream;
- int flags = base::PLATFORM_FILE_OPEN |
+ int flags = base::PLATFORM_FILE_OPEN |
base::PLATFORM_FILE_READ;
int rv = stream.Open(temp_file_path(), flags);
EXPECT_EQ(net::OK, rv);
@@ -260,7 +260,7 @@ TEST_F(FileStreamTest, SeekAround) {
TEST_F(FileStreamTest, BasicWrite) {
net::FileStream stream;
- int flags = base::PLATFORM_FILE_CREATE_ALWAYS |
+ int flags = base::PLATFORM_FILE_CREATE_ALWAYS |
base::PLATFORM_FILE_WRITE;
int rv = stream.Open(temp_file_path(), flags);
EXPECT_EQ(net::OK, rv);
@@ -281,8 +281,8 @@ TEST_F(FileStreamTest, BasicWrite) {
TEST_F(FileStreamTest, AsyncWrite) {
net::FileStream stream;
- int flags = base::PLATFORM_FILE_CREATE_ALWAYS |
- base::PLATFORM_FILE_WRITE |
+ int flags = base::PLATFORM_FILE_CREATE_ALWAYS |
+ base::PLATFORM_FILE_WRITE |
base::PLATFORM_FILE_ASYNC;
int rv = stream.Open(temp_file_path(), flags);
EXPECT_EQ(net::OK, rv);
@@ -311,7 +311,7 @@ TEST_F(FileStreamTest, AsyncWrite) {
TEST_F(FileStreamTest, BasicWrite_FromOffset) {
net::FileStream stream;
- int flags = base::PLATFORM_FILE_OPEN |
+ int flags = base::PLATFORM_FILE_OPEN |
base::PLATFORM_FILE_WRITE;
int rv = stream.Open(temp_file_path(), flags);
EXPECT_EQ(net::OK, rv);
@@ -340,7 +340,7 @@ TEST_F(FileStreamTest, AsyncWrite_FromOffset) {
EXPECT_TRUE(ok);
net::FileStream stream;
- int flags = base::PLATFORM_FILE_OPEN |
+ int flags = base::PLATFORM_FILE_OPEN |
base::PLATFORM_FILE_WRITE |
base::PLATFORM_FILE_ASYNC;
int rv = stream.Open(temp_file_path(), flags);
@@ -373,8 +373,8 @@ TEST_F(FileStreamTest, BasicReadWrite) {
EXPECT_TRUE(ok);
net::FileStream stream;
- int flags = base::PLATFORM_FILE_OPEN |
- base::PLATFORM_FILE_READ |
+ int flags = base::PLATFORM_FILE_OPEN |
+ base::PLATFORM_FILE_READ |
base::PLATFORM_FILE_WRITE;
int rv = stream.Open(temp_file_path(), flags);
EXPECT_EQ(net::OK, rv);
diff --git a/net/base/gzip_filter.cc b/net/base/gzip_filter.cc
index af7609b..79395a2 100644
--- a/net/base/gzip_filter.cc
+++ b/net/base/gzip_filter.cc
@@ -41,7 +41,7 @@ bool GZipFilter::InitDecoding(Filter::FilterType filter_type) {
decoding_mode_ = DECODE_MODE_DEFLATE;
break;
}
- case Filter::FILTER_TYPE_GZIP_HELPING_SDCH:
+ case Filter::FILTER_TYPE_GZIP_HELPING_SDCH:
possible_sdch_pass_through_ = true; // Needed to optionally help sdch.
// Fall through to GZIP case.
case Filter::FILTER_TYPE_GZIP: {
@@ -105,7 +105,7 @@ Filter::FilterStatus GZipFilter::ReadFilteredData(char* dest_buffer,
break;
}
case Filter::FILTER_ERROR: {
- if (possible_sdch_pass_through_ &&
+ if (possible_sdch_pass_through_ &&
GZIP_GET_INVALID_HEADER == gzip_header_status_) {
decoding_status_ = DECODING_DONE; // Become a pass through filter.
return CopyOut(dest_buffer, dest_len);
diff --git a/net/base/listen_socket.cc b/net/base/listen_socket.cc
index b2185a2..a172e46 100644
--- a/net/base/listen_socket.cc
+++ b/net/base/listen_socket.cc
@@ -216,7 +216,7 @@ void ListenSocket::Send(const std::string& str, bool append_linefeed) {
}
// TODO (ibrar): We can add these functions into OS dependent files
-#if defined(OS_WIN)
+#if defined(OS_WIN)
// MessageLoop watcher callback
void ListenSocket::OnObjectSignaled(HANDLE object) {
WSANETWORKEVENTS ev;
@@ -224,10 +224,10 @@ void ListenSocket::OnObjectSignaled(HANDLE object) {
// TODO
return;
}
-
+
// The object was reset by WSAEnumNetworkEvents. Watch for the next signal.
watcher_.StartWatching(object, this);
-
+
if (ev.lNetworkEvents == 0) {
// Occasionally the event is set even though there is no new data.
// The net seems to think that this is ignorable.
diff --git a/net/base/listen_socket_unittest.cc b/net/base/listen_socket_unittest.cc
index aaac099..6ae798a 100644
--- a/net/base/listen_socket_unittest.cc
+++ b/net/base/listen_socket_unittest.cc
@@ -33,7 +33,7 @@ void ListenSocketTester::SetUp() {
ASSERT_EQ(0, pthread_mutex_init(&lock_, NULL ));
sem_unlink(kSemaphoreName);
semaphore_ = sem_open(kSemaphoreName, O_CREAT, 0, 0);
- ASSERT_NE(SEM_FAILED, semaphore_);
+ ASSERT_NE(SEM_FAILED, semaphore_);
#endif
base::Thread::Options options;
options.message_loop_type = MessageLoop::TYPE_IO;
@@ -132,7 +132,7 @@ bool ListenSocketTester::NextAction(int timeout) {
timeout--;
if (timeout <= 0)
return false;
- if (result == 0)
+ if (result == 0)
break;
}
pthread_mutex_lock(&lock_);
@@ -163,7 +163,7 @@ int ListenSocketTester::ClearTestSocket() {
#endif
PlatformThread::Sleep(1);
time_out++;
- if (time_out > 10)
+ if (time_out > 10)
break;
continue; // still trying
}
@@ -199,14 +199,14 @@ void ListenSocketTester::SendFromTester() {
ReportAction(ListenSocketTestAction(ACTION_SEND));
}
-void ListenSocketTester::DidAccept(ListenSocket *server,
+void ListenSocketTester::DidAccept(ListenSocket *server,
ListenSocket *connection) {
connection_ = connection;
connection_->AddRef();
ReportAction(ListenSocketTestAction(ACTION_ACCEPT));
}
-void ListenSocketTester::DidRead(ListenSocket *connection,
+void ListenSocketTester::DidRead(ListenSocket *connection,
const std::string& data) {
ReportAction(ListenSocketTestAction(ACTION_READ, data));
}
diff --git a/net/base/listen_socket_unittest.h b/net/base/listen_socket_unittest.h
index 5a04099..382508e 100644
--- a/net/base/listen_socket_unittest.h
+++ b/net/base/listen_socket_unittest.h
@@ -30,7 +30,7 @@
#if defined(OS_POSIX)
// Used same name as in Windows to avoid #ifdef where refrenced
#define SOCKET int
-const int INVALID_SOCKET = -1;
+const int INVALID_SOCKET = -1;
const int SOCKET_ERROR = -1;
#endif
@@ -73,7 +73,7 @@ class ListenSocketTester :
public:
ListenSocketTester()
: thread_(NULL),
- loop_(NULL),
+ loop_(NULL),
server_(NULL),
connection_(NULL){
}
diff --git a/net/base/mime_sniffer.cc b/net/base/mime_sniffer.cc
index d982f85..d67682b 100644
--- a/net/base/mime_sniffer.cc
+++ b/net/base/mime_sniffer.cc
@@ -144,9 +144,9 @@ static const MagicNumber kMagicNumbers[] = {
MAGIC_NUMBER("image/jpeg", "\xFF\xD8\xFF")
MAGIC_NUMBER("image/bmp", "BM")
// Source: Mozilla
- MAGIC_NUMBER("text/plain", "#!") // Script
- MAGIC_NUMBER("text/plain", "%!") // Script, similar to PS
- MAGIC_NUMBER("text/plain", "From")
+ MAGIC_NUMBER("text/plain", "#!") // Script
+ MAGIC_NUMBER("text/plain", "%!") // Script, similar to PS
+ MAGIC_NUMBER("text/plain", "From")
MAGIC_NUMBER("text/plain", ">From")
// Chrome specific
MAGIC_NUMBER("application/x-gzip", "\x1F\x8B\x08")
diff --git a/net/base/mime_sniffer_unittest.cc b/net/base/mime_sniffer_unittest.cc
index caf258b..96eb441 100644
--- a/net/base/mime_sniffer_unittest.cc
+++ b/net/base/mime_sniffer_unittest.cc
@@ -298,7 +298,7 @@ TEST(MimeSnifferTest, XMLTest) {
// Test content which is >= 512 bytes, and includes no open angle bracket.
// http://code.google.com/p/chromium/issues/detail?id=3521
TEST(MimeSnifferTest, XMLTestLargeNoAngledBracket) {
- // Make a large input, with 600 bytes of "x".
+ // Make a large input, with 600 bytes of "x".
std::string content;
content.resize(600);
std::fill(content.begin(), content.end(), 'x');
diff --git a/net/base/nss_memio.c b/net/base/nss_memio.c
index ca3421e..f32ca5d 100644
--- a/net/base/nss_memio.c
+++ b/net/base/nss_memio.c
@@ -3,7 +3,7 @@
// found in the LICENSE file.
// Written in NSPR style to also be suitable for adding to the NSS demo suite
-/* memio is a simple NSPR I/O layer that lets you decouple NSS from
+/* memio is a simple NSPR I/O layer that lets you decouple NSS from
* the real network. It's rather like openssl's memory bio,
* and is useful when your app absolutely, positively doesn't
* want to let NSS do its own networking.
@@ -38,21 +38,21 @@ struct memio_buffer {
};
-/* The 'secret' field of a PRFileDesc created by memio_CreateIOLayer points
+/* The 'secret' field of a PRFileDesc created by memio_CreateIOLayer points
* to one of these.
- * In the public header, we use struct memio_Private as a typesafe alias
+ * In the public header, we use struct memio_Private as a typesafe alias
* for this. This causes a few ugly typecasts in the private file, but
* seems safer.
*/
struct PRFilePrivate {
/* read requests are satisfied from this buffer */
- struct memio_buffer readbuf;
+ struct memio_buffer readbuf;
/* write requests are satisfied from this buffer */
- struct memio_buffer writebuf;
+ struct memio_buffer writebuf;
/* SSL needs to know socket peer's name */
- PRNetAddr peername;
+ PRNetAddr peername;
/* if set, empty I/O returns EOF instead of EWOULDBLOCK */
int eof;
@@ -120,7 +120,7 @@ static int memio_buffer_used(const struct memio_buffer *mb)
/* How many bytes can be read out of the buffer without wrapping */
static int memio_buffer_used_contiguous(const struct memio_buffer *mb)
-{
+{
return (((mb->tail >= mb->head) ? mb->tail : mb->bufsize) - mb->head);
}
@@ -132,7 +132,7 @@ static int memio_buffer_unused(const struct memio_buffer *mb)
/* How many bytes can be written into the buffer without wrapping */
static int memio_buffer_unused_contiguous(const struct memio_buffer *mb)
-{
+{
if (mb->head > mb->tail) return mb->head - mb->tail - 1;
return mb->bufsize - mb->tail - (mb->head == 0);
}
@@ -236,7 +236,7 @@ static PRStatus PR_CALLBACK memio_Shutdown(PRFileDesc *fd, PRIntn how)
* out of the buffer, return it to the next call that
* tries to read from an empty buffer.
*/
-static int PR_CALLBACK memio_Recv(PRFileDesc *fd, void *buf, PRInt32 len,
+static int PR_CALLBACK memio_Recv(PRFileDesc *fd, void *buf, PRInt32 len,
PRIntn flags, PRIntervalTime timeout)
{
struct PRFilePrivate *secret;
@@ -323,11 +323,11 @@ static PRStatus memio_GetSocketOption(PRFileDesc *fd, PRSocketOptionData *data)
/*--------------- private memio data -----------------------*/
-/*
+/*
* Implement just the bare minimum number of methods needed to make ssl happy.
*
- * Oddly, PR_Recv calls ssl_Recv calls ssl_SocketIsBlocking calls
- * PR_GetSocketOption, so we have to provide an implementation of
+ * Oddly, PR_Recv calls ssl_Recv calls ssl_SocketIsBlocking calls
+ * PR_GetSocketOption, so we have to provide an implementation of
* PR_GetSocketOption that just says "I'm nonblocking".
*/
diff --git a/net/base/nss_memio.h b/net/base/nss_memio.h
index b766007..0bee53e 100644
--- a/net/base/nss_memio.h
+++ b/net/base/nss_memio.h
@@ -8,7 +8,7 @@
#ifdef __cplusplus
extern "C" {
-#endif
+#endif
#include "prio.h"
@@ -27,7 +27,7 @@ typedef struct memio_Private memio_Private;
5) While at the same time doing plaintext nonblocking NSPR I/O as
usual to the nspr file descriptor returned by SSL_ImportFD,
your app must shuttle encrypted data between
- the real network and memio's network buffers.
+ the real network and memio's network buffers.
memio_GetReadParams/memio_PutReadResult
are the hooks you need to pump data into memio's input buffer,
and memio_GetWriteParams/memio_PutWriteResult
@@ -55,7 +55,7 @@ memio_Private *memio_GetSecret(PRFileDesc *fd);
int memio_GetReadParams(memio_Private *secret, char **buf);
/* Tell memio how many bytes were read from the network.
- * If bytes_read is 0, causes EOF to be reported to
+ * If bytes_read is 0, causes EOF to be reported to
* NSS after it reads the last byte from the circular buffer.
* If bytes_read is < 0, it is treated as an NSPR error code.
* See nspr/pr/src/md/unix/unix_errors.c for how to
@@ -81,6 +81,6 @@ void memio_PutWriteResult(memio_Private *secret, int bytes_written);
#ifdef __cplusplus
}
-#endif
+#endif
#endif
diff --git a/net/base/sdch_manager.cc b/net/base/sdch_manager.cc
index 458c3a4..ac63c6c 100644
--- a/net/base/sdch_manager.cc
+++ b/net/base/sdch_manager.cc
@@ -142,12 +142,12 @@ const bool SdchManager::IsInSupportedDomain(const GURL& url) {
bool SdchManager::CanFetchDictionary(const GURL& referring_url,
const GURL& dictionary_url) const {
- /* The user agent may retrieve a dictionary from the dictionary URL if all of
+ /* The user agent may retrieve a dictionary from the dictionary URL if all of
the following are true:
1 The dictionary URL host name matches the referrer URL host name
2 The dictionary URL host name domain matches the parent domain of the
referrer URL host name
- 3 The parent domain of the referrer URL host name is not a top level
+ 3 The parent domain of the referrer URL host name is not a top level
domain
4 The dictionary URL is not an HTTPS URL.
*/
@@ -365,7 +365,7 @@ bool SdchManager::Dictionary::CanSet(const std::string& domain,
const GURL& dictionary_url) {
if (!SdchManager::Global()->IsInSupportedDomain(dictionary_url))
return false;
- /*
+ /*
A dictionary is invalid and must not be stored if any of the following are
true:
1. The dictionary has no Domain attribute.
@@ -459,7 +459,7 @@ bool SdchManager::Dictionary::CanUse(const GURL referring_url) {
bool SdchManager::Dictionary::CanAdvertise(const GURL& target_url) {
if (!SdchManager::Global()->IsInSupportedDomain(target_url))
return false;
- /* The specific rules of when a dictionary should be advertised in an
+ /* The specific rules of when a dictionary should be advertised in an
Avail-Dictionary header are modeled after the rules for cookie scoping. The
terms "domain-match" and "pathmatch" are defined in RFC 2965 [6]. A
dictionary may be advertised in the Avail-Dictionaries header exactly when
@@ -489,7 +489,7 @@ bool SdchManager::Dictionary::PathMatch(const std::string& path,
/* Must be either:
1. P2 is equal to P1
2. P2 is a prefix of P1 and either the final character in P2 is "/" or the
- character following P2 in P1 is "/".
+ character following P2 in P1 is "/".
*/
if (path == restriction)
return true;
diff --git a/net/base/ssl_client_socket_mac.cc b/net/base/ssl_client_socket_mac.cc
index d351db5..0d10030 100644
--- a/net/base/ssl_client_socket_mac.cc
+++ b/net/base/ssl_client_socket_mac.cc
@@ -119,11 +119,11 @@ int NetErrorFromOSStatus(OSStatus status) {
return ERR_CERT_INVALID;
case errSSLPeerCertRevoked:
return ERR_CERT_REVOKED;
-
+
case errSSLClosedGraceful:
case noErr:
return OK;
-
+
case errSSLBadRecordMac:
case errSSLBufferOverflow:
case errSSLDecryptionFail:
@@ -168,7 +168,7 @@ OSStatus OSStatusFromNetError(int net_error) {
int KeySizeOfCipherSuite(SSLCipherSuite suite) {
switch (suite) {
// SSL 2 only
-
+
case SSL_RSA_WITH_DES_CBC_MD5:
return 56;
case SSL_RSA_WITH_3DES_EDE_CBC_MD5:
@@ -178,9 +178,9 @@ int KeySizeOfCipherSuite(SSLCipherSuite suite) {
return 128;
case SSL_NO_SUCH_CIPHERSUITE: // **
return 0;
-
+
// SSL 2, 3, TLS
-
+
case SSL_NULL_WITH_NULL_NULL:
case SSL_RSA_WITH_NULL_MD5:
case SSL_RSA_WITH_NULL_SHA: // **
@@ -217,9 +217,9 @@ int KeySizeOfCipherSuite(SSLCipherSuite suite) {
case SSL_RSA_WITH_IDEA_CBC_SHA: // **
case SSL_DH_anon_WITH_RC4_128_MD5:
return 128;
-
+
// TLS AES options (see RFC 3268)
-
+
case TLS_RSA_WITH_AES_128_CBC_SHA:
case TLS_DH_DSS_WITH_AES_128_CBC_SHA: // **
case TLS_DH_RSA_WITH_AES_128_CBC_SHA: // **
@@ -234,7 +234,7 @@ int KeySizeOfCipherSuite(SSLCipherSuite suite) {
case TLS_DHE_RSA_WITH_AES_256_CBC_SHA:
case TLS_DH_anon_WITH_AES_256_CBC_SHA:
return 256;
-
+
default:
return -1;
}
@@ -287,13 +287,13 @@ int SSLClientSocketMac::ReconnectIgnoringLastError(
void SSLClientSocketMac::Disconnect() {
completed_handshake_ = false;
-
+
if (ssl_context_) {
SSLClose(ssl_context_);
SSLDisposeContext(ssl_context_);
ssl_context_ = NULL;
}
-
+
transport_->Disconnect();
}
@@ -342,7 +342,7 @@ int SSLClientSocketMac::Write(const char* buf, int buf_len,
user_buf_ = const_cast<char*>(buf);
user_buf_len_ = buf_len;
-
+
next_state_ = STATE_PAYLOAD_WRITE;
int rv = DoLoop(OK);
if (rv == ERR_IO_PENDING)
@@ -353,15 +353,15 @@ int SSLClientSocketMac::Write(const char* buf, int buf_len,
void SSLClientSocketMac::GetSSLInfo(SSLInfo* ssl_info) {
DCHECK(completed_handshake_);
OSStatus status;
-
+
ssl_info->Reset();
-
+
// set cert
CFArrayRef certs;
status = SSLCopyPeerCertificates(ssl_context_, &certs);
if (!status) {
DCHECK(CFArrayGetCount(certs) > 0);
-
+
SecCertificateRef client_cert =
static_cast<SecCertificateRef>(
const_cast<void*>(CFArrayGetValueAtIndex(certs, 0)));
@@ -370,17 +370,17 @@ void SSLClientSocketMac::GetSSLInfo(SSLInfo* ssl_info) {
client_cert, X509Certificate::SOURCE_FROM_NETWORK);
CFRelease(certs);
}
-
+
// update status
ssl_info->cert_status = server_cert_status_;
-
+
// security info
SSLCipherSuite suite;
status = SSLGetNegotiatedCipher(ssl_context_, &suite);
if (!status)
ssl_info->security_bits = KeySizeOfCipherSuite(suite);
}
-
+
void SSLClientSocketMac::DoCallback(int rv) {
DCHECK(rv != ERR_IO_PENDING);
DCHECK(user_callback_);
@@ -459,78 +459,78 @@ int SSLClientSocketMac::DoConnectComplete(int result) {
return result;
OSStatus status = noErr;
-
+
status = SSLNewContext(false, &ssl_context_);
if (status)
return NetErrorFromOSStatus(status);
-
+
status = SSLSetProtocolVersionEnabled(ssl_context_,
kSSLProtocol2,
ssl_config_.ssl2_enabled);
if (status)
return NetErrorFromOSStatus(status);
-
+
status = SSLSetProtocolVersionEnabled(ssl_context_,
kSSLProtocol3,
ssl_config_.ssl3_enabled);
if (status)
return NetErrorFromOSStatus(status);
-
+
status = SSLSetProtocolVersionEnabled(ssl_context_,
kTLSProtocol1,
ssl_config_.tls1_enabled);
if (status)
return NetErrorFromOSStatus(status);
-
+
status = SSLSetIOFuncs(ssl_context_, SSLReadCallback, SSLWriteCallback);
if (status)
return NetErrorFromOSStatus(status);
-
+
status = SSLSetConnection(ssl_context_, this);
if (status)
return NetErrorFromOSStatus(status);
-
+
status = SSLSetPeerDomainName(ssl_context_, hostname_.c_str(),
hostname_.length());
if (status)
return NetErrorFromOSStatus(status);
-
+
next_state_ = STATE_HANDSHAKE;
return OK;
}
int SSLClientSocketMac::DoHandshake() {
OSStatus status = SSLHandshake(ssl_context_);
-
+
if (status == errSSLWouldBlock)
next_state_ = STATE_HANDSHAKE;
-
+
if (status == noErr)
completed_handshake_ = true;
-
+
int net_error = NetErrorFromOSStatus(status);
-
+
// At this point we have a connection. For now, we're going to use the default
// certificate verification that the system does, and accept its answer for
// the cert status. In the future, we'll need to call SSLSetEnableCertVerify
// to disable cert verification and do the verification ourselves. This allows
// very fine-grained control over what we'll accept for certification.
// TODO(avi): ditto
-
+
// TODO(wtc): for now, always check revocation.
server_cert_status_ = CERT_STATUS_REV_CHECKING_ENABLED;
if (net_error)
server_cert_status_ |= MapNetErrorToCertStatus(net_error);
-
+
return net_error;
}
int SSLClientSocketMac::DoReadComplete(int result) {
if (result < 0)
return result;
-
+
recv_buffer_tail_slop_ -= result;
-
+
return result;
}
@@ -539,10 +539,10 @@ void SSLClientSocketMac::OnWriteComplete(int result) {
pending_send_error_ = result;
return;
}
-
+
send_buffer_.erase(send_buffer_.begin(),
send_buffer_.begin() + result);
-
+
if (!send_buffer_.empty())
SSLWriteCallback(this, NULL, NULL);
}
@@ -553,22 +553,22 @@ int SSLClientSocketMac::DoPayloadRead() {
user_buf_,
user_buf_len_,
&processed);
-
+
// There's a subtle difference here in semantics of the "would block" errors.
// In our code, ERR_IO_PENDING means the whole operation is async, while
// errSSLWouldBlock means that the stream isn't ending (and is often returned
// along with partial data). So even though "would block" is returned, if we
// have data, let's just return it.
-
+
if (processed > 0) {
next_state_ = STATE_NONE;
return processed;
}
-
+
if (status == errSSLWouldBlock) {
next_state_ = STATE_PAYLOAD_READ;
}
-
+
return NetErrorFromOSStatus(status);
}
@@ -578,10 +578,10 @@ int SSLClientSocketMac::DoPayloadWrite() {
user_buf_,
user_buf_len_,
&processed);
-
+
if (processed > 0)
return processed;
-
+
return NetErrorFromOSStatus(status);
}
@@ -665,40 +665,40 @@ OSStatus SSLClientSocketMac::SSLReadCallback(SSLConnectionRef connection,
SSLClientSocketMac* us =
const_cast<SSLClientSocketMac*>(
static_cast<const SSLClientSocketMac*>(connection));
-
+
// If we have I/O in flight, promise we'll get back to them and use the
// existing callback to do so
-
+
if (us->next_io_state_ == STATE_READ_COMPLETE) {
*data_length = 0;
return errSSLWouldBlock;
}
-
+
// Start with what's in the buffer
-
+
size_t total_read = us->recv_buffer_.size() - us->recv_buffer_head_slop_ -
us->recv_buffer_tail_slop_;
-
+
// Resize the buffer if needed
-
+
if (us->recv_buffer_.size() - us->recv_buffer_head_slop_ < *data_length) {
us->recv_buffer_.resize(us->recv_buffer_head_slop_ + *data_length);
us->recv_buffer_tail_slop_ = *data_length - total_read;
}
-
+
int rv = 1; // any old value to spin the loop below
while (rv > 0 && total_read < *data_length) {
rv = us->transport_->Read(&us->recv_buffer_[us->recv_buffer_head_slop_ +
total_read],
us->recv_buffer_tail_slop_,
&us->io_callback_);
-
+
if (rv > 0) {
total_read += rv;
us->recv_buffer_tail_slop_ -= rv;
}
- }
-
+ }
+
*data_length = total_read;
if (total_read) {
memcpy(data, &us->recv_buffer_[us->recv_buffer_head_slop_], total_read);
@@ -714,31 +714,31 @@ OSStatus SSLClientSocketMac::SSLReadCallback(SSLConnectionRef connection,
us->recv_buffer_head_slop_ = 0;
}
}
-
+
if (rv == ERR_IO_PENDING) {
us->next_io_state_ = STATE_READ_COMPLETE;
}
-
+
if (rv < 0)
return OSStatusFromNetError(rv);
-
+
return noErr;
}
// static
-OSStatus SSLClientSocketMac::SSLWriteCallback(SSLConnectionRef connection,
- const void* data,
+OSStatus SSLClientSocketMac::SSLWriteCallback(SSLConnectionRef connection,
+ const void* data,
size_t* data_length) {
SSLClientSocketMac* us =
const_cast<SSLClientSocketMac*>(
static_cast<const SSLClientSocketMac*>(connection));
-
+
if (us->pending_send_error_ != OK) {
OSStatus status = OSStatusFromNetError(us->pending_send_error_);
us->pending_send_error_ = OK;
return status;
}
-
+
if (data)
us->send_buffer_.insert(us->send_buffer_.end(),
static_cast<const char*>(data),
@@ -751,14 +751,14 @@ OSStatus SSLClientSocketMac::SSLWriteCallback(SSLConnectionRef connection,
if (rv > 0) {
us->send_buffer_.erase(us->send_buffer_.begin(),
us->send_buffer_.begin() + rv);
-
+
}
} while (rv > 0 && !us->send_buffer_.empty());
-
+
if (rv < 0 && rv != ERR_IO_PENDING) {
return OSStatusFromNetError(rv);
}
-
+
// always lie to our caller
return noErr;
}
diff --git a/net/base/ssl_client_socket_mac.h b/net/base/ssl_client_socket_mac.h
index c8a43ce..0bff718 100644
--- a/net/base/ssl_client_socket_mac.h
+++ b/net/base/ssl_client_socket_mac.h
@@ -31,7 +31,7 @@ class SSLClientSocketMac : public SSLClientSocket {
// SSLClientSocket methods:
virtual void GetSSLInfo(SSLInfo* ssl_info);
-
+
// ClientSocket methods:
virtual int Connect(CompletionCallback* callback);
virtual int ReconnectIgnoringLastError(CompletionCallback* callback);
@@ -55,12 +55,12 @@ class SSLClientSocketMac : public SSLClientSocket {
int DoHandshake();
int DoReadComplete(int result);
void OnWriteComplete(int result);
-
+
static OSStatus SSLReadCallback(SSLConnectionRef connection,
void* data,
size_t* data_length);
- static OSStatus SSLWriteCallback(SSLConnectionRef connection,
- const void* data,
+ static OSStatus SSLWriteCallback(SSLConnectionRef connection,
+ const void* data,
size_t* data_length);
CompletionCallbackImpl<SSLClientSocketMac> io_callback_;
@@ -87,12 +87,12 @@ class SSLClientSocketMac : public SSLClientSocket {
};
State next_state_;
State next_io_state_;
-
+
int server_cert_status_;
bool completed_handshake_;
SSLContextRef ssl_context_;
-
+
// These are buffers for holding data during I/O. The "slop" is the amount of
// space at the ends of the receive buffer that are allocated for holding data
// but don't (yet).
diff --git a/net/base/telnet_server.cc b/net/base/telnet_server.cc
index 3260951..8cd2451 100644
--- a/net/base/telnet_server.cc
+++ b/net/base/telnet_server.cc
@@ -22,7 +22,7 @@
#if defined(OS_POSIX)
// Used same name as in Windows to avoid #ifdef where refrenced
#define SOCKET int
-const int INVALID_SOCKET = -1;
+const int INVALID_SOCKET = -1;
const int SOCKET_ERROR = -1;
struct event; // From libevent
#endif
@@ -259,7 +259,7 @@ void TelnetServer::Read() {
break;
#else
if (len == SOCKET_ERROR) {
- if (errno == EWOULDBLOCK || errno == EAGAIN)
+ if (errno == EWOULDBLOCK || errno == EAGAIN)
break;
#endif
} else if (len == 0) {
diff --git a/net/base/test_completion_callback_unittest.cc b/net/base/test_completion_callback_unittest.cc
index 9967482..1d333f7 100644
--- a/net/base/test_completion_callback_unittest.cc
+++ b/net/base/test_completion_callback_unittest.cc
@@ -16,7 +16,7 @@ using net::CompletionCallback;
const int kMagicResult = 8888;
-// ExampleEmployer is a toy version of HostResolver
+// ExampleEmployer is a toy version of HostResolver
// TODO: restore damage done in extracting example from real code
// (e.g. bring back real destructor, bring back comments)
class ExampleEmployer {
@@ -37,7 +37,7 @@ class ExampleEmployer {
};
// Helper class; this is how ExampleEmployer puts work on a different thread
-class ExampleEmployer::ExampleWorker
+class ExampleEmployer::ExampleWorker
: public base::RefCountedThreadSafe<ExampleWorker> {
public:
ExampleWorker(ExampleEmployer* employer, CompletionCallback* callback)
@@ -70,7 +70,7 @@ void ExampleEmployer::ExampleWorker::DoWork() {
reply = NULL;
}
}
-
+
// Does nothing if it got posted.
delete reply;
}
diff --git a/net/base/x509_certificate_mac.cc b/net/base/x509_certificate_mac.cc
index 3ab62e9..f20d683 100644
--- a/net/base/x509_certificate_mac.cc
+++ b/net/base/x509_certificate_mac.cc
@@ -87,21 +87,21 @@ OSStatus GetCertFieldsForOID(X509Certificate::OSCertHandle cert_handle,
CSSM_FIELD_PTR* fields) {
*num_of_fields = 0;
*fields = NULL;
-
+
CSSM_DATA cert_data;
OSStatus status = SecCertificateGetData(cert_handle, &cert_data);
if (status)
return status;
-
+
CSSM_CL_HANDLE cl_handle;
status = SecCertificateGetCLHandle(cert_handle, &cl_handle);
if (status)
return status;
-
+
status = CSSM_CL_CertGetAllFields(cl_handle, &cert_data, num_of_fields,
fields);
return status;
-}
+}
void GetCertGeneralNamesForOID(X509Certificate::OSCertHandle cert_handle,
CSSM_OID oid, CE_GeneralNameType name_type,
@@ -112,14 +112,14 @@ void GetCertGeneralNamesForOID(X509Certificate::OSCertHandle cert_handle,
&fields);
if (status)
return;
-
+
for (size_t field = 0; field < num_of_fields; ++field) {
if (CSSMOIDEqual(&fields[field].FieldOid, &oid)) {
CSSM_X509_EXTENSION_PTR cssm_ext =
(CSSM_X509_EXTENSION_PTR)fields[field].FieldValue.Data;
CE_GeneralNames* alt_name =
(CE_GeneralNames*) cssm_ext->value.parsedValue;
-
+
for (size_t name = 0; name < alt_name->numNames; ++name) {
const CE_GeneralName& name_struct = alt_name->generalName[name];
// For future extension: We're assuming that these values are of types
@@ -146,15 +146,15 @@ void GetCertGeneralNamesForOID(X509Certificate::OSCertHandle cert_handle,
void GetCertDateForOID(X509Certificate::OSCertHandle cert_handle,
CSSM_OID oid, Time* result) {
- *result = Time::Time();
-
+ *result = Time::Time();
+
uint32 num_of_fields;
CSSM_FIELD_PTR fields;
OSStatus status = GetCertFieldsForOID(cert_handle, oid, &num_of_fields,
&fields);
if (status)
return;
-
+
for (size_t field = 0; field < num_of_fields; ++field) {
if (CSSMOIDEqual(&fields[field].FieldOid, &oid)) {
CSSM_X509_TIME* x509_time =
@@ -163,10 +163,10 @@ void GetCertDateForOID(X509Certificate::OSCertHandle cert_handle,
std::string(reinterpret_cast<std::string::value_type*>
(x509_time->time.Data),
x509_time->time.Length);
-
+
DCHECK(x509_time->timeType == BER_TAG_UTC_TIME ||
x509_time->timeType == BER_TAG_GENERALIZED_TIME);
-
+
struct tm time;
const char* parse_string;
if (x509_time->timeType == BER_TAG_UTC_TIME)
@@ -178,9 +178,9 @@ void GetCertDateForOID(X509Certificate::OSCertHandle cert_handle,
// this is a rather broken cert.
return;
}
-
+
strptime(time_string.c_str(), parse_string, &time);
-
+
Time::Exploded exploded;
exploded.year = time.tm_year + 1900;
exploded.month = time.tm_mon + 1;
@@ -190,7 +190,7 @@ void GetCertDateForOID(X509Certificate::OSCertHandle cert_handle,
exploded.minute = time.tm_min;
exploded.second = time.tm_sec;
exploded.millisecond = 0;
-
+
*result = Time::FromUTCExploded(exploded);
break;
}
@@ -209,12 +209,12 @@ void X509Certificate::Initialize() {
if (!status) {
ParsePrincipal(name, &issuer_);
}
-
+
GetCertDateForOID(cert_handle_, CSSMOID_X509V1ValidityNotBefore,
&valid_start_);
GetCertDateForOID(cert_handle_, CSSMOID_X509V1ValidityNotAfter,
&valid_expiry_);
-
+
fingerprint_ = CalculateFingerprint(cert_handle_);
// Store the certificate in the cache in case we need it later.
@@ -228,7 +228,7 @@ X509Certificate* X509Certificate::CreateFromPickle(const Pickle& pickle,
int length;
if (!pickle.ReadData(pickle_iter, &data, &length))
return NULL;
-
+
return CreateFromBytes(data, length);
}
@@ -250,10 +250,10 @@ bool X509Certificate::HasExpired() const {
void X509Certificate::GetDNSNames(std::vector<std::string>* dns_names) const {
dns_names->clear();
-
+
GetCertGeneralNamesForOID(cert_handle_, CSSMOID_SubjectAltName, GNT_DNSName,
dns_names);
-
+
if (dns_names->empty())
dns_names->push_back(subject_.common_name);
}
@@ -264,7 +264,7 @@ int X509Certificate::Verify(const std::string& hostname,
NOTIMPLEMENTED();
return ERR_NOT_IMPLEMENTED;
}
-
+
// Returns true if the certificate is an extended-validation certificate.
//
// The certificate has already been verified by the HTTP library. cert_status