From 2513af5f06a5ff6849bdd173be0fab1607e0bc8a Mon Sep 17 00:00:00 2001 From: Stefan Becker Date: Wed, 10 Apr 2013 12:43:25 +0300 Subject: [PATCH] http: on error response throw away security context This makes sure that the next HTTP request to the same host starts a new authentication handshake. --- src/core/sipe-http-request.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/core/sipe-http-request.c b/src/core/sipe-http-request.c index 45712429..fceba973 100644 --- a/src/core/sipe-http-request.c +++ b/src/core/sipe-http-request.c @@ -348,6 +348,15 @@ void sipe_http_request_response(struct sipe_http_connection_public *conn_public, msg); } else { + /* On error throw away the security context */ + if ((msg->response >= SIPE_HTTP_STATUS_CLIENT_ERROR) && + conn_public->context) { + SIPE_DEBUG_INFO("sipe_http_request_response: response was %d, throwing away security context", + msg->response); + sip_sec_destroy_context(conn_public->context); + conn_public->context = NULL; + } + /* All other cases are passed on to the user */ sipe_http_request_response_callback(sipe_private, req, msg); -- 2.11.4.GIT