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 <zhaojh329@gmail.com>
main
Jianhui Zhao 2020-12-27 01:08:39 +08:00
parent 06e3d76dc9
commit 943eb35b07
1 changed files with 3 additions and 3 deletions

View File

@ -51,6 +51,9 @@ static void conn_done(struct uh_connection *conn)
ev_io_start(loop, &conn->iow); ev_io_start(loop, &conn->iow);
ev_timer_stop(loop, &conn->timer); 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) 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); 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); path = conn->get_path(conn);
while (h) { while (h) {