Paste: do not decode binary http response body as a string

Author: Eungju PARK
Mode: patch
Date: Mon, 31 Oct 2011 05:16:08
Plain Text |
diff --git a/basis/http/client/client.factor b/basis/http/client/client.factor
index 7f99c62..8d1b996 100644
--- a/basis/http/client/client.factor
+++ b/basis/http/client/client.factor
@@ -162,7 +162,8 @@ ERROR: download-failed response ;
 
 : http-request ( request -- response data )
     [ [ % ] with-http-request ] B{ } make
-    over content-encoding>> decode check-response-with-body ;
+    over content-encoding>> dup binary = [ drop ] [ decode ] if
+    check-response-with-body ;
 
 : <get-request> ( url -- request )
     "GET" <client-request> ;

New Annotation

Summary:
Author:
Mode:
Body: