goto ERROR;
// Create a new HTTP client
- r = pakfire_httpclient_create(&self->httpclient, self->ctx);
+ r = pakfire_httpclient_create(&self->httpclient, self->ctx, PAKFIRE_PROGRESS_NO_PROGRESS);
if (r < 0)
goto ERROR;
return 0;
}
-static int pakfire_httpclient_setup_progress(struct pakfire_httpclient* self) {
+static int pakfire_httpclient_setup_progress(struct pakfire_httpclient* self, int flags) {
int r;
- const int flags =
- PAKFIRE_PROGRESS_SHOW_PERCENTAGE |
- PAKFIRE_PROGRESS_SHOW_ETA |
- PAKFIRE_PROGRESS_SHOW_BYTES_TRANSFERRED |
- PAKFIRE_PROGRESS_SHOW_TRANSFER_SPEED;
+ // Use some sensible defaults
+ if (!flags)
+ flags =
+ PAKFIRE_PROGRESS_SHOW_PERCENTAGE |
+ PAKFIRE_PROGRESS_SHOW_ETA |
+ PAKFIRE_PROGRESS_SHOW_BYTES_TRANSFERRED |
+ PAKFIRE_PROGRESS_SHOW_TRANSFER_SPEED;
// Create a new progress indicator
r = pakfire_progress_create(&self->progress, self->ctx, flags, NULL);
}
int pakfire_httpclient_create(struct pakfire_httpclient** client,
- struct pakfire_ctx* ctx) {
+ struct pakfire_ctx* ctx, int progress_flags) {
struct pakfire_httpclient* self = NULL;
int r;
goto ERROR;
// Setup progress
- r = pakfire_httpclient_setup_progress(self);
+ r = pakfire_httpclient_setup_progress(self, progress_flags);
if (r)
goto ERROR;
#include <pakfire/ctx.h>
#include <pakfire/xfer.h>
-int pakfire_httpclient_create(struct pakfire_httpclient** client, struct pakfire_ctx* ctx);
+int pakfire_httpclient_create(struct pakfire_httpclient** client,
+ struct pakfire_ctx* ctx, int progress_flags);
struct pakfire_httpclient* pakfire_httpclient_ref(struct pakfire_httpclient* self);
struct pakfire_httpclient* pakfire_httpclient_unref(struct pakfire_httpclient* self);
int r;
// Initialize the HTTP client
- r = pakfire_httpclient_create(&httpclient, transaction->ctx);
+ r = pakfire_httpclient_create(&httpclient, transaction->ctx, 0);
if (r) {
ERROR(transaction->ctx, "Could not initialize HTTP client: %m\n");
return 1;