Forum rules
Under no circumstances is spamming or advertising of any kind allowed. Do not post any abusive, obscene, vulgar, slanderous, hateful, threatening, sexually-orientated or any other material that may violate others security. Profanity or any kind of insolent behavior to other members (regardless of rank) will not be tolerated. Remember, what you don’t find offensive can be offensive to other members. Please treat each other with the kind of reverence you’d expect from other members.
Failure to comply with any of the above will result in users being banned without notice. If any further details are needed, contact: “The team” using the link at the bottom of the forum page. Thank you.
User avatar
oss
Site Admin
Posts: 4210
Joined: Sat Feb 25, 2006 11:26 pm
Contact: Website

XML-RPC responses supports compression

Mon Aug 12, 2013 3:09 pm

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.

User avatar
rednoah
Posts: 84
Joined: Tue Mar 11, 2008 10:02 pm

Re: XML-RPC responses supports compression

Sat Sep 21, 2013 10:41 am

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 3628 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:

User avatar
oss
Site Admin
Posts: 4210
Joined: Sat Feb 25, 2006 11:26 pm
Contact: Website

Re: XML-RPC responses supports compression

Sun Sep 22, 2013 5:09 am

thanks for testing it, I am going to update docs and link here :)

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

User avatar
oss
Site Admin
Posts: 4210
Joined: Sat Feb 25, 2006 11:26 pm
Contact: Website

Re: XML-RPC responses supports compression

Sat Jul 25, 2015 10:54 am

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/

Return to “Developing”

Who is online

Users browsing this forum: No registered users and 2 guests