/* * Copyright 2004 The WebRTC Project Authors. All rights reserved. * * Use of this source code is governed by a BSD-style license * that can be found in the LICENSE file in the root of the source * tree. An additional intellectual property rights grant can be found * in the file PATENTS. All contributing project authors may * be found in the AUTHORS file in the root of the source tree.
*/
// FIX: If cb == 0, we won't generate another read event
int res = AsyncSocketAdapter::Recv(pv, cb, timestamp); if (res >= 0) { // Read from socket and possibly buffer; return combined length return res + static_cast<int>(read);
}
if (read > 0) { // Failed to read from socket, but still read something from buffer returnstatic_cast<int>(read);
}
int len = AsyncSocketAdapter::Recv(buffer_ + data_len_,
buffer_size_ - data_len_, nullptr); if (len < 0) { // TODO: Do something better like forwarding the error to the user.
RTC_LOG_ERR(LS_INFO) << "Recv"; return;
}
// This is a SSL v2 CLIENT_HELLO message. // TODO: Should this have a session id? The response doesn't have a // certificate, so the hello should have a session id. staticconst uint8_t kSslClientHello[] = {
0x80, 0x46, // msg len
0x01, // CLIENT_HELLO
0x03, 0x01, // SSL 3.1
0x00, 0x2d, // ciphersuite len
0x00, 0x00, // session id len
0x00, 0x10, // challenge len
0x01, 0x00, 0x80, 0x03, 0x00, 0x80, 0x07, 0x00, 0xc0, // ciphersuites
0x06, 0x00, 0x40, 0x02, 0x00, 0x80, 0x04, 0x00, 0x80, //
0x00, 0x00, 0x04, 0x00, 0xfe, 0xff, 0x00, 0x00, 0x0a, //
0x00, 0xfe, 0xfe, 0x00, 0x00, 0x09, 0x00, 0x00, 0x64, //
0x00, 0x00, 0x62, 0x00, 0x00, 0x03, 0x00, 0x00, 0x06, //
0x1f, 0x17, 0x0c, 0xa6, 0x2f, 0x00, 0x78, 0xfc, // challenge
0x46, 0x55, 0x2e, 0xb1, 0x83, 0x39, 0xf1, 0xea //
};
// static
ArrayView<const uint8_t> AsyncSSLSocket::SslClientHello() { // Implicit conversion directly from kSslClientHello to ArrayView fails when // built with gcc. return {kSslClientHello, sizeof(kSslClientHello)};
}
int AsyncSSLSocket::Connect(const SocketAddress& addr) { // Begin buffering before we connect, so that there isn't a race condition // between potential senders and receiving the OnConnectEvent signal
BufferInput(true); return BufferedReadAdapter::Connect(addr);
}
void AsyncSSLSocket::OnConnectEvent(Socket* socket) {
RTC_DCHECK(socket == GetSocket()); // TODO: we could buffer output too... constint res = DirectSend(kSslClientHello, sizeof(kSslClientHello)); if (res != sizeof(kSslClientHello)) {
RTC_LOG(LS_ERROR) << "Sending fake SSL ClientHello message failed.";
Close();
SignalCloseEvent(this, 0);
}
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.