diff options
| author | Robert Newson <rnewson@apache.org> | 2010-08-24 09:44:11 +0000 | 
|---|---|---|
| committer | Robert Newson <rnewson@apache.org> | 2010-08-24 09:44:11 +0000 | 
| commit | 8b0860660a2a7923ca9c56fed3acac8543546bfe (patch) | |
| tree | 7c4c932fd8bad092e0ea3eff246bc052c0d37cf0 | |
| parent | f3597fc4871cd5654a794144e1fef598078b3c5e (diff) | |
set Accept-Ranges conditionally on identity encoding.
git-svn-id: https://svn.apache.org/repos/asf/couchdb/trunk@988452 13f79535-47bb-0310-9956-ffa450edef68
| -rw-r--r-- | src/couchdb/couch_httpd_db.erl | 26 | 
1 files changed, 15 insertions, 11 deletions
diff --git a/src/couchdb/couch_httpd_db.erl b/src/couchdb/couch_httpd_db.erl index 9181fcc5..3e611fdd 100644 --- a/src/couchdb/couch_httpd_db.erl +++ b/src/couchdb/couch_httpd_db.erl @@ -903,17 +903,6 @@ db_attachment_req(#httpd{method='GET',mochi_req=MochiReq}=Req, Db, DocId, FileNa             atom_to_list(Enc),             couch_httpd:accepted_encodings(Req)          ), -        Headers = [ -            {"ETag", Etag}, -            {"Cache-Control", "must-revalidate"}, -            {"Content-Type", binary_to_list(Type)}, -            {"Accept-Ranges", "bytes"} -        ] ++ case ReqAcceptsAttEnc of -        true -> -            [{"Content-Encoding", atom_to_list(Enc)}]; -        _ -> -            [] -        end,          Len = case {Enc, ReqAcceptsAttEnc} of          {identity, _} ->              % stored and served in identity form @@ -933,6 +922,21 @@ db_attachment_req(#httpd{method='GET',mochi_req=MochiReq}=Req, Db, DocId, FileNa              % header we'll fall back to a chunked response.              undefined          end, +        Headers = [ +            {"ETag", Etag}, +            {"Cache-Control", "must-revalidate"}, +            {"Content-Type", binary_to_list(Type)} +        ] ++ case ReqAcceptsAttEnc of +        true -> +            [{"Content-Encoding", atom_to_list(Enc)}]; +        _ -> +            [] +        end ++ case Enc of +            identity -> +                [{"Accept-Ranges", "bytes"}]; +            _ -> +                [{"Accept-Ranges", "none"}] +        end,          AttFun = case ReqAcceptsAttEnc of          false ->              fun couch_doc:att_foldl_decode/3;  | 
