From user-return-9824-apmail-couchdb-user-archive=couchdb.apache.org@couchdb.apache.org Thu Apr 08 14:46:07 2010 Return-Path: Delivered-To: apmail-couchdb-user-archive@www.apache.org Received: (qmail 64509 invoked from network); 8 Apr 2010 14:46:06 -0000 Received: from unknown (HELO mail.apache.org) (140.211.11.3) by 140.211.11.9 with SMTP; 8 Apr 2010 14:46:06 -0000 Received: (qmail 47190 invoked by uid 500); 8 Apr 2010 14:46:05 -0000 Delivered-To: apmail-couchdb-user-archive@couchdb.apache.org Received: (qmail 47156 invoked by uid 500); 8 Apr 2010 14:46:05 -0000 Mailing-List: contact user-help@couchdb.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: user@couchdb.apache.org Delivered-To: mailing list user@couchdb.apache.org Received: (qmail 47148 invoked by uid 99); 8 Apr 2010 14:46:05 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 08 Apr 2010 14:46:05 +0000 X-ASF-Spam-Status: No, hits=0.0 required=10.0 tests=FREEMAIL_FROM,RCVD_IN_DNSWL_NONE,SPF_PASS,T_TO_NO_BRKTS_FREEMAIL X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of jchris@gmail.com designates 72.14.220.155 as permitted sender) Received: from [72.14.220.155] (HELO fg-out-1718.google.com) (72.14.220.155) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 08 Apr 2010 14:45:55 +0000 Received: by fg-out-1718.google.com with SMTP id d23so957800fga.5 for ; Thu, 08 Apr 2010 07:45:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:content-type:mime-version :subject:from:in-reply-to:date:content-transfer-encoding:message-id :references:to:x-mailer; bh=yXby1SpIQwaFWwB9arMzN8YHLGwt1AJqEWLgPsTO/dw=; b=r7rKhRpvBWdRcbvYr4rJigwDLvSBVWXK8aNdAITVuLv8ptpcqcnFUZxZxZrctu2GbH mqVINLbG4M8o8I3dCI6Uk9aYOxhqvodKZcsIVAx0AbJiW423eUrQ8STcEFAmuthjG7kG lAGKZyT2fZLUS1B04VwPxAyUkEFRY078cQC1k= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=content-type:mime-version:subject:from:in-reply-to:date :content-transfer-encoding:message-id:references:to:x-mailer; b=kKVPbRAJLARnl3agPgxei7YFmYw4B6RqDXnp4TzcJrPoXA451fcGnfc8xb6lVNKz09 FUtukZPZEbvzn832w+FDqnYaeTcSYHzqDqbqZHN0T5IvFmOoszAMA3Iyh2ZiQSC4yxa2 765oElHYOAOxx1U49kvNFyBYOgkQD0v81+iHI= Received: by 10.87.68.36 with SMTP id v36mr505449fgk.43.1270737935339; Thu, 08 Apr 2010 07:45:35 -0700 (PDT) Received: from [192.168.1.103] (c-98-248-172-14.hsd1.ca.comcast.net [98.248.172.14]) by mx.google.com with ESMTPS id 15sm109683fxm.11.2010.04.08.07.45.31 (version=TLSv1/SSLv3 cipher=RC4-MD5); Thu, 08 Apr 2010 07:45:33 -0700 (PDT) Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Apple Message framework v1077) Subject: Re: Do change notification (filters) support HTTP verbs other than GET? From: J Chris Anderson In-Reply-To: Date: Thu, 8 Apr 2010 07:45:29 -0700 Content-Transfer-Encoding: quoted-printable Message-Id: <08835BDC-4E19-461D-910D-5F756B97DF87@gmail.com> References: <60E2B606-A2C3-4570-B6F6-FB27BC20D61F@gmail.com> To: user@couchdb.apache.org X-Mailer: Apple Mail (2.1077) X-Virus-Checked: Checked by ClamAV on apache.org On Apr 8, 2010, at 5:41 AM, Ning Tan wrote: > My filter function is >=20 > function(doc, req) > { > return true; > } >=20 OK. that looks good enough. :) Somehow I thought you were doing something stateful, based on your = earlier description. BTW, you don't need to include json2.js as it is already available to = your functions. If you want to try with a POST instead of a GET, you can edit one line = in couch_httpd_db.erl handle_changes_req(#httpd{method=3D'GET'}=3DReq, Db) -> to: handle_changes_req(Req, Db) -> which should allow for POSTs to _changes. > :-) >=20 > On Wed, Apr 7, 2010 at 11:37 PM, J Chris Anderson = wrote: >>=20 >> On Apr 7, 2010, at 7:14 PM, Ning Tan wrote: >>=20 >>> On Wed, Apr 7, 2010 at 2:05 AM, J Chris Anderson = wrote: >>>>=20 >>>> On Apr 6, 2010, at 8:48 AM, Ning Tan wrote: >>>>=20 >>>>> Hello, >>>>>=20 >>>>> Do change notification filters (or change notifications in = general) >>>>> support HTTP verbs other than GET? >>>>>=20 >>>>=20 >>>> Currently they only support GET, but it'd be a very short patch to = expand support to include POST. >>>=20 >>> Thanks. I'm going to see if I can create such a patch. Time to learn = a >>> bit more about Futon tests. >>>=20 >>> Also, in the meantime, I'm trying to "hack" the solution by sending = a >>> request body with a GET. It seems that the body reaches my filter >>> function fine (via req.body), but for some reason the response from >>> Couch hangs whenever I send the body, even for a filter function = that >>> just returns true. >>>=20 >>> If I remember correctly, the response was like >>>=20 >>> { results: [ >>>=20 >>> and then the curl session just sits there. >>>=20 >>> My curl command was something like: >>>=20 >>> curl -d '["id1","id2"]' -X GET $DB/_changes?filter=3Dapp/myFunc >>>=20 >>> The minute I took out the body, the problem went away. >>>=20 >>> I understand that sending a body with GET is not a standard way of >>> doing things, but the hanging part was really weird anyway. It was = so >>> close to being a working solution. :-) I can get you more details if >>> needed. >>>=20 >>=20 >> It might just be the filter function. >>=20 >> Can you provide the code for your filter function? >>=20 >> Your GET/body trick is intriguing. I think a lot of proxies and = clients wont' support it, but it could work in your use case. >>=20 >>> Thanks for your help. >>=20 >>=20