couchdb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From fdman...@apache.org
Subject svn commit: r981342 - /couchdb/branches/1.0.x/src/couchdb/couch_httpd.erl
Date Sun, 01 Aug 2010 23:32:04 GMT
Author: fdmanana
Date: Sun Aug  1 23:32:04 2010
New Revision: 981342

URL: http://svn.apache.org/viewvc?rev=981342&view=rev
Log:
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


Modified:
    couchdb/branches/1.0.x/src/couchdb/couch_httpd.erl

Modified: couchdb/branches/1.0.x/src/couchdb/couch_httpd.erl
URL: http://svn.apache.org/viewvc/couchdb/branches/1.0.x/src/couchdb/couch_httpd.erl?rev=981342&r1=981341&r2=981342&view=diff
==============================================================================
--- couchdb/branches/1.0.x/src/couchdb/couch_httpd.erl (original)
+++ couchdb/branches/1.0.x/src/couchdb/couch_httpd.erl Sun Aug  1 23:32:04 2010
@@ -754,7 +754,16 @@ error_headers(#httpd{mochi_req=MochiReq}
                             {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 ->



Mime
View raw message