Page 1 of 1

XML-RPC responses supports compression

Posted: Mon Aug 12, 2013 3:09 pm
by oss
Hi guys,

in topic viewtopic.php?f=8&t=14233 developer was asking how to limit SearchSubtitle() response, so I added limit parameter there. But I found out, there is actually possible to compress all XML-RPC responses, so let's see if it is working and how clients will handle that, more on that you can find here http://xml-rpc.net/faq/xmlrpcnetfaq-2-5-0.html#2.31

So, basically your client must send in HTTP headers "Accept-Encoding: gzip"

Then response will be properly compressed and of course client must decompress it.

Let me know, if it works for you.

Re: XML-RPC responses supports compression

Posted: Sat Sep 21, 2013 10:41 am
by rednoah
Just did some tests with setting Accept-Encoding: gzip and really think the API docs should mention support for gzip compression in HUGE FAT LETTERS !!!

Here's my little test:
2013-09-21 16_20_47-Fiddler Web Debugger.png
2013-09-21 16_20_47-Fiddler Web Debugger.png (12.13 KiB) Viewed 7146 times
The first 3 requests show login/searchIMDb/searchSubtitles for Firefly with gzip compression. The second 3 requests do the same thing without compression.

With gzip compression: 39.522 bytes
No compression: 1.577.481 bytes

In this case two lines of code can reduce 97.5% of bandwith, and probably save OpenSubtitles 97.5% of bandwidth costs. So you should really advertise compression alot more! :mrgreen:

Re: XML-RPC responses supports compression

Posted: Sun Sep 22, 2013 5:09 am
by oss
thanks for testing it, I am going to update docs and link here :)

http://trac.opensubtitles.org/projects/ ... iki/XMLRPC

Re: XML-RPC responses supports compression

Posted: Sat Jul 25, 2015 10:54 am
by oss
To update this:

- added response header X-Uncompressed-Content-Length to see the difference, example:

Code: Select all

HEADER: content-encoding: gzip HEADER: content-length: 1402 HEADER: x-uncompressed-content-length: 16194
- support for gzip compression in XMLRPC REQUEST - it is really useful when uploading subtitles or sending a lot of text data, preferred is to use it as default
- added "deflate" for response - if somebody need it (XMLRPC REQUEST doesn't support deflate compression)
- added "content-length" header, because some clients without it doesn't work properly

- you can "play" around on http://www.opensubtitles.org/addons/xml-rpc/debugger/