Return-Path: X-Original-To: apmail-couchdb-dev-archive@www.apache.org Delivered-To: apmail-couchdb-dev-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 8D1E5EE08 for ; Sun, 17 Mar 2013 14:29:16 +0000 (UTC) Received: (qmail 14364 invoked by uid 500); 17 Mar 2013 14:29:15 -0000 Delivered-To: apmail-couchdb-dev-archive@couchdb.apache.org Received: (qmail 14334 invoked by uid 500); 17 Mar 2013 14:29:15 -0000 Mailing-List: contact dev-help@couchdb.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@couchdb.apache.org Delivered-To: mailing list dev@couchdb.apache.org Received: (qmail 13597 invoked by uid 99); 17 Mar 2013 14:29:14 -0000 Received: from arcas.apache.org (HELO arcas.apache.org) (140.211.11.28) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 17 Mar 2013 14:29:14 +0000 Date: Sun, 17 Mar 2013 14:29:14 +0000 (UTC) From: "Jan Lehnardt (JIRA)" To: dev@couchdb.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Commented] (COUCHDB-1697) if-none-match header causes 500 internal server error on CORS requests MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 [ https://issues.apache.org/jira/browse/COUCHDB-1697?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13604611#comment-13604611 ] Jan Lehnardt commented on COUCHDB-1697: --------------------------------------- looks good, conditional +1 if we can add a test case as well. Ryan, could you add that? > if-none-match header causes 500 internal server error on CORS requests > ---------------------------------------------------------------------- > > Key: COUCHDB-1697 > URL: https://issues.apache.org/jira/browse/COUCHDB-1697 > Project: CouchDB > Issue Type: Bug > Components: HTTP Interface > Affects Versions: 1.3 > Reporter: Ryan Ramage > Assignee: Ryan Ramage > Priority: Blocker > Fix For: 1.3 > > > Browsers can send a if-none-match header to couchdb, but this can will break when CORS is enabled. The reason seems to be the header comes in as a binary, eg from the debug log the header is: > {'If-None-Match',"\"V9J3604P4V9VTR5H77SBHJW\""}, > When maybe_apply_cors_headers is called, the assumption is that the headers are strings. This can be seen here: https://github.com/apache/couchdb/blob/b0420f9006915149e81607615720f32f21c76725/src/couchdb/couch_httpd_cors.erl#L219 > Thus a string:to_lower is undefined as can be seen in this stacktrace: > [info] [<0.148.0>] Stacktrace: [{string,to_lower, > [undefined], > [{file,"string.erl"},{line,468}]}, > {couch_httpd_cors,maybe_apply_cors_headers,2, > [{file, > "/Users/jan/Work/build-couchdb-mac/build-couchdb/git-build/https%3A%2F%2Fgit-wip-us.apache.org%2Frepos%2Fasf%2Fcouchdb.git%3A06c3f351f158f107a8293c7c6c9b2415b942f0e9/src/couchdb/couch_httpd_cors.erl"}, > {line,219}]}, > {couch_httpd,send_response,4, > [{file, > See original gist https://gist.github.com/ryanramage/5143964#file-gistfile1-txt-L64 -- This message is automatically generated by JIRA. If you think it was sent incorrectly, please contact your JIRA administrators For more information on JIRA, see: http://www.atlassian.com/software/jira