libalpm
Arch Linux Package Manager Library
|
#include <stdbool.h>
#include <stdlib.h>
#include <stdio.h>
#include <errno.h>
#include <string.h>
#include <unistd.h>
#include <sys/socket.h>
#include <sys/time.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <sys/wait.h>
#include <signal.h>
#include <dirent.h>
#include <pwd.h>
#include <curl/curl.h>
#include "dload.h"
#include "alpm_list.h"
#include "alpm.h"
#include "log.h"
#include "util.h"
#include "handle.h"
#include "sandbox.h"
Data Structures | |
struct | server_error_count |
Macros | |
#define | HOSTNAME_SIZE 256 |
Enumerations | |
enum | { ABORT_OVER_MAXFILESIZE = 1 } |
Functions | |
static const char * | get_filename (const char *url) |
static mode_t | _getumask (void) |
static int | finalize_download_file (const char *filename) |
static FILE * | create_tempfile (struct dload_payload *payload, const char *localpath) |
static int | curl_add_payload (alpm_handle_t *handle, CURLM *curlm, struct dload_payload *payload) |
static int | curl_gethost (const char *url, char *buffer, size_t buf_len) |
static struct server_error_count * | find_server_errors (alpm_handle_t *handle, const char *server) |
static int | should_skip_server (alpm_handle_t *handle, const char *server) |
static int | should_skip_cache_server (alpm_handle_t *handle, const char *server) |
static void | server_soft_error (alpm_handle_t *handle, const char *server) |
static void | server_hard_error (alpm_handle_t *handle, const char *server) |
static const char * | payload_next_server (struct dload_payload *payload) |
static int | dload_progress_cb (void *file, curl_off_t dltotal, curl_off_t dlnow, curl_off_t UNUSED ultotal, curl_off_t UNUSED ulnow) |
static int | utimes_long (const char *path, long seconds) |
static size_t | dload_parseheader_cb (void *ptr, size_t size, size_t nmemb, void *user) |
static void | curl_set_handle_opts (CURL *curl, struct dload_payload *payload) |
static int | curl_retry_next_server (CURLM *curlm, CURL *curl, struct dload_payload *payload) |
static int | curl_check_finished_download (alpm_handle_t *handle, CURLM *curlm, CURLMsg *msg, int *active_downloads_num) |
static int | compare_dload_payload_sizes (const void *left_ptr, const void *right_ptr) |
static int | curl_download_internal (alpm_handle_t *handle, alpm_list_t *payloads) |
static int | curl_download_internal_sandboxed (alpm_handle_t *handle, alpm_list_t *payloads, const char *localpath) |
static int | payload_download_fetchcb (struct dload_payload *payload, const char *server, const char *localpath) |
static int | move_file (const char *filepath, const char *directory) |
static int | finalize_download_locations (alpm_list_t *payloads, const char *localpath) |
static void | prepare_resumable_downloads (alpm_list_t *payloads, const char *localpath, const char *user) |
static char * | filecache_find_url (alpm_handle_t *handle, const char *url) |
int | alpm_fetch_pkgurl (alpm_handle_t *handle, const alpm_list_t *urls, alpm_list_t **fetched) |
Fetch a list of remote packages. | |
Variables | |
const int | server_error_limit = 3 |
static int | dload_interrupted |
struct server_error_count |
Data Fields | ||
---|---|---|
int | errors | |
char | server[HOSTNAME_SIZE] |
#define HOSTNAME_SIZE 256 |
Referenced by curl_add_payload(), curl_check_finished_download(), and find_server_errors().
|
static |
Referenced by create_tempfile(), and finalize_download_file().
|
static |
References dload_payload::max_size.
Referenced by curl_download_internal().
|
static |
References _, _getumask(), ALPM_ERR_MEMORY, ALPM_LOG_ERROR, dload_payload::handle, MALLOC, dload_payload::remote_name, RET_ERR, STRDUP, dload_payload::tempfile_name, and dload_payload::tempfile_openmode.
Referenced by alpm_fetch_pkgurl().
|
static |
References _, ALPM_DOWNLOAD_INIT, ALPM_ERR_MEMORY, ALPM_ERR_RETRIEVE, ALPM_ERR_SERVER_BAD_URL, ALPM_ERR_SERVER_NONE, ALPM_ERR_WRONG_ARGS, ALPM_LOG_DEBUG, ALPM_LOG_ERROR, ASSERT, dload_payload::curl, curl_gethost(), curl_set_handle_opts(), dload_payload::errors_ok, dload_payload::filepath, dload_payload::fileurl, GOTO_ERR, dload_payload::handle, HOSTNAME_SIZE, dload_payload::initial_size, dload_payload::localf, MALLOC, dload_payload::max_size, alpm_download_event_init_t::optional, payload_next_server(), dload_payload::remote_name, dload_payload::request_errors_ok, dload_payload::servers, dload_payload::tempfile_name, and dload_payload::tempfile_openmode.
Referenced by curl_check_finished_download(), and curl_download_internal().
|
static |
References _, ABORT_OVER_MAXFILESIZE, ALPM_DOWNLOAD_COMPLETED, ALPM_ERR_LIBCURL, ALPM_ERR_MEMORY, ALPM_ERR_RETRIEVE, ALPM_ERR_SERVER_BAD_URL, ALPM_ERR_SYSTEM, ALPM_LOG_DEBUG, ALPM_LOG_ERROR, alpm_option_get_dbext(), ASSERT, CALLOC, dload_payload::curl, curl_add_payload(), curl_gethost(), curl_retry_next_server(), dload_payload::destfile_name, dload_interrupted, dload_payload::download_signature, dload_payload::error_buffer, dload_payload::errors_ok, dload_payload::fileurl, dload_payload::force, FREE, get_filename(), GOTO_ERR, dload_payload::handle, HOSTNAME_SIZE, dload_payload::initial_size, dload_payload::localf, MALLOC, dload_payload::max_size, dload_payload::remote_name, dload_payload::request_errors_ok, dload_payload::respcode, alpm_download_event_completed_t::result, RET_ERR, server_hard_error(), server_soft_error(), dload_payload::signature, dload_payload::signature_optional, STRDUP, dload_payload::tempfile_name, alpm_download_event_completed_t::total, dload_payload::unlink_on_fail, and utimes_long().
Referenced by curl_download_internal().
|
static |
|
static |
References _, ALPM_ERR_NOT_A_DIR, ALPM_ERR_RETRIEVE, ALPM_LOG_ERROR, alpm_option_set_dlcb(), alpm_option_set_eventcb(), alpm_option_set_fetchcb(), alpm_option_set_logcb(), alpm_option_set_progresscb(), alpm_option_set_questioncb(), ALPM_SANDBOX_CB_DOWNLOAD, ALPM_SANDBOX_CB_LOG, alpm_sandbox_setup_child(), and curl_download_internal().
|
static |
References _.
Referenced by curl_add_payload(), curl_check_finished_download(), and find_server_errors().
|
static |
References dload_payload::allow_resume, ALPM_DOWNLOAD_RETRY, ALPM_ERR_MEMORY, ALPM_ERR_SYSTEM, ALPM_LOG_DEBUG, dload_payload::filepath, dload_payload::fileurl, FREE, dload_payload::handle, dload_payload::initial_size, dload_payload::localf, MALLOC, payload_next_server(), dload_payload::remote_name, alpm_download_event_retry_t::resume, RET_ERR, dload_payload::tempfile_name, and dload_payload::tempfile_openmode.
Referenced by curl_check_finished_download().
|
static |
References dload_payload::allow_resume, ALPM_LOG_DEBUG, dload_parseheader_cb(), dload_progress_cb(), dload_payload::error_buffer, dload_payload::fileurl, dload_payload::force, dload_payload::handle, dload_payload::initial_size, dload_payload::max_size, dload_payload::mtime_existing_file, dload_payload::remote_name, dload_payload::tempfile_name, and dload_payload::tempfile_openmode.
Referenced by curl_add_payload().
|
static |
References dload_payload::curl, and dload_payload::respcode.
Referenced by curl_set_handle_opts().
|
static |
References ABORT_OVER_MAXFILESIZE, ALPM_DOWNLOAD_PROGRESS, dload_interrupted, alpm_download_event_progress_t::downloaded, dload_payload::handle, dload_payload::initial_size, dload_payload::max_size, dload_payload::prevprogress, dload_payload::remote_name, dload_payload::respcode, and alpm_download_event_progress_t::total.
Referenced by curl_set_handle_opts().
|
static |
References dload_payload::handle.
Referenced by alpm_fetch_pkgurl().
|
static |
References _getumask(), and ASSERT.
Referenced by move_file().
|
static |
|
static |
References alpm_list_append(), curl_gethost(), alpm_list_t::data, server_error_count::errors, HOSTNAME_SIZE, alpm_list_t::next, and server_error_count::server.
Referenced by server_hard_error(), server_soft_error(), should_skip_cache_server(), and should_skip_server().
|
static |
Referenced by alpm_fetch_pkgurl(), and curl_check_finished_download().
|
static |
References ASSERT, finalize_download_file(), and FREE.
Referenced by finalize_download_locations().
|
static |
References ALPM_ERR_MEMORY, dload_payload::filepath, dload_payload::force, dload_payload::handle, MALLOC, and RET_ERR.
|
static |
References dload_payload::cache_servers, alpm_list_t::data, dload_payload::errors_ok, dload_payload::handle, alpm_list_t::next, dload_payload::request_errors_ok, server_error_count::server, dload_payload::servers, should_skip_cache_server(), and should_skip_server().
Referenced by curl_add_payload(), and curl_retry_next_server().
|
static |
|
static |
References _, ALPM_LOG_WARNING, server_error_count::errors, find_server_errors(), server_error_count::server, and server_error_limit.
Referenced by curl_check_finished_download().
|
static |
References _, ALPM_LOG_WARNING, server_error_count::errors, find_server_errors(), server_error_count::server, server_error_limit, and should_skip_server().
Referenced by curl_check_finished_download().
|
static |
References server_error_count::errors, find_server_errors(), server_error_count::server, and server_error_limit.
Referenced by payload_next_server().
|
static |
References server_error_count::errors, find_server_errors(), server_error_count::server, and server_error_limit.
Referenced by payload_next_server(), and server_soft_error().
|
static |
Referenced by curl_check_finished_download().
|
static |
Referenced by curl_check_finished_download(), and dload_progress_cb().
const int server_error_limit = 3 |
Referenced by server_hard_error(), server_soft_error(), should_skip_cache_server(), and should_skip_server().