SABnzbd compatibility: POST mode=addurl fails without multipart body
Prowlarr sends SABnzbd mode=addurl requests as a POST request with all parameters in the query string and no multipart/form-data body.
rustnzb currently rejects this request with:
HTTP/1.1 400 Bad Request
Invalid `boundary` for `multipart/form-data` request
This prevents rustnzb from being used as a SABnzbd download client in Prowlarr for grabbing releases.
PR #70 added addurl support over GET and extracted the shared handle_addurl() logic, but the POST route still appears to require a valid multipart body before handle_addurl() can be reached.
Environment
- Prowlarr:
2.5.2.5491
- rustnzb:
latest
- SABnzbd compatibility endpoint:
/sabnzbd/api
Minimal reproduction
This request reproduces the problem:
curl -i -X POST \
"http://localhost:9090/sabnzbd/api?mode=addurl&name=https%3A%2F%2Fexample.com%2Ftest.nzb&cat=prowlarr&priority=-100&apikey=REDACTED&output=json"
Result:
HTTP/1.1 400 Bad Request
content-type: text/plain; charset=utf-8
Invalid `boundary` for `multipart/form-data` request
However, adding an otherwise unnecessary multipart field:
curl -i -X POST \
-F "dummy=1" \
"http://localhost:9090/sabnzbd/api?mode=addurl&name=https%3A%2F%2Fexample.com%2Ftest.nzb&cat=prowlarr&priority=-100&apikey=REDACTED&output=json"
causes the multipart boundary error to disappear and rustnzb proceeds to the URL-fetching / addurl logic.
For example, with an intentionally invalid URL this results in an application-level error instead of the multipart parsing error:
{
"error_kind": "internal_error",
"human_readable": "Failed to fetch URL: builder error",
"status": 500
}
This strongly suggests that the POST handler requires the Axum Multipart extractor even for mode=addurl, despite addurl not requiring a file upload or multipart body.
Expected behavior
POST mode=addurl should work without requiring a multipart/form-data body.
Prowlarr sends the SABnzbd request in this form:
POST /sabnzbd/api?mode=addurl&name=<NZB_URL>&cat=prowlarr&priority=-100&apikey=<API_KEY>&output=json
The request parameters are already provided in the query string, so no multipart body should be required for mode=addurl.
Multipart parsing should only be required for operations that actually upload a file, such as mode=addfile.
Ideally, the existing handle_addurl() logic introduced around PR #70 could be reused for both:
GET mode=addurl
POST mode=addurl
without requiring multipart data for the POST case.
SABnzbd compatibility:
POST mode=addurlfails without multipart bodyProwlarr sends SABnzbd
mode=addurlrequests as aPOSTrequest with all parameters in the query string and nomultipart/form-databody.rustnzb currently rejects this request with:
This prevents rustnzb from being used as a SABnzbd download client in Prowlarr for grabbing releases.
PR #70 added
addurlsupport overGETand extracted the sharedhandle_addurl()logic, but thePOSTroute still appears to require a valid multipart body beforehandle_addurl()can be reached.Environment
2.5.2.5491latest/sabnzbd/apiMinimal reproduction
This request reproduces the problem:
curl -i -X POST \ "http://localhost:9090/sabnzbd/api?mode=addurl&name=https%3A%2F%2Fexample.com%2Ftest.nzb&cat=prowlarr&priority=-100&apikey=REDACTED&output=json"Result:
However, adding an otherwise unnecessary multipart field:
causes the multipart boundary error to disappear and rustnzb proceeds to the URL-fetching /
addurllogic.For example, with an intentionally invalid URL this results in an application-level error instead of the multipart parsing error:
{ "error_kind": "internal_error", "human_readable": "Failed to fetch URL: builder error", "status": 500 }This strongly suggests that the POST handler requires the Axum
Multipartextractor even formode=addurl, despiteaddurlnot requiring a file upload or multipart body.Expected behavior
POST mode=addurlshould work without requiring amultipart/form-databody.Prowlarr sends the SABnzbd request in this form:
The request parameters are already provided in the query string, so no multipart body should be required for
mode=addurl.Multipart parsing should only be required for operations that actually upload a file, such as
mode=addfile.Ideally, the existing
handle_addurl()logic introduced around PR #70 could be reused for both:without requiring multipart data for the POST case.