aboutsummaryrefslogtreecommitdiffstats
path: root/src/tls/tls_server.cpp
diff options
context:
space:
mode:
authorlloyd <[email protected]>2012-04-18 19:44:59 +0000
committerlloyd <[email protected]>2012-04-18 19:44:59 +0000
commita8c026b7299d748b2e94f136377d6f46d4cb5da2 (patch)
tree9d768badeabcb0943156cef7d5934ea0dcb4a4ca /src/tls/tls_server.cpp
parent7ab8373cc2dd32ce45c119134b05121459b2789e (diff)
Add a bool param to renegotiate on if we should force a full
renegotiation or not. Save the hostname in the client so we can pull the session from the session manager.
Diffstat (limited to 'src/tls/tls_server.cpp')
-rw-r--r--src/tls/tls_server.cpp19
1 files changed, 12 insertions, 7 deletions
diff --git a/src/tls/tls_server.cpp b/src/tls/tls_server.cpp
index 312656eb1..9da4ca3b8 100644
--- a/src/tls/tls_server.cpp
+++ b/src/tls/tls_server.cpp
@@ -204,12 +204,14 @@ Server::Server(std::tr1::function<void (const byte[], size_t)> output_fn,
/*
* Send a hello request to the client
*/
-void Server::renegotiate()
+void Server::renegotiate(bool force_full_renegotiation)
{
if(state)
return; // currently in handshake
state = new Handshake_State(new Stream_Handshake_Reader);
+
+ state->allow_session_resumption = !force_full_renegotiation;
state->set_expected_next(CLIENT_HELLO);
Hello_Request hello_req(writer);
}
@@ -271,7 +273,8 @@ void Server::process_handshake_msg(Handshake_Type type,
{
state->client_hello = new Client_Hello(contents, type);
- m_hostname = state->client_hello->sni_hostname();
+ if(state->client_hello->sni_hostname() != "")
+ m_hostname = state->client_hello->sni_hostname();
Protocol_Version client_version = state->client_hello->version();
@@ -293,11 +296,13 @@ void Server::process_handshake_msg(Handshake_Type type,
reader.set_version(state->version());
Session session_info;
- const bool resuming = check_for_resume(session_info,
- session_manager,
- creds,
- state->client_hello,
- policy.session_ticket_lifetime());
+ const bool resuming =
+ state->allow_session_resumption &&
+ check_for_resume(session_info,
+ session_manager,
+ creds,
+ state->client_hello,
+ policy.session_ticket_lifetime());
bool have_session_ticket_key = false;