This project is archived and is in readonly mode.
Gzip / Deflate support for ActiveResource
Reported by Bart ten Brinke | February 25th, 2009 @ 01:16 PM | in 3.x
At the moment ActiveResource does not support gzip/deflate. As it does use XML as a transfer medium, this becomes highly inefficient with large datasets.
Gzip is one of the oldest remedies for this, and all major application servers for rails support it, but activeresource doesn't.
To enable: have ZLib installed and add this tou your ActiveResource base class: base.headers['Accept-Encoding'] = 'deflate'
Comments and changes to this ticket
-
Michael Koziarski March 2nd, 2009 @ 05:26 AM
- Assigned user set to Rick
-
Bart ten Brinke March 10th, 2009 @ 07:10 PM
- Tag changed from activeresource, patch to activeresource, patch, verified
Can this be included in 2.3? Would be a nice combination with the XML parsers.
-
Jeremy Kemper March 10th, 2009 @ 08:25 PM
- State changed from new to open
This is cool, but how are you passing Accept-Encoding in the first place?
Too late for 2.3 as we're down to the final release candidate.
-
Bart ten Brinke March 10th, 2009 @ 09:44 PM
Last line of the ticket:
To enable add this to your ActiveResource base class via a Mixin: base.headers['Accept-Encoding'] = 'deflate'
-
Bart ten Brinke March 10th, 2009 @ 09:48 PM
Is zlib packed with Rails 2.3? Because that will allow for some simplification of the patch. Too bad it's to late for 2.3.
-
Bart ten Brinke March 10th, 2009 @ 11:33 PM
Doh :) Repackaged. More tests + added an ActiveResource.enable_delfate option to set the headers for you.
-
Jeremy Kemper May 19th, 2009 @ 08:26 PM
Prefer not adding inflate! to net/http since it inflates AS for a special case. Could you use a utility method on the connection instead?
-
Bart ten Brinke May 19th, 2009 @ 09:13 PM
Gzip is something that really belongs in net/http as it is something you do to a packet.
-
Bart ten Brinke May 19th, 2009 @ 09:15 PM
Also I think net http should really support this as every thing that does http transfers will benefit from this.
-
Jeremy Kemper May 19th, 2009 @ 10:00 PM
It should, but that feature should be a patch to upstream net/http rather than hiding out in Active Support.
Then Active Resource can either use net/http's inflate support or fall back to its own utility method.
-
Bart ten Brinke May 19th, 2009 @ 11:07 PM
Problem is that body is a private attribute of HTTP::NET, so if all the magick is in AR, it would make the patch even more ugly.
-
Dean Radcliffe August 14th, 2009 @ 06:00 AM
Jeremy mentions both:
Prefer not adding inflate! to net/http since it inflates AS for a special case. then..
that feature should be a patch to upstream net/httpI hope this one makes it in somewhere. Theres zero performance penalty of having this option turned off, and the ability to shorten average request duration if turned on. It meets good usability standards as well.
D
-
Bart ten Brinke August 14th, 2009 @ 07:44 AM
I don't really understand the problem with patching HTTP:NET. They will probably never do it upstream because of the zlib requirements. Also rails already has a truckload of mix-ins for base ruby classes (take hash for example).
And as stated above. There is no penalty if left disabled.
-
Santiago Pastorino February 2nd, 2011 @ 04:41 PM
- Importance changed from to
This issue has been automatically marked as stale because it has not been commented on for at least three months.
The resources of the Rails core team are limited, and so we are asking for your help. If you can still reproduce this error on the 3-0-stable branch or on master, please reply with all of the information you have about it and add "[state:open]" to your comment. This will reopen the ticket for review. Likewise, if you feel that this is a very important feature for Rails to include, please reply with your explanation so we can consider it.
Thank you for all your contributions, and we hope you will understand this step to focus our efforts where they are most helpful.
-
Santiago Pastorino February 2nd, 2011 @ 04:41 PM
- State changed from open to stale
Create your profile
Help contribute to this project by taking a few moments to create your personal profile. Create your profile »
<h2 style="font-size: 14px">Tickets have moved to Github</h2>
The new ticket tracker is available at <a href="https://github.com/rails/rails/issues">https://github.com/rails/rails/issues</a>