clientConn->close();
} else if (finalAction != Ssl::bumpSplice) {
//Allow write, proceed with the connection
+ srvBio->recordInput(false);
srvBio->holdWrite(false);
debugs(83,5, "Retry the fwdNegotiateSSL on FD " << serverConn->fd);
Ssl::PeerConnector::noteWantWrite();
Ssl::ServerBio *srvBio = static_cast<Ssl::ServerBio *>(b->ptr);
const Ssl::X509_STACK_Pointer &certs = srvBio->serverCertificates();
- if (sk_X509_num(certs.get())) {
+ if (certs.get() && sk_X509_num(certs.get())) {
debugs(83, 5, "SSL server sent " << sk_X509_num(certs.get()) << " certificates");
Ssl::missingChainCertificatesUrls(urlsOfMissingCerts, certs);
if (urlsOfMissingCerts.size()) {
Ssl::ServerBio *srvBio = static_cast<Ssl::ServerBio *>(b->ptr);
// Inherite client features, like SSL version, SNI and other
srvBio->setClientFeatures(features);
+ srvBio->recordInput(true);
srvBio->mode(csd->sslBumpMode);
}
}
int
Ssl::ServerBio::read(char *buf, int size, BIO *table)
{
- if (parser_.state < Ssl::HandshakeParser::atHelloDoneReceived) {
+ if (!parser_.parseDone || record_) {
int ret = readAndBufferServerHelloMsg(table, "TLS server Hello");
- if (ret <= 0)
+ if (!rbuf.contentSize() && parser_.parseDone && ret <= 0)
return ret;
}
{
Must(currentContentType == Rfc5246::ContentType::ctChangeCipherSpec);
// we are currently ignoring Change Cipher Spec Protocol messages
- // XXX: everything after this message is going to be encrypted, right?
- // If so, then continuing parsing is pointless.
+ // Everything after this message may be is encrypted
+ // The continuing parsing is pointless, abort here and set parseDone
skipMessage("ChangeCipherCpec msg");
+ ressumingSession = true;
+ parseDone = true;
}
void
class ServerBio: public Bio
{
public:
- explicit ServerBio(const int anFd): Bio(anFd), helloMsgSize(0), helloBuild(false), allowSplice(false), allowBump(false), holdWrite_(false), holdRead_(true), bumpMode_(bumpNone), rbufConsumePos(0) {}
+ explicit ServerBio(const int anFd): Bio(anFd), helloMsgSize(0), helloBuild(false), allowSplice(false), allowBump(false), holdWrite_(false), holdRead_(true), record_(false), bumpMode_(bumpNone), rbufConsumePos(0) {}
/// The ServerBio version of the Ssl::Bio::stateChanged method
virtual void stateChanged(const SSL *ssl, int where, int ret);
/// The ServerBio version of the Ssl::Bio::write method
bool holdRead() const {return holdRead_;}
/// Enables or disables the read hold state
void holdRead(bool h) {holdRead_ = h;}
+ /// Enables or disables the input data recording, for internal analysis.
+ void recordInput(bool r) {record_ = r;}
/// Whether we can splice or not the SSL stream
bool canSplice() {return allowSplice;}
/// Whether we can bump or not the SSL stream
bool allowBump; ///< True if the SSL stream can be bumped
bool holdWrite_; ///< The write hold state of the bio.
bool holdRead_; ///< The read hold state of the bio.
+ bool record_; ///< If true the input data recorded to rbuf for internal use
Ssl::BumpMode bumpMode_;
///< The size of data stored in rbuf which passed to the openSSL