ELinks 0.18.0
download.c File Reference

Downloads managment. More...

#include <errno.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <utime.h>
#include "elinks.h"
#include "bfu/dialog.h"
#include "cache/cache.h"
#include "config/options.h"
#include "dialogs/document.h"
#include "dialogs/download.h"
#include "dialogs/menu.h"
#include "intl/libintl.h"
#include "main/object.h"
#include "main/select.h"
#include "mime/mime.h"
#include "network/connection.h"
#include "network/progress.h"
#include "network/state.h"
#include "osdep/osdep.h"
#include "protocol/bittorrent/dialogs.h"
#include "protocol/date.h"
#include "protocol/protocol.h"
#include "protocol/uri.h"
#include "session/download.h"
#include "session/history.h"
#include "session/location.h"
#include "session/session.h"
#include "session/task.h"
#include "terminal/draw.h"
#include "terminal/screen.h"
#include "terminal/terminal.h"
#include "util/conv.h"
#include "util/error.h"
#include "util/file.h"
#include "util/hash.h"
#include "util/lists.h"
#include "util/memlist.h"
#include "util/memory.h"
#include "util/string.h"
#include "util/time.h"
Include dependency graph for download.c:

Data Structures

struct  exec_mailcap
 
struct  lun_hop
 The user is being asked what to do when the local file for the download already exists. More...
 
struct  cmdw_hop
 Data saved by common_download() for the common_download_do() callback. More...
 
struct  codw_hop
 Data saved by continue_download() for the continue_download_do() callback. More...
 
struct  cdf_hop
 Data saved by create_download_file() for the create_download_file_do() callback. More...
 

Macros

#define TYPE_QUERY_WIDGETS_COUNT   8
 

Functions

void clear_uri_tempfiles (void)
 
static char * check_url_tempfiles (const char *url)
 
static void set_uri_tempfile (const char *url, const char *value)
 
int download_is_progressing (struct download *download)
 
int are_there_downloads (void)
 
static void download_data (struct download *download, struct file_download *file_download)
 
struct file_downloadinit_file_download (struct uri *uri, struct session *ses, char *file, int fd)
 
void abort_download (struct file_download *file_download)
 
static void kill_downloads_to_file (char *file)
 
void abort_all_downloads (void)
 
void destroy_downloads (struct session *ses)
 
void detach_downloads_from_terminal (struct terminal *term)
 
static void download_error_dialog (struct file_download *file_download, int saved_errno)
 
static int write_cache_entry_to_file (struct cache_entry *cached, struct file_download *file_download)
 
static void abort_download_and_beep (struct file_download *file_download, struct terminal *term)
 
static void do_follow_url_mailcap (struct session *ses, struct uri *uri)
 
static void exec_mailcap_command (void *data)
 
static void exec_later (struct session *ses, char *handler, char *file)
 
static void exec_dgi_command (void *data)
 
static void exec_later_dgi (struct session *ses, char *handler, char *file, char *inpext, char *outext, int del)
 
static void download_data_store (struct download *download, struct file_download *file_download)
 
static char * get_temp_name (struct uri *uri)
 
static char * subst_file (char *prog, char *file, char *uri)
 

Variables

struct file_download list downloads = { D_LIST_HEAD_EL(downloads) }
 Stack of all running downloads.
 
static struct hashuri_tempfiles
 
struct { 
 
   const char *   type 
 
   unsigned int   plain:1 
 
known_types [] 
 
static const char * compressed_types []
 

Detailed Description

Downloads managment.

Macro Definition Documentation

◆ TYPE_QUERY_WIDGETS_COUNT

#define TYPE_QUERY_WIDGETS_COUNT   8

Function Documentation

◆ abort_all_downloads()

void abort_all_downloads ( void )

◆ abort_download()

void abort_download ( struct file_download * file_download)

◆ abort_download_and_beep()

static void abort_download_and_beep ( struct file_download * file_download,
struct terminal * term )
static

◆ are_there_downloads()

int are_there_downloads ( void )

◆ check_url_tempfiles()

static char * check_url_tempfiles ( const char * url)
static

◆ clear_uri_tempfiles()

void clear_uri_tempfiles ( void )

◆ destroy_downloads()

void destroy_downloads ( struct session * ses)

◆ detach_downloads_from_terminal()

void detach_downloads_from_terminal ( struct terminal * term)

◆ do_follow_url_mailcap()

static void do_follow_url_mailcap ( struct session * ses,
struct uri * uri )
static

◆ download_data()

static void download_data ( struct download * download,
struct file_download * file_download )
static

◆ download_data_store()

static void download_data_store ( struct download * download,
struct file_download * file_download )
static

◆ download_error_dialog()

static void download_error_dialog ( struct file_download * file_download,
int saved_errno )
static

◆ download_is_progressing()

int download_is_progressing ( struct download * download)

◆ exec_dgi_command()

static void exec_dgi_command ( void * data)
static

◆ exec_later()

static void exec_later ( struct session * ses,
char * handler,
char * file )
static

◆ exec_later_dgi()

static void exec_later_dgi ( struct session * ses,
char * handler,
char * file,
char * inpext,
char * outext,
int del )
static

◆ exec_mailcap_command()

static void exec_mailcap_command ( void * data)
static

◆ get_temp_name()

static char * get_temp_name ( struct uri * uri)
static

◆ init_file_download()

struct file_download * init_file_download ( struct uri * uri,
struct session * ses,
char * file,
int fd )
Note
If this fails, the caller is responsible of freeing file and closing fd.

◆ kill_downloads_to_file()

static void kill_downloads_to_file ( char * file)
static

◆ set_uri_tempfile()

static void set_uri_tempfile ( const char * url,
const char * value )
static

◆ subst_file()

static char * subst_file ( char * prog,
char * file,
char * uri )
static

◆ write_cache_entry_to_file()

static int write_cache_entry_to_file ( struct cache_entry * cached,
struct file_download * file_download )
static

Variable Documentation

◆ compressed_types

const char* compressed_types[]
static
Initial value:
= {
}
#define NULL
Definition explodename.c:35

◆ downloads

struct file_download list downloads = { D_LIST_HEAD_EL(downloads) }

Stack of all running downloads.

◆ [struct]

struct { ... } known_types[]
Initial value:
= {
{ "text/html", 0 },
{ "text/plain", 1 },
{ "text/gemini", 0 },
{ "application/xhtml+xml", 0 },
{ NULL, 1 },
}

◆ plain

unsigned int plain

◆ type

const char* type

◆ uri_tempfiles

struct hash* uri_tempfiles
static