data = ustream_get_read_buf(uh->us, &len);
} while (data && uh->state < HTTP_STATE_RECV_DATA);
data = ustream_get_read_buf(uh->us, &len);
} while (data && uh->state < HTTP_STATE_RECV_DATA);
us->string_data = true;
us->notify_state = uclient_notify_state;
us->notify_read = uclient_notify_read;
ret = uclient_do_connect(uh, "80");
if (ret)
us->string_data = true;
us->notify_state = uclient_notify_state;
us->notify_read = uclient_notify_read;
ret = uclient_do_connect(uh, "80");
if (ret)
uh->ussl.notify_error = uclient_ssl_notify_error;
uh->ussl.notify_verify_error = uclient_ssl_notify_verify_error;
uh->ussl.notify_connected = uclient_ssl_notify_connected;
uh->ussl.notify_error = uclient_ssl_notify_error;
uh->ussl.notify_verify_error = uclient_ssl_notify_verify_error;
uh->ussl.notify_connected = uclient_ssl_notify_connected;
- ustream_ssl_init(&uh->ussl, &uh->ufd.stream, uh->ssl_ctx, false);
- ustream_ssl_set_peer_cn(&uh->ussl, uh->uc.url->host);
+ uh->ssl_ops->init(&uh->ussl, &uh->ufd.stream, uh->ssl_ctx, false);
+ uh->ssl_ops->set_peer_cn(&uh->ussl, uh->uc.url->host);
}
static void uclient_http_free(struct uclient *cl)
{
struct uclient_http *uh = container_of(cl, struct uclient_http, uc);
}
static void uclient_http_free(struct uclient *cl)
{
struct uclient_http *uh = container_of(cl, struct uclient_http, uc);
-int uclient_http_set_ssl_ctx(struct uclient *cl, struct ustream_ssl_ctx *ctx, bool require_validation)
+int uclient_http_set_ssl_ctx(struct uclient *cl, const struct ustream_ssl_ops *ops,
+ struct ustream_ssl_ctx *ctx, bool require_validation)
+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,
.alloc = uclient_http_alloc,
.free = uclient_http_free,
.connect = uclient_http_connect,
const struct uclient_backend uclient_backend_http = {
.prefix = uclient_http_prefix,
.alloc = uclient_http_alloc,
.free = uclient_http_free,
.connect = uclient_http_connect,
.update_url = uclient_http_free_url_state,
.read = uclient_http_read,
.update_url = uclient_http_free_url_state,
.read = uclient_http_read,