Skip to content

Feature RFC:支持带请求体的 HTTP POST 下载任务 #1820

Description

@Dramwig

建议为 Motrix 增加对 HTTP POST 下载任务的支持,使用户可以配置请求方法、请求头和 POST 请求体,并将其作为一个可恢复、可重试的下载任务管理。

该功能主要用于以下类型的下载:

  • 云盘或企业网盘根据所选文件动态生成 ZIP;
  • 需要提交 JSON、表单或查询条件后返回文件流的接口;
  • 浏览器可以下载,但普通下载器无法仅凭 URL 重放的下载请求;
  • 需要从浏览器开发者工具导入 cURL 请求的场景。

Is your feature request related to a problem? Please describe.

Yes. Some websites generate downloadable files through HTTP POST requests instead of ordinary GET URLs.

For example, SharePoint/OneDrive may send a POST /transform/zip request when the user selects multiple folders and clicks “Download”. The request contains:

  • A POST method
  • Custom request headers
  • An application/x-www-form-urlencoded request body
  • Temporary file identifiers or authorization parameters

Motrix currently allows configuring headers such as User-Agent, Referer, and Cookie, but it does not provide a way to specify the HTTP method or POST body. Pasting only the URL into Motrix therefore sends a GET request and fails with errors such as 405 Method Not Allowed.

Describe the solution you'd like

Please add support for HTTP POST download tasks.

The proposed feature should allow users to configure:

  • HTTP method: GET or POST
  • Request URL
  • Request headers
  • Request body
  • Body type:
    • application/x-www-form-urlencoded
    • application/json
    • Plain text
    • File input

It would also be useful to support importing a cURL command copied from browser developer tools.

For POST tasks, Motrix should:

  • Preserve the request body when retrying
  • Allow configuring retry behavior
  • Avoid sending an initial HEAD request
  • Use one connection by default
  • Enable resume only when the server explicitly supports it
  • Display clear errors for expired credentials or unsupported methods
  • Avoid logging Cookie, Authorization, or access tokens

A possible UI could contain:

HTTP method: [GET / POST]
URL:
Body type: [None / Form / JSON / Text / File]
Request body:
Request headers:
Retry count:
Resume mode: [Auto / Enabled / Disabled]

Describe alternatives you've considered

I currently use the following alternatives:

  1. Download through Edge directly. This works, but browser downloads may fail due to unstable network conditions.
  2. Copy the browser request as cURL and execute it manually. This works in some cases, but it is inconvenient and temporary authorization tokens expire.
  3. Use a Python script to replay the POST request. This requires custom scripting and does not provide Motrix's task management, queue, or UI.
  4. Use a regular Motrix task with custom headers. This does not work because the POST body cannot be configured and the request is sent as GET.

A browser-integrated POST download feature would provide a much better workflow.

Additional context

Minimal redacted example:

curl 'https://example.invalid/transform/zip' \
  -H 'Content-Type: application/x-www-form-urlencoded' \
  -H 'Origin: https://example.invalid' \
  -H 'User-Agent: Mozilla/5.0' \
  --data-raw 'zipFileName=archive.zip&guid=REDACTED&provider=spo&files=%7B%22items%22%3A%5B%5D%7D'

The actual request may contain temporary access tokens or cookies. These should never be included in a public issue.

This feature may require changes beyond the current UI because Motrix uses aria2 as its download engine. A possible implementation could either extend the underlying engine or introduce a separate HTTP backend for POST tasks while keeping existing aria2-based tasks unchanged.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions