]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
lib-http: client: Set conn->connect_request to NULL immediately in http_client_connec...
authorStephan Bosch <stephan@dovecot.fi>
Sun, 11 Sep 2016 17:44:32 +0000 (19:44 +0200)
committerTimo Sirainen <timo.sirainen@dovecot.fi>
Wed, 9 Nov 2016 12:17:02 +0000 (14:17 +0200)
Prevents referring to this completed request in other parts of the code.

src/lib-http/http-client-connection.c

index 5f8b769cba30d7e1bc71c7ba12d563641eabbf3d..fabce89165bd02f29b4b994e2751fe1f54ba9c0d 100644 (file)
@@ -1341,17 +1341,18 @@ http_client_connection_tunnel_response(const struct http_response *response,
 {
        struct http_client_tunnel tunnel;
        const char *name = http_client_peer_addr2str(&conn->peer->addr);
+       struct http_client_request *req = conn->connect_request;
+
+       conn->connect_request = NULL;
 
        if (response->status != 200) {
                http_client_peer_connection_failure(conn->peer, t_strdup_printf(
                        "Tunnel connect(%s) failed: %d %s", name,
                                response->status, response->reason));
-               conn->connect_request = NULL;
                return;
        }
 
-       http_client_request_start_tunnel(conn->connect_request, &tunnel);
-       conn->connect_request = NULL;
+       http_client_request_start_tunnel(req, &tunnel);
 
        connection_init_from_streams
                (conn->client->conn_list, &conn->conn, name, tunnel.input, tunnel.output);