struct uclient_cb;
struct uclient_backend;
+enum uclient_error_code {
+ UCLIENT_ERROR_UNKNOWN,
+ UCLIENT_ERROR_CONNECT,
+ UCLIENT_ERROR_SSL_INVALID_CERT,
+ UCLIENT_ERROR_SSL_CN_MISMATCH,
+};
+
struct uclient {
const struct uclient_backend *backend;
const struct uclient_cb *cb;
void *priv;
bool eof;
- bool error;
+ int error_code;
int status_code;
struct blob_attr *meta;
void (*data_sent)(struct uclient *cl);
void (*data_eof)(struct uclient *cl);
void (*header_done)(struct uclient *cl);
- void (*error)(struct uclient *cl);
+ void (*error)(struct uclient *cl, int code);
};
struct uclient *uclient_new(const char *url, const struct uclient_cb *cb);
int uclient_http_set_request_type(struct uclient *cl, const char *type);
bool uclient_http_redirect(struct uclient *cl);
-int uclient_http_set_ssl_ctx(struct uclient *cl, struct ustream_ssl_ctx *ctx);
+int uclient_http_set_ssl_ctx(struct uclient *cl, struct ustream_ssl_ctx *ctx, bool require_validation);
#endif