couchdb-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Chandru <chandrashekhar.mullapar...@gmail.com>
Subject ibrowse + compression
Date Tue, 02 Mar 2010 23:39:31 GMT
Hello everyone,

I'm the author and maintainer of ibrowse. I know you use ibrowse in CouchDB
and I had an idea a couple of days ago.

Would it help improve performance if ibrowse supported receiving compressed
data from the webserver but made it transparent to the calling process? It
is simple enough for the caller to do (as shown below) it but would it help
if ibrowse supported that natively?

get_url(Url) ->
   case ibrowse:send_req(Url, [{"accept-encoding", "gzip"}], get,
                          [], [{response_format, binary}]) of
       {ok, "200", Headers, Body} ->
            Headers_lc = [{string:to_lower(X), string:to_lower(Y)} || {X, Y}
<- Headers],
           Body_1 = case proplists:get_value("content-encoding", Headers_lc)
of
                         "gzip" ->
                            zlib:gunzip(Body);
                        _ ->
                            Body
                     end,
           {ok, "200", Headers, Body_1};
        Res ->
           Res
    end.

cheers
 Chandru

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message