diff options
author | Felix Fietkau <nbd@openwrt.org> | 2014-09-04 13:10:59 +0200 |
---|---|---|
committer | Felix Fietkau <nbd@openwrt.org> | 2014-09-04 13:11:01 +0200 |
commit | b63202344bf2e01c2054858212a9737f39170a15 (patch) | |
tree | b6fa39d77555afb60eae7f6f6999c652a8e4ad19 /uclient-http.c | |
parent | 754ca1bbb0d59a0d2873bb1996307cd92bbf2238 (diff) | |
download | uclient-b63202344bf2e01c2054858212a9737f39170a15.tar.gz |
http: do not call uclient_http_disconnect from uclient_notify_eof directly
Depending on the context, it can lead to crashes
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Diffstat (limited to 'uclient-http.c')
-rw-r--r-- | uclient-http.c | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/uclient-http.c b/uclient-http.c index 1569cda..ff1bcc4 100644 --- a/uclient-http.c +++ b/uclient-http.c @@ -159,6 +159,18 @@ static void uclient_http_error(struct uclient_http *uh, int code) uclient_backend_set_error(&uh->uc, code); } +static void uclient_http_request_disconnect(struct uclient *cl) +{ + struct uclient_http *uh = container_of(cl, struct uclient_http, uc); + + if (!uh->us) + return; + + uh->eof = true; + uh->disconnect = true; + uloop_timeout_set(&uh->disconnect_t, 1); +} + static void uclient_notify_eof(struct uclient_http *uh) { struct ustream *us = uh->us; @@ -177,7 +189,7 @@ static void uclient_notify_eof(struct uclient_http *uh) uclient_backend_set_eof(&uh->uc); if (uh->connection_close) - uclient_http_disconnect(uh); + uclient_http_request_disconnect(&uh->uc); } static void uclient_http_reset_state(struct uclient_http *uh) @@ -1047,18 +1059,6 @@ int uclient_http_set_ssl_ctx(struct uclient *cl, const struct ustream_ssl_ops *o return 0; } -static void uclient_http_request_disconnect(struct uclient *cl) -{ - struct uclient_http *uh = container_of(cl, struct uclient_http, uc); - - if (!uh->us) - return; - - uh->eof = true; - uh->disconnect = true; - uloop_timeout_set(&uh->disconnect_t, 1); -} - const struct uclient_backend uclient_backend_http = { .prefix = uclient_http_prefix, |