diff options
Diffstat (limited to 'src/connections.c')
-rw-r--r-- | src/connections.c | 40 |
1 files changed, 6 insertions, 34 deletions
diff --git a/src/connections.c b/src/connections.c index 48ca60f..8a2774d 100644 --- a/src/connections.c +++ b/src/connections.c @@ -200,7 +200,7 @@ static int connection_handle_read_ssl(server *srv, connection *con) { int r, ssl_err, len, count = 0, read_offset, toread; buffer *b = NULL; - if (!con->conf.is_ssl) return -1; + if (!con->srv_socket->is_ssl) return -1; ERR_clear_error(); do { @@ -224,8 +224,8 @@ static int connection_handle_read_ssl(server *srv, connection *con) { len = SSL_read(con->ssl, b->ptr + read_offset, toread); if (con->renegotiations > 1 && con->conf.ssl_disable_client_renegotiation) { + log_error_write(srv, __FILE__, __LINE__, "s", "SSL: renegotiation initiated by client, killing connection"); connection_set_state(srv, con, CON_STATE_ERROR); - log_error_write(srv, __FILE__, __LINE__, "s", "SSL: renegotiation initiated by client"); return -1; } @@ -334,7 +334,7 @@ static int connection_handle_read(server *srv, connection *con) { buffer *b; int toread, read_offset; - if (con->conf.is_ssl) { + if (con->srv_socket->is_ssl) { return connection_handle_read_ssl(srv, con); } @@ -419,16 +419,6 @@ static int connection_handle_write_prepare(server *srv, connection *con) { case HTTP_METHOD_GET: case HTTP_METHOD_POST: case HTTP_METHOD_HEAD: - case HTTP_METHOD_PUT: - case HTTP_METHOD_PATCH: - case HTTP_METHOD_MKCOL: - case HTTP_METHOD_DELETE: - case HTTP_METHOD_COPY: - case HTTP_METHOD_MOVE: - case HTTP_METHOD_PROPFIND: - case HTTP_METHOD_PROPPATCH: - case HTTP_METHOD_LOCK: - case HTTP_METHOD_UNLOCK: break; case HTTP_METHOD_OPTIONS: /* @@ -450,16 +440,8 @@ static int connection_handle_write_prepare(server *srv, connection *con) { } break; default: - switch(con->http_status) { - case 400: /* bad request */ - case 401: /* authorization required */ - case 414: /* overload request header */ - case 505: /* unknown protocol */ - case 207: /* this was webdav */ - break; - default: + if (0 == con->http_status) { con->http_status = 501; - break; } break; } @@ -694,7 +676,6 @@ connection *connection_init(server *srv) { CLEAN(physical.etag); CLEAN(parse_request); - CLEAN(authed_user); CLEAN(server_name); CLEAN(error_handler); CLEAN(dst_addr_buf); @@ -761,7 +742,6 @@ void connections_free(server *srv) { CLEAN(physical.rel_path); CLEAN(parse_request); - CLEAN(authed_user); CLEAN(server_name); CLEAN(error_handler); CLEAN(dst_addr_buf); @@ -835,7 +815,6 @@ int connection_reset(server *srv, connection *con) { CLEAN(parse_request); - CLEAN(authed_user); CLEAN(server_name); CLEAN(error_handler); #if defined USE_OPENSSL && ! defined OPENSSL_NO_TLSEXT @@ -1192,7 +1171,7 @@ static handler_t connection_handle_fdevent(server *srv, void *context, int reven joblist_append(srv, con); - if (con->conf.is_ssl) { + if (con->srv_socket->is_ssl) { /* ssl may read and write for both reads and writes */ if (revents & (FDEVENT_IN | FDEVENT_OUT)) { con->is_readable = 1; @@ -1363,7 +1342,6 @@ connection *connection_accept(server *srv, server_socket *srv_socket) { con->renegotiations = 0; SSL_set_app_data(con->ssl, con); SSL_set_accept_state(con->ssl); - con->conf.is_ssl=1; if (1 != (SSL_set_fd(con->ssl, cnt))) { log_error_write(srv, __FILE__, __LINE__, "ss", "SSL:", @@ -1408,12 +1386,6 @@ int connection_state_machine(server *srv, connection *con) { connection_set_state(srv, con, CON_STATE_READ); - /* patch con->conf.is_ssl if the connection is a ssl-socket already */ - -#ifdef USE_OPENSSL - con->conf.is_ssl = srv_sock->is_ssl; -#endif - break; case CON_STATE_REQUEST_END: /* transient */ if (srv->srvconf.log_state_handling) { @@ -1736,8 +1708,8 @@ int connection_state_machine(server *srv, connection *con) { break; } } + ERR_clear_error(); } - ERR_clear_error(); #endif switch(con->mode) { |