From: Alex Rousskov Date: Fri, 22 Apr 2016 03:48:37 +0000 (-0600) Subject: Merged two identical methods together. No functionality changes. X-Git-Tag: SQUID_4_0_11~29^2~22 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=7706b2efe603e6fee63888bd546328debb74cfef;p=thirdparty%2Fsquid.git Merged two identical methods together. No functionality changes. --- diff --git a/src/client_side.cc b/src/client_side.cc index 416f81e179..14d1795dac 100644 --- a/src/client_side.cc +++ b/src/client_side.cc @@ -2189,7 +2189,7 @@ ConnStateData::afterClientRead() #if USE_OPENSSL if (atTlsPeek) { assert(!inBuf.isEmpty()); - if (!tlsParser.parseClientHello(inBuf)) { + if (!tlsParser.parseHello(inBuf)) { if (!tlsParser.parseError) { readSomeData(); return; diff --git a/src/security/Handshake.cc b/src/security/Handshake.cc index b493078b32..c02d58817d 100644 --- a/src/security/Handshake.cc +++ b/src/security/Handshake.cc @@ -432,32 +432,8 @@ Security::HandshakeParser::skipMessage(const char *description) tkMessages.commit(); } -/// parseServerHelloTry() wrapper that maintains parseDone/parseError state bool -Security::HandshakeParser::parseServerHello(const SBuf &data) -{ - try { - // data contains everything read so far, but we may read more later - tkRecords.reinput(data, true); - tkRecords.rollback(); - while (!tkRecords.atEnd() && !parseDone) - parseRecord(); - debugs(83, 7, "success; done: " << parseDone); - return parseDone; - } - catch (const BinaryTokenizer::InsufficientInput &) { - debugs(83, 5, "need more data"); - Must(!parseError); - } - catch (const std::exception &ex) { - debugs(83, 2, "parsing error: " << ex.what()); - parseError = true; - } - return false; -} - -bool -Security::HandshakeParser::parseClientHello(const SBuf &data) +Security::HandshakeParser::parseHello(const SBuf &data) { try { // data contains everything read so far, but we may read more later diff --git a/src/security/Handshake.h b/src/security/Handshake.h index fbb9f5972c..813f388a9d 100644 --- a/src/security/Handshake.h +++ b/src/security/Handshake.h @@ -181,15 +181,10 @@ public: HandshakeParser(): state(atHelloNone), ressumingSession(false), parseDone(false), parseError(false), currentContentType(0), expectingModernRecords(false) {} - /// Parses the initial sequence of raw bytes sent by the SSL server. + /// Parses the initial sequence of raw bytes sent by the SSL agent. /// Returns true upon successful completion (HelloDone or Finished received). /// Otherwise, returns false (and sets parseError to true on errors). - bool parseServerHello(const SBuf &data); - - /// Parses the initial sequence of raw bytes sent by the SSL client. - /// Returns true upon successful completion (HelloDone or Finished received). - /// Otherwise, returns false (and sets parseError to true on errors). - bool parseClientHello(const SBuf &data); + bool parseHello(const SBuf &data); TlsDetails::Pointer details; #if USE_OPENSSL diff --git a/src/ssl/bio.cc b/src/ssl/bio.cc index bf85a16b64..09bc5873dc 100644 --- a/src/ssl/bio.cc +++ b/src/ssl/bio.cc @@ -248,7 +248,7 @@ Ssl::ServerBio::readAndParse(char *buf, const int size, BIO *table) if (result <= 0) return result; - if (!parser_.parseServerHello(rbuf)) { + if (!parser_.parseHello(rbuf)) { if (!parser_.parseError) { BIO_set_retry_read(table); return -1;