diff options
author | Filipe David Borba Manana <fdmanana@apache.org> | 2010-08-01 23:32:04 +0000 |
---|---|---|
committer | Filipe David Borba Manana <fdmanana@apache.org> | 2010-08-01 23:32:04 +0000 |
commit | a4c63436226d3ad2c29ab5f634b40d8f82307d4e (patch) | |
tree | 55d603b0f8f858a85e58c73adc7ed488d40ab563 /src | |
parent | 92b5780638312375e049269e77f1d41a0d5a9f67 (diff) |
Merge revision 981341 from trunk:
Bug fix - RegExp matching the atom 'undefined'.
According to the HTTP 1.1 spec, if the Accept header is not specified by a client,
it means the client accepts all media types.
http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html
git-svn-id: https://svn.apache.org/repos/asf/couchdb/branches/1.0.x@981342 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src')
-rw-r--r-- | src/couchdb/couch_httpd.erl | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/src/couchdb/couch_httpd.erl b/src/couchdb/couch_httpd.erl index b531d3d6..c99251e4 100644 --- a/src/couchdb/couch_httpd.erl +++ b/src/couchdb/couch_httpd.erl @@ -754,7 +754,16 @@ error_headers(#httpd{mochi_req=MochiReq}=Req, Code, ErrorStr, ReasonStr) -> {Code, [{"WWW-Authenticate", "Basic realm=\"server\""}]}; _False -> % if the accept header matches html, then do the redirect. else proceed as usual. - case re:run(MochiReq:get_header_value("Accept"), "html", [{capture, none}]) of + Accepts = case MochiReq:get_header_value("Accept") of + undefined -> + % According to the HTTP 1.1 spec, if the Accept + % header is missing, it means the client accepts + % all media types. + "html"; + Else -> + Else + end, + case re:run(Accepts, "html", [{capture, none}, caseless]) of nomatch -> {Code, []}; match -> |