incubator-couchdb-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Robert Newson <robert.new...@gmail.com>
Subject Re: standalone attachments and content-encoding header
Date Wed, 17 Mar 2010 20:37:54 GMT
transfer encoding negotiation is pretty standard. Your request didn't
say you can accept compressed responses, so couch is inflating it for
you. The fix really is to add the Accept-Encoding header. CouchDB
actually stores the data compressed if you send it that way too.

B.

On Wed, Mar 17, 2010 at 8:32 PM, John Merrells <john@merrells.com> wrote:
>
> On Mar 17, 2010, at 1:24 PM, Brian Candler wrote:
>
>> On Wed, Mar 17, 2010 at 12:39:15PM -0700, John Merrells wrote:
>>> I just started working with couch and I have a question about the headers
>>> returned with a standalone attachment.  I'm storing compressed html files
>>> as an attachment, sending the headers content-type: text/html and
>>> content-encoding: deflate.  When the attachment is fetched the correct
>>> content-type is returned, but no content-encoding header is returned.  Is
>>> this a limitation of CouchDB?  Or, perhaps of my client (CouchRest)?  Or,
>>> perhaps I've just made a mistake.
>>
>> Try adding --compressed option to curl command line (and GET not HEAD).
>> This should add "Accept-Encoding: deflate, gzip" header to the request. That
>> is - if the client doesn't ask for a compressed representation, I don't
>> think couchdb will send it.
>
>
> I'll give it a go...
>
> [13:27][john@johnmerrellsmacbookpro:~/jj/reflector(master)]$ curl http://host:port/pages/http%3A%2F%2Fjohnmerrells.com/page
--compressed -i
> HTTP/1.1 200 OK
> Server: CouchDB/0.10.1 (Erlang OTP/R13B)
> ETag: "2-1d1c512ddcf00a7d8b1a7f8052f06314"
> Date: Wed, 17 Mar 2010 20:28:01 GMT
> Content-Type: text/html; charset=UTF-8
> Content-Length: 19909
> Cache-Control: must-revalidate
>
> ...but I don't think that's the problem really.
>
> I'm not asking couch to compress the content before sending it, as I compressed
> it before I pushed it up. All I want is for couch to send me back that content-encoded
> header that I sent up with it.... then the user agent will do the right thing when it
> resolve the attachment url into couch.... right now the browser gets text/html and
> a bunch of binary... if it had content-encoded then it'd know to decompress it before
> displaying it....
>
> John
>
> --
> John Merrells
> http://johnmerrells.com
> +1.415.244.5808
>
>
>
>
>
>
>

Mime
View raw message