You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@couchdb.apache.org by fd...@apache.org on 2010/08/02 01:30:15 UTC

svn commit: r981341 - /couchdb/trunk/src/couchdb/couch_httpd.erl

Author: fdmanana
Date: Sun Aug  1 23:30:15 2010
New Revision: 981341

URL: http://svn.apache.org/viewvc?rev=981341&view=rev
Log:
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/trunk/src/couchdb/couch_httpd.erl

Modified: couchdb/trunk/src/couchdb/couch_httpd.erl
URL: http://svn.apache.org/viewvc/couchdb/trunk/src/couchdb/couch_httpd.erl?rev=981341&r1=981340&r2=981341&view=diff
==============================================================================
--- couchdb/trunk/src/couchdb/couch_httpd.erl (original)
+++ couchdb/trunk/src/couchdb/couch_httpd.erl Sun Aug  1 23:30:15 2010
@@ -777,7 +777,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 ->