Skip to content

Commit

Permalink
Don't set Content-Encoding headers with value "identity"
Browse files Browse the repository at this point in the history
This is dictated by RFC 2616 and causes problems with Microsoft's ISA 2006 proxy.
Closes COUCHDB-1128.
Thanks Paul Davis and Andrew Gleave.



git-svn-id: https://svn.apache.org/repos/asf/couchdb/trunk@1095200 13f79535-47bb-0310-9956-ffa450edef68
  • Loading branch information
fdmanana committed Apr 19, 2011
1 parent 112c939 commit 0d941ef
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
4 changes: 3 additions & 1 deletion src/couchdb/couch_httpd_db.erl
Expand Up @@ -960,7 +960,9 @@ db_attachment_req(#httpd{method='GET',mochi_req=MochiReq}=Req, Db, DocId, FileNa
{"Cache-Control", "must-revalidate"},
{"Content-Type", binary_to_list(Type)}
] ++ case ReqAcceptsAttEnc of
true ->
true when Enc =/= identity ->
% RFC 2616 says that the 'identify' encoding should not be used in
% the Content-Encoding header
[{"Content-Encoding", atom_to_list(Enc)}];
_ ->
[]
Expand Down
16 changes: 7 additions & 9 deletions test/etap/140-attachment-comp.t
Expand Up @@ -19,7 +19,7 @@ test_db_name() ->
main(_) ->
test_util:init_code_path(),

etap:plan(86),
etap:plan(85),
case (catch test()) of
ok ->
etap:end_tests();
Expand Down Expand Up @@ -254,8 +254,8 @@ test_get_1st_png_att_without_accept_encoding_header() ->
[],
[{sync, true}]),
etap:is(Code, 200, "HTTP response code is 200"),
Gziped = lists:member({"content-encoding", "gzip"}, Headers),
etap:is(Gziped, false, "received body is not gziped"),
Encoding = couch_util:get_value("content-encoding", Headers),
etap:is(Encoding, undefined, "received body is not gziped"),
etap:is(
Body,
test_png_data(),
Expand All @@ -270,8 +270,8 @@ test_get_1st_png_att_with_accept_encoding_gzip() ->
[],
[{sync, true}]),
etap:is(Code, 200, "HTTP response code is 200"),
Gziped = lists:member({"content-encoding", "gzip"}, Headers),
etap:is(Gziped, false, "received body is not gziped"),
Encoding = couch_util:get_value("content-encoding", Headers),
etap:is(Encoding, undefined, "received body is not gziped"),
etap:is(
Body,
test_png_data(),
Expand All @@ -286,10 +286,8 @@ test_get_1st_png_att_with_accept_encoding_deflate() ->
[],
[{sync, true}]),
etap:is(Code, 200, "HTTP response code is 200"),
Deflated = lists:member({"content-encoding", "deflate"}, Headers),
etap:is(Deflated, false, "received body is not deflated"),
Gziped = lists:member({"content-encoding", "gzip"}, Headers),
etap:is(Gziped, false, "received body is not gziped"),
Encoding = couch_util:get_value("content-encoding", Headers),
etap:is(Encoding, undefined, "received body is in identity form"),
etap:is(
Body,
test_png_data(),
Expand Down

0 comments on commit 0d941ef

Please sign in to comment.