API returns HTTP 406 but still continues?
Posted: April 22nd, 2010, 4:32 pm
I'm getting some pretty weird behavior from the API, and I obviously want to talk properly to SABnzbd from my application. I'm sending this data to the api:
The API returns a HTML file with error code 406, and I found this in the body:
I honestly don't know why this is, and I was expecting a 200 OK response. The following header does this, but I don't see much difference:
Can someone explain why I get this 406 header, and how to prevent this? Note: SABnzbd still starts the download, like nothing was wrong, but I just want to do it the right way. I got nothing from SABnzbd logs, this just says pretty much the same, that it returned the 406 header.
Also note that the reason these two headers from my application are different is that the first is coded using QT (c++) and the other C#.NET. So different platforms, and I can't get QT to behave exactly like C#.NET.
Code: Select all
POST /sabnzbd/api?mode=addfile&name=MovieX&cat=anime&apikey=APIKEY HTTP/1.1
Content-Type: multipart/form-data; boundary=8ccafbe245b1ffd
Accept-Encoding: *
Cookie: session_id=18ac5d3efc8874e10940ef97c991a6fc0f879e54
Content-Length: 1856744
Connection: Keep-Alive
Accept-Language: en-US,*
User-Agent: Mozilla/5.0
Host: tiffany:7777
--8ccafbe245b1ffd
Content-Disposition: form-data; name="name"; filename="MovieX"
Content-Type: text/plain
<?xml version="1.0" encoding="iso-8859-1" ?>
// Content stripped from NZB
</nzb>
--8ccafbe245b1ffd--
Code: Select all
<h2>406 Not Acceptable</h2>
<p>identity, gzip</p>
Code: Select all
POST /sabnzbd/api?mode=addfile&name=MovieX&cat=anime&apikey=APIKEY
HTTP/1.1
Content-Type: multipart/form-data; boundary=8ccb08376f63782
Host: tiffany:7777
Content-Length: 390848
Expect: 100-continue
HTTP/1.1 100
Content-Length: 0
Content-Type: text/plain
--8ccb08376f63782
Content-Disposition: form-data; name="name"; filename="MovieX"
Content-Type: text/plain
<?xml version="1.0" encoding="utf-8" ?>
...
</nzb>
--8ccb08376f63782--
Also note that the reason these two headers from my application are different is that the first is coded using QT (c++) and the other C#.NET. So different platforms, and I can't get QT to behave exactly like C#.NET.