From 943eb35b07d0c6889f4e91da0ede634179bf5095 Mon Sep 17 00:00:00 2001 From: Jianhui Zhao Date: Sun, 27 Dec 2020 01:08:39 +0800 Subject: [PATCH] fix bug: The Handler function is not set correctly This problem occurs when the same connection is requested multiple times Signed-off-by: Jianhui Zhao --- src/connection.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/connection.c b/src/connection.c index b24afec..d3298bc 100644 --- a/src/connection.c +++ b/src/connection.c @@ -51,6 +51,9 @@ static void conn_done(struct uh_connection *conn) ev_io_start(loop, &conn->iow); ev_timer_stop(loop, &conn->timer); + + /* This is needed for a connection requested multiple times */ + conn->handler = NULL; } static void conn_send(struct uh_connection *conn, const void *data, ssize_t len) @@ -359,9 +362,6 @@ static int on_headers_complete(struct http_parser *parser) http_parser_parse_url(O2D(conn, req->url.offset), req->url.length, false, &conn->url_parser); - if (conn->handler) - return 0; - path = conn->get_path(conn); while (h) {