Can unrar Read Archive Headers Over HTTP?

The standard command-line utility unrar cannot natively read archive headers directly over network protocols like HTTP because it lacks built-in networking capabilities and requires a seekable local filesystem path. However, you can achieve this functionality without downloading the entire archive by leveraging HTTP Range requests, virtual filesystems, or specialized mounting tools that simulate local file access over the network.

Native Limitations of unrar

The unrar tool is designed strictly as a local file processor. It does not accept URLs (such as http:// or https://) as input targets.

Additionally, archive formats like RAR store metadata—such as the file table of contents, compression methods, and file attributes—in distinct header blocks. Because unrar relies on seeking backward and forward through a file to locate and parse these blocks, standard command-line piping (such as curl -s http://example.com/file.rar | unrar l -) typically fails or provides limited, unreliable output.

Solution 1: Mounting via FUSE or Rclone

The most robust way to allow unrar to inspect headers over HTTP is by mounting the remote file via a FUSE (Filesystem in Userspace) layer:

  1. Rclone Mount: Rclone can mount HTTP and WebDAV sources to a local directory using the rclone mount command.
  2. On-Demand Range Requests: When you point unrar l /path/to/mounted/file.rar at the mount point, the FUSE driver translates the file seek requests into HTTP Range requests.
  3. Bandwidth Efficiency: Instead of downloading the full file, only the byte ranges containing the headers are fetched, allowing unrar to list the archive contents almost instantly.

Solution 2: Partial Downloads Using Byte Ranges

If the web server supports the Accept-Ranges: bytes header, you can manually retrieve only the initial portion of the archive where the primary headers reside:

  1. Fetch the Initial Block: Use curl to fetch the first few hundred kilobytes:
    curl -r 0-1048576 -o header_chunk.rar https://example.com/archive.rar
  2. List the Contents: Run unrar l header_chunk.rar.

Because RAR places file headers sequentially before the compressed file data, reading the beginning of the file allows unrar to parse the metadata for the initial files in the archive. Note that if the archive contains many files spanning past the downloaded byte range, or if the archive has a solid compression dictionary or trailing metadata, this method may return incomplete information or a truncated archive warning.

Solution 3: Programmatic Parsing

For automated environments, custom scripts using programming languages with HTTP range-request capabilities (such as Python) provide a cleaner solution. By sending targeted HTTP GET requests with Range headers, a script can read the 7-byte RAR signature, step through the block headers, and extract the file list without saving any local archive file.