aboutsummaryrefslogtreecommitdiff
path: root/src/daemon/connection_https.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/daemon/connection_https.c')
-rw-r--r--src/daemon/connection_https.c62
1 files changed, 32 insertions, 30 deletions
diff --git a/src/daemon/connection_https.c b/src/daemon/connection_https.c
index 622c2564..3ced8602 100644
--- a/src/daemon/connection_https.c
+++ b/src/daemon/connection_https.c
@@ -58,26 +58,26 @@ MHD_get_connection_info (struct MHD_Connection *connection,
58 { 58 {
59#if HTTPS_SUPPORT 59#if HTTPS_SUPPORT
60 case MHD_CONNECTION_INFO_CIPHER_ALGO: 60 case MHD_CONNECTION_INFO_CIPHER_ALGO:
61 return (const union MHD_ConnectionInfo *) &connection-> 61 return (const union MHD_ConnectionInfo *) &connection->tls_session->
62 tls_session->security_parameters.read_bulk_cipher_algorithm; 62 security_parameters.read_bulk_cipher_algorithm;
63 case MHD_CONNECTION_INFO_KX_ALGO: 63 case MHD_CONNECTION_INFO_KX_ALGO:
64 return (const union MHD_ConnectionInfo *) &connection-> 64 return (const union MHD_ConnectionInfo *) &connection->tls_session->
65 tls_session->security_parameters.kx_algorithm; 65 security_parameters.kx_algorithm;
66 case MHD_CONNECTION_INFO_CREDENTIALS_TYPE: 66 case MHD_CONNECTION_INFO_CREDENTIALS_TYPE:
67 return (const union MHD_ConnectionInfo *) &connection-> 67 return (const union MHD_ConnectionInfo *) &connection->tls_session->
68 tls_session->key->cred->algorithm; 68 key->cred->algorithm;
69 case MHD_CONNECTION_INFO_MAC_ALGO: 69 case MHD_CONNECTION_INFO_MAC_ALGO:
70 return (const union MHD_ConnectionInfo *) &connection-> 70 return (const union MHD_ConnectionInfo *) &connection->tls_session->
71 tls_session->security_parameters.read_mac_algorithm; 71 security_parameters.read_mac_algorithm;
72 case MHD_CONNECTION_INFO_COMPRESSION_METHOD: 72 case MHD_CONNECTION_INFO_COMPRESSION_METHOD:
73 return (const union MHD_ConnectionInfo *) &connection-> 73 return (const union MHD_ConnectionInfo *) &connection->tls_session->
74 tls_session->security_parameters.read_compression_algorithm; 74 security_parameters.read_compression_algorithm;
75 case MHD_CONNECTION_INFO_PROTOCOL: 75 case MHD_CONNECTION_INFO_PROTOCOL:
76 return (const union MHD_ConnectionInfo *) &connection-> 76 return (const union MHD_ConnectionInfo *) &connection->tls_session->
77 tls_session->security_parameters.version; 77 security_parameters.version;
78 case MHD_CONNECTION_INFO_CERT_TYPE: 78 case MHD_CONNECTION_INFO_CERT_TYPE:
79 return (const union MHD_ConnectionInfo *) &connection-> 79 return (const union MHD_ConnectionInfo *) &connection->tls_session->
80 tls_session->security_parameters.cert_type; 80 security_parameters.cert_type;
81#endif 81#endif
82 default: 82 default:
83 return NULL; 83 return NULL;
@@ -96,8 +96,7 @@ MHD_get_connection_info (struct MHD_Connection *connection,
96 */ 96 */
97static void 97static void
98MHD_tls_connection_close (struct MHD_Connection *connection, 98MHD_tls_connection_close (struct MHD_Connection *connection,
99 enum MHD_RequestTerminationCode 99 enum MHD_RequestTerminationCode termination_code)
100 termination_code)
101{ 100{
102 MHD__gnutls_bye (connection->tls_session, GNUTLS_SHUT_WR); 101 MHD__gnutls_bye (connection->tls_session, GNUTLS_SHUT_WR);
103 connection->tls_session->internals.read_eof = 1; 102 connection->tls_session->internals.read_eof = 1;
@@ -106,8 +105,9 @@ MHD_tls_connection_close (struct MHD_Connection *connection,
106 connection->socket_fd = -1; 105 connection->socket_fd = -1;
107 connection->state = MHD_CONNECTION_CLOSED; 106 connection->state = MHD_CONNECTION_CLOSED;
108 if (connection->daemon->notify_completed != NULL) 107 if (connection->daemon->notify_completed != NULL)
109 connection->daemon->notify_completed (connection->daemon-> 108 connection->daemon->notify_completed (connection->
110 notify_completed_cls, connection, 109 daemon->notify_completed_cls,
110 connection,
111 &connection->client_context, 111 &connection->client_context,
112 termination_code); 112 termination_code);
113} 113}
@@ -136,7 +136,7 @@ MHD_tls_connection_handle_idle (struct MHD_Connection *connection)
136 && (time (NULL) - timeout > connection->last_activity)) 136 && (time (NULL) - timeout > connection->last_activity))
137 { 137 {
138 MHD_tls_connection_close (connection, 138 MHD_tls_connection_close (connection,
139 MHD_REQUEST_TERMINATED_TIMEOUT_REACHED); 139 MHD_REQUEST_TERMINATED_TIMEOUT_REACHED);
140 return MHD_NO; 140 return MHD_NO;
141 } 141 }
142 switch (connection->state) 142 switch (connection->state)
@@ -147,12 +147,12 @@ MHD_tls_connection_handle_idle (struct MHD_Connection *connection)
147 /* close connection if necessary */ 147 /* close connection if necessary */
148 case MHD_CONNECTION_CLOSED: 148 case MHD_CONNECTION_CLOSED:
149 if (connection->socket_fd != -1) 149 if (connection->socket_fd != -1)
150 MHD_tls_connection_close (connection, 150 MHD_tls_connection_close (connection,
151 MHD_REQUEST_TERMINATED_COMPLETED_OK); 151 MHD_REQUEST_TERMINATED_COMPLETED_OK);
152 return MHD_NO; 152 return MHD_NO;
153 case MHD_TLS_HANDSHAKE_FAILED: 153 case MHD_TLS_HANDSHAKE_FAILED:
154 MHD_tls_connection_close (connection, 154 MHD_tls_connection_close (connection,
155 MHD_REQUEST_TERMINATED_WITH_ERROR); 155 MHD_REQUEST_TERMINATED_WITH_ERROR);
156 return MHD_NO; 156 return MHD_NO;
157 /* some HTTP state */ 157 /* some HTTP state */
158 default: 158 default:
@@ -237,14 +237,14 @@ MHD_tls_connection_handle_read (struct MHD_Connection *connection)
237 "Error: received handshake message out of context\n"); 237 "Error: received handshake message out of context\n");
238#endif 238#endif
239 MHD_tls_connection_close (connection, 239 MHD_tls_connection_close (connection,
240 MHD_REQUEST_TERMINATED_WITH_ERROR); 240 MHD_REQUEST_TERMINATED_WITH_ERROR);
241 return MHD_NO; 241 return MHD_NO;
242 } 242 }
243 243
244 /* ignore any out of bound change chiper spec messages */ 244 /* ignore any out of bound change chiper spec messages */
245 case GNUTLS_CHANGE_CIPHER_SPEC: 245 case GNUTLS_CHANGE_CIPHER_SPEC:
246 MHD_tls_connection_close (connection, 246 MHD_tls_connection_close (connection,
247 MHD_REQUEST_TERMINATED_WITH_ERROR); 247 MHD_REQUEST_TERMINATED_WITH_ERROR);
248 return MHD_NO; 248 return MHD_NO;
249 249
250 case GNUTLS_ALERT: 250 case GNUTLS_ALERT:
@@ -269,8 +269,9 @@ MHD_tls_connection_handle_read (struct MHD_Connection *connection)
269#if HAVE_MESSAGES 269#if HAVE_MESSAGES
270 MHD_DLOG (connection->daemon, 270 MHD_DLOG (connection->daemon,
271 "Received TLS alert: %s\n", 271 "Received TLS alert: %s\n",
272 MHD__gnutls_alert_get_name ((int) connection->tls_session-> 272 MHD__gnutls_alert_get_name ((int) connection->
273 internals.last_alert)); 273 tls_session->internals.
274 last_alert));
274#endif 275#endif
275 return MHD_YES; 276 return MHD_YES;
276 } 277 }
@@ -279,7 +280,7 @@ MHD_tls_connection_handle_read (struct MHD_Connection *connection)
279 GNUTLS_AL_FATAL) 280 GNUTLS_AL_FATAL)
280 { 281 {
281 MHD_tls_connection_close (connection, 282 MHD_tls_connection_close (connection,
282 MHD_REQUEST_TERMINATED_WITH_ERROR); 283 MHD_REQUEST_TERMINATED_WITH_ERROR);
283 return MHD_NO; 284 return MHD_NO;
284 } 285 }
285 /* this should never execute */ 286 /* this should never execute */
@@ -304,11 +305,12 @@ MHD_tls_connection_handle_read (struct MHD_Connection *connection)
304#if HAVE_MESSAGES 305#if HAVE_MESSAGES
305 MHD_DLOG (connection->daemon, 306 MHD_DLOG (connection->daemon,
306 "Error: unrecognized TLS message type: %d, connection state: %s. l: %d, f: %s\n", 307 "Error: unrecognized TLS message type: %d, connection state: %s. l: %d, f: %s\n",
307 msg_type, MHD_state_to_string(connection->state), __LINE__, __FUNCTION__); 308 msg_type, MHD_state_to_string (connection->state), __LINE__,
309 __FUNCTION__);
308#endif 310#endif
309 /* close connection upon reception of unrecognized message type */ 311 /* close connection upon reception of unrecognized message type */
310 MHD_tls_connection_close (connection, 312 MHD_tls_connection_close (connection,
311 MHD_REQUEST_TERMINATED_WITH_ERROR); 313 MHD_REQUEST_TERMINATED_WITH_ERROR);
312 return MHD_NO; 314 return MHD_NO;
313 } 315 }
314 316