Skip to content

Instantly share code, notes, and snippets.

View Teshootub7's full-sized avatar

Morita Sho Teshootub7

View GitHub Profile
@Teshootub7
Teshootub7 / gist:714955
Created November 25, 2010 05:34
Patch for HTTPClient to fix the hang-up problem
diff --git a/lib/httpclient.rb b/lib/httpclient.rb
index 11a4da4..a250dfe 100644
--- a/lib/httpclient.rb
+++ b/lib/httpclient.rb
@@ -777,22 +777,26 @@ private
def do_request_async(method, uri, query, body, extheader)
conn = Connection.new
t = Thread.new(conn) { |tconn|
- if HTTP::Message.file?(body)
- pos = body.pos rescue nil
@Teshootub7
Teshootub7 / gist:702845
Created November 17, 2010 01:20
Patch to add gzip support for httpclient
diff --git a/lib/httpclient.rb b/lib/httpclient.rb
index 11a4da4..475fa51 100644
--- a/lib/httpclient.rb
+++ b/lib/httpclient.rb
@@ -317,6 +317,8 @@ class HTTPClient
# An array of response HTTP String (not a HTTP message body) which is used
# for loopback test. See test/* to see how to use it.
attr_proxy(:test_loopback_http_response)
+ # Decompress a compressed (with gzip or deflate) content body transparently. false by default.
+ attr_proxy(:transparent_gzip_decompression, true)