How axel-download-accelerator/axel works
Purpose and executable entry point
Axel is a lightweight native C command-line download accelerator. It downloads one file through multiple concurrent connections and can distribute work across alternate servers. The main program and shared state definitions are in src/axel.c and src/axel.h; the built executable is declared by src/Makefile.am.
Startup, options, and configuration
Startup parses command-line inputs, loads configuration, selects output behavior, and establishes a download job. Configuration handling and persistent user settings are centered in src/conf.c and src/conf.h. Credential lookup from .netrc is isolated in src/netrc.c and src/netrc.h, separating local authentication sources from protocol clients.
Download orchestration and segmentation
The core controller divides a remote object into byte ranges, assigns ranges to connections, tracks their progress, and handles completion/retry coordination. This orchestration belongs primarily to src/axel.c, with transfer connection state and lifecycle in src/conn.c and src/conn.h. Search and selection of mirrors/alternate sources is represented by src/search.c and src/search.h.
Protocol boundary
Protocol-specific request, response, and remote-file operations are split by scheme:
• HTTP/HTTPS: src/http.c, src/http.h
• FTP/FTPS: src/ftp.c, src/ftp.h
These modules sit above the shared connection abstraction, allowing the scheduler to work with protocol-independent transfer ranges while protocol code handles server dialogue and metadata.
Network and TLS transport
TCP socket establishment and I/O are encapsulated in src/tcp.c and src/tcp.h. Optional SSL/TLS wrapping is implemented in src/ssl.c, src/ssl.h, and certificate verification logic in src/ssl_verify.c. OpenSSL, LibreSSL, or a compatible library is an optional external dependency; configure.ac controls whether TLS support is compiled. Platform compatibility layers include compat-ssl.h, compat-android.h, and compat-bsd.h.
File assembly, integrity, and user-visible progress
Downloaded ranges are written and mapped into the destination through src/stfile.c and src/stfile.h, which forms the local persistence boundary needed for segmented downloads and resume-like state handling. Hash functionality is in src/hash.c and src/hash.h. Terminal/status text and localization-facing output are handled by src/text.c; translations live under po/.
Build and runtime model
This is a Unix-oriented, single executable C project built with GNU Autotools: configure.ac probes platform capabilities and dependencies, while Makefile.am and src/Makefile.am define build targets. Runtime dependencies are standard networking/POSIX facilities, with gettext for localized messages and optional SSL libraries for HTTPS/FTPS. No server, database, browser, or cloud infrastructure is present.
Main entry points: axel.c Axel CLI & scheduler · ssl.c TLS wrapper · conn.c Connection lifecycle · http.c HTTP/HTTPS client
Components 18
Download Core
CLI setup and segmented transfer coordination.
- Axel CLI & scheduler · Parses inputs, creates jobs, and coordinates byte ranges.
src/axel.c - Shared download state
src/axel.h - Configuration · Loads persistent user settings.
src/conf.c - Credential lookup · Reads local .netrc credentials.
src/netrc.c - Connection lifecycle · Maintains transfer connection state.
src/conn.c - Mirror selection · Finds and selects alternate sources.
src/search.c
Protocol Clients
Scheme-specific remote operations.
- HTTP/HTTPS client · Handles HTTP requests, metadata, and range transfers.
src/http.c - FTP/FTPS client · Handles FTP remote-file operations.
src/ftp.c
Network Transport
TCP and optional TLS layers.
- TCP sockets · Encapsulates socket establishment and I/O.
src/tcp.c - TLS wrapper · Optional SSL/TLS transport wrapping.
src/ssl.c - Certificate verification
src/ssl_verify.c - SSL library · OpenSSL, LibreSSL, or compatible TLS implementation.
Local State & Output
Persistence, integrity, and user-facing output.
- Segmented destination file · Writes ranges and maintains resume-like file state.
src/stfile.c - Integrity hashes
src/hash.c - Status & localized text · Produces terminal and localization-facing output.
src/text.c - Translations
Build & Dependencies
Autotools feature selection and executable build.
- Autotools configuration · Probes platform capabilities and optional TLS support.
configure.ac - Axel executable target · Defines the built native executable.
src/Makefile.am
Connections 21
- Axel CLI & scheduler → Shared download state: uses shared state
- Axel CLI & scheduler → Configuration: loads settings
- Configuration → Credential lookup: obtains credentials
- Axel CLI & scheduler → Mirror selection: selects sources
- Axel CLI & scheduler → Connection lifecycle: assigns byte ranges
- Connection lifecycle → HTTP/HTTPS client: HTTP(S) transfers
- Connection lifecycle → FTP/FTPS client: FTP(S) transfers
- HTTP/HTTPS client → TCP sockets: network I/O
- FTP/FTPS client → TCP sockets: network I/O
- HTTP/HTTPS client → TLS wrapper: HTTPS
- FTP/FTPS client → TLS wrapper: FTPS
- TLS wrapper → TCP sockets: wraps
- TLS wrapper → Certificate verification: verifies certificates
- TLS wrapper → SSL library: links when enabled
- Connection lifecycle → Segmented destination file: writes completed ranges
- Axel CLI & scheduler → Integrity hashes: checks integrity
- Axel CLI & scheduler → Status & localized text: reports progress
- Status & localized text → Translations: localizes messages
- Autotools configuration → TLS wrapper: enables optional support
- Autotools configuration → Axel executable target: generates build settings
- Axel executable target → Axel CLI & scheduler: builds