fix connect error handling
authorFelix Fietkau <nbd@openwrt.org>
Tue, 25 Mar 2014 09:11:36 +0000 (10:11 +0100)
committerFelix Fietkau <nbd@openwrt.org>
Tue, 25 Mar 2014 09:11:36 +0000 (10:11 +0100)
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
uclient-http.c

index 045a77296a5b74b2cf5ccaab2b6a2e23481a09ca..bff6d38ca861870109aa5b1edd65723cae53d0d5 100644 (file)
@@ -668,6 +668,7 @@ static int uclient_setup_https(struct uclient_http *uh)
 static int uclient_http_connect(struct uclient *cl)
 {
        struct uclient_http *uh = container_of(cl, struct uclient_http, uc);
+       int ret;
 
        uclient_http_init_request(uh);
 
@@ -677,9 +678,14 @@ static int uclient_http_connect(struct uclient *cl)
        uh->ssl = cl->url->prefix == PREFIX_HTTPS;
 
        if (uh->ssl)
-               return uclient_setup_https(uh);
+               ret = uclient_setup_https(uh);
        else
-               return uclient_setup_http(uh);
+               ret = uclient_setup_http(uh);
+
+       if (ret)
+               uh->state = HTTP_STATE_ERROR;
+
+       return ret;
 }
 
 static struct uclient *uclient_http_alloc(void)