+
+ rc = uclient_http_set_request_type(cl, post_data ? "POST" : "GET");
+ if (rc)
+ return rc;
+
+ uclient_http_reset_headers(cl);
+ uclient_http_set_header(cl, "User-Agent", user_agent);
+
+ if (post_data) {
+ uclient_http_set_header(cl, "Content-Type", "application/x-www-form-urlencoded");
+ uclient_write(cl, post_data, strlen(post_data));
+ }
+
+ rc = uclient_request(cl);
+ if (rc)
+ return rc;
+
+ return 0;
+}
+
+static void request_done(struct uclient *cl)
+{
+ if (n_urls) {
+ uclient_set_url(cl, *urls, auth_str);
+ n_urls--;
+ error_ret = init_request(cl);
+ if (error_ret == 0)
+ return;
+ }
+
+ if (output_fd >= 0 && !output_file) {
+ close(output_fd);
+ output_fd = -1;
+ }
+ uclient_disconnect(cl);
+ uloop_end();