Open moshengrenzenme opened 2 years ago
Transfer-Encoding: chunked
I doubt it is supported by qBittorrent. @Chocobo1?
Transfer-Encoding: chunked
I doubt it is supported by qBittorrent. @Chocobo1?
I don't remember qbt has code for handling it, so probably not.
bool Http::RequestParser::parseRequestLine(const QString&) invalid http header: "ce"
@moshengrenzenme You should debug why there is this (invalid) header.
Transfer-Encoding: chunked
I doubt it is supported by qBittorrent. @Chocobo1?
I don't remember qbt has code for handling it, so probably not.
bool Http::RequestParser::parseRequestLine(const QString&) invalid http header: "ce"
@moshengrenzenme You should debug why there is this (invalid) header.
I have tried node fetch, request and Axios, and found that only request can be used. Sometimes it is combined with form data, and I have seen it, but I have not found any problems. I also used form data combined with Axios to upload it to OSS without errors. I don't know which side has the problem
faced the same problem adding torrents with native fetch api from node v18 transfer-encoding header is automatically added by fetch and not supported by qbittorrent the trick is to add content-length header to remove transfer-encoding (both cant exist on the same request) you can get the content-length of a formdata with the help of this : https://stackoverflow.com/a/63495529/13391206
that stackoverflow link seems to only work for Expressjs. what about a nodejs script with axios or fetch?
Lets rename the ticket to specifically delineate the issue. Any suggestions ?
qBittorrent & operating system versions
qbittorent:4.4.1 system:ubuntu 2204 qt:5.15 libtorrent--rasterbar:2.0.5-5
What is the problem?
Adding torrent using Axios of nodejs failed,But in the same way, I can request my own server, There are some things that shouldn't appear in the content received by qbittorrent , I started debugging myself, modified the source code, and added some output near the error line
Steps to reproduce
code: `var axios = require('axios'); var FormData = require('form-data'); var fs = require('fs'); var data = new FormData(); data.append('torrents', fs.createReadStream(torrentFile')); data.append('savepath', 'downloadPath');
var config = { method: 'post', url: 'http://127.0.0.1:8381/api/v2/torrents/add', headers: { 'Cookie': 'SID=HIDE', ...data.getHeaders() }, data: data };
axios(config) .then(function(response) { console.log(JSON.stringify(response.data)); }) .catch(function(error) { console.log(error); });`
Additional context
` POST /api/v2/torrents/add HTTP/1.1 Accept: application/json, text/plain, / Content-Type: multipart/form-data; boundary=--------------------------229198846304224613476037 Cookie: SID=HIDE User-Agent: axios/0.23.0 Host: 127.0.0.1:8381 Connection: close Transfer-Encoding: chunked
ce ----------------------------229198846304224613476037 Content-Disposition: form-data; name="torrents"; filename="torrentFile" Content-Type: application/x-bittorrent
1dc torrentFile binrary(HIDE)
`
Log(s) & preferences file(s)
bool Http::RequestParser::parseRequestLine(const QString&) invalid http header: "ce" Http::RequestParser::ParseResult Http::RequestParser::doParse(const QByteArray&) header parsing error