incubator-couchdb-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Adam Kocoloski <kocol...@apache.org>
Subject Re: ibrowse + compression
Date Wed, 03 Mar 2010 04:53:35 GMT
Hi Chandru, I think there will be occasions -- e.g. replicating compressed attachments -- when
we won't want to unzip the response body.  We are decompressing other gzipped responses using
a little wrapper much like what you pasted below.  I suppose if ibrowse handled this directly
it would save a few lines on our end.  All the best,

Adam

On Mar 2, 2010, at 6:39 PM, Chandru wrote:

> 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
View raw message