duritong / ruby-cobbler

A ruby interface for interacting with a Cobbler server.
GNU Lesser General Public License v2.1
7 stars 5 forks source link

Workaround for https://bugs.ruby-lang.org/issues/8182 #2

Closed spkane closed 10 years ago

spkane commented 10 years ago

This sets the HTTP Accept-Encoding header to a permissive setting that works around the bug in ruby 2.x documented here:

https://bugs.ruby-lang.org/issues/8182

duritong commented 10 years ago

Just double checking, but as far as I understood this is a backward compatible change?!

spkane commented 10 years ago

It deals with an error in Net::HTTP that affects XMLRPC::Client in many versions of Ruby 2.0/2.1. It is safe, even in a fixed version, since 'The "identity" content-coding is always acceptable'

http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html

The "identity" content-coding is always acceptable, unless specifically refused because the Accept-Encoding field includes "identity;q=0", or because the field includes "*;q=0" and does not explicitly include the "identity" content-coding. If the Accept-Encoding field-value is empty, then only the "identity" encoding is acceptable.

spkane commented 10 years ago

In Ruby 2.1.1 without this patch, running something like:

Cobbler::Base.remote_version

will generate and error like this:

RuntimeError: Wrong size. Was 144, should be 107

With the fix, you get something you'd expect, like:

=> 2.4

duritong commented 10 years ago

My question was rather: does this still work with Ruby 1.9.3?

spkane commented 10 years ago

I tested it with 1.9.3-p484 and all is good.

duritong commented 10 years ago

Thanks a lot! Will cut a release later during the day or maybe tomorrow.