Unable to add torrents in WebUI #14372

Closed
opened 2026-02-22 00:59:40 -05:00 by deekerman · 2 comments
Owner

Originally created by @HanabishiRecca on GitHub (Feb 27, 2023).

qBittorrent & operating system versions

qBittorrent: 4.5.1 & current master
Operating system: Arch Linux
Qt: 6.4.2
libtorrent-rasterbar: 2.0.8

What is the problem?

Any attempt to add a file or url via WebUI fails. I tried both 4.5.1 and build from current master branch.
Tried different browsers: Firefox 110 & Chromium 110.

Found similar issue: #11701

Client responds with 400 on /api/v2/torrents/add endpoint.

In logs:

qbittorrent-nox[540]: bool Http::RequestParser::parseFormData(const QByteArray&) multipart/form-data header error
qbittorrent-nox[540]: Http::RequestParser::ParseResult Http::RequestParser::doParse(const QByteArray&) message body parsing error

Which points here:
github.com/qbittorrent/qBittorrent@b922e1ae73/src/base/http/requestparser.cpp (L364)

As you can see from the code, the client seeks for filename or name headers in the form data.

Here is the request content when trying to upload a file:

-----------------------------28335466894289090541369023699
Content-Disposition: form-data; name="fileselect[]"; filename="archlinux-2023.02.01-x86_64.iso.torrent"
Content-Type: application/x-bittorrent

<here was the file content>
-----------------------------28335466894289090541369023699
Content-Disposition: form-data; name="autoTMM"

true
-----------------------------28335466894289090541369023699
Content-Disposition: form-data; name="rename"


-----------------------------28335466894289090541369023699
Content-Disposition: form-data; name="category"


-----------------------------28335466894289090541369023699
Content-Disposition: form-data; name="paused"

false
-----------------------------28335466894289090541369023699
Content-Disposition: form-data; name="stopCondition"

None
-----------------------------28335466894289090541369023699
Content-Disposition: form-data; name="contentLayout"

Original
-----------------------------28335466894289090541369023699
Content-Disposition: form-data; name="dlLimit"

NaN
-----------------------------28335466894289090541369023699
Content-Disposition: form-data; name="upLimit"

NaN
-----------------------------28335466894289090541369023699--

And indeed strange fact, no filename or name headers here obviously.

Same goes for magnet:

-----------------------------13125256855780391323623973605
Content-Disposition: form-data; name="urls"

magnet:?xt=urn:btih:375ae3280cd80a8e9d7212e11dfaf7c45069dd35&dn=archlinux-2023.02.01-x86_64.iso
-----------------------------13125256855780391323623973605
Content-Disposition: form-data; name="autoTMM"

true
-----------------------------13125256855780391323623973605
Content-Disposition: form-data; name="cookie"


-----------------------------13125256855780391323623973605
Content-Disposition: form-data; name="rename"


-----------------------------13125256855780391323623973605
Content-Disposition: form-data; name="category"


-----------------------------13125256855780391323623973605
Content-Disposition: form-data; name="paused"

false
-----------------------------13125256855780391323623973605
Content-Disposition: form-data; name="stopCondition"

None
-----------------------------13125256855780391323623973605
Content-Disposition: form-data; name="contentLayout"

Original
-----------------------------13125256855780391323623973605
Content-Disposition: form-data; name="dlLimit"

NaN
-----------------------------13125256855780391323623973605
Content-Disposition: form-data; name="upLimit"

NaN
-----------------------------13125256855780391323623973605--

No filename or name either.

So the question is: what is actually happening? Seems like it messed up somewhere.

Steps to reproduce

No response

Additional context

No response

Log(s) & preferences file(s)

No response

Originally created by @HanabishiRecca on GitHub (Feb 27, 2023). ### qBittorrent & operating system versions qBittorrent: 4.5.1 & current master Operating system: Arch Linux Qt: 6.4.2 libtorrent-rasterbar: 2.0.8 ### What is the problem? Any attempt to add a file or url via WebUI fails. I tried both 4.5.1 and build from current master branch. Tried different browsers: Firefox 110 & Chromium 110. Found similar issue: #11701 Client responds with `400` on `/api/v2/torrents/add` endpoint. In logs: ``` qbittorrent-nox[540]: bool Http::RequestParser::parseFormData(const QByteArray&) multipart/form-data header error qbittorrent-nox[540]: Http::RequestParser::ParseResult Http::RequestParser::doParse(const QByteArray&) message body parsing error ``` Which points here: https://github.com/qbittorrent/qBittorrent/blob/b922e1ae73a9e618de5967317a7e82f86ef42993/src/base/http/requestparser.cpp#L364 As you can see from the code, the client seeks for `filename` or `name` headers in the form data. Here is the request content when trying to upload a file: ``` -----------------------------28335466894289090541369023699 Content-Disposition: form-data; name="fileselect[]"; filename="archlinux-2023.02.01-x86_64.iso.torrent" Content-Type: application/x-bittorrent <here was the file content> -----------------------------28335466894289090541369023699 Content-Disposition: form-data; name="autoTMM" true -----------------------------28335466894289090541369023699 Content-Disposition: form-data; name="rename" -----------------------------28335466894289090541369023699 Content-Disposition: form-data; name="category" -----------------------------28335466894289090541369023699 Content-Disposition: form-data; name="paused" false -----------------------------28335466894289090541369023699 Content-Disposition: form-data; name="stopCondition" None -----------------------------28335466894289090541369023699 Content-Disposition: form-data; name="contentLayout" Original -----------------------------28335466894289090541369023699 Content-Disposition: form-data; name="dlLimit" NaN -----------------------------28335466894289090541369023699 Content-Disposition: form-data; name="upLimit" NaN -----------------------------28335466894289090541369023699-- ``` And indeed strange fact, no `filename` or `name` headers here obviously. Same goes for magnet: ``` -----------------------------13125256855780391323623973605 Content-Disposition: form-data; name="urls" magnet:?xt=urn:btih:375ae3280cd80a8e9d7212e11dfaf7c45069dd35&dn=archlinux-2023.02.01-x86_64.iso -----------------------------13125256855780391323623973605 Content-Disposition: form-data; name="autoTMM" true -----------------------------13125256855780391323623973605 Content-Disposition: form-data; name="cookie" -----------------------------13125256855780391323623973605 Content-Disposition: form-data; name="rename" -----------------------------13125256855780391323623973605 Content-Disposition: form-data; name="category" -----------------------------13125256855780391323623973605 Content-Disposition: form-data; name="paused" false -----------------------------13125256855780391323623973605 Content-Disposition: form-data; name="stopCondition" None -----------------------------13125256855780391323623973605 Content-Disposition: form-data; name="contentLayout" Original -----------------------------13125256855780391323623973605 Content-Disposition: form-data; name="dlLimit" NaN -----------------------------13125256855780391323623973605 Content-Disposition: form-data; name="upLimit" NaN -----------------------------13125256855780391323623973605-- ``` No `filename` or `name` either. So the question is: what is actually happening? Seems like it messed up somewhere. ### Steps to reproduce _No response_ ### Additional context _No response_ ### Log(s) & preferences file(s) _No response_
Author
Owner

@HanabishiRecca commented on GitHub (Feb 27, 2023):

Diving into upload.html, no filename or name in recent history.
I wonder, how it even managed to work earlier?

@HanabishiRecca commented on GitHub (Feb 27, 2023): Diving into [`upload.html`](https://github.com/qbittorrent/qBittorrent/blob/b922e1ae73a9e618de5967317a7e82f86ef42993/src/webui/www/private/upload.html), no `filename` or `name` in recent history. I wonder, how it even managed to work earlier?
Author
Owner

@HanabishiRecca commented on GitHub (Mar 13, 2023):

Turns out this is some weird Qt bug. Details in https://github.com/qbittorrent/qBittorrent/issues/18654#issuecomment-1466324368

@HanabishiRecca commented on GitHub (Mar 13, 2023): Turns out this is some weird Qt bug. Details in https://github.com/qbittorrent/qBittorrent/issues/18654#issuecomment-1466324368
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/qBittorrent#14372
No description provided.