Return-Path: Delivered-To: apmail-couchdb-user-archive@www.apache.org Received: (qmail 68650 invoked from network); 10 Nov 2009 22:23:13 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 10 Nov 2009 22:23:13 -0000 Received: (qmail 66426 invoked by uid 500); 10 Nov 2009 22:23:12 -0000 Delivered-To: apmail-couchdb-user-archive@couchdb.apache.org Received: (qmail 66344 invoked by uid 500); 10 Nov 2009 22:23:12 -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 66334 invoked by uid 99); 10 Nov 2009 22:23:11 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 10 Nov 2009 22:23:11 +0000 X-ASF-Spam-Status: No, hits=-4.0 required=10.0 tests=RCVD_IN_DNSWL_MED,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: local policy) Received: from [134.169.9.68] (HELO rzcomm22.rz.tu-bs.de) (134.169.9.68) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 10 Nov 2009 22:23:02 +0000 Received: from rzcomm23 (rzcomm23.rz.tu-bs.de [134.169.9.69]) by rzcomm22.rz.tu-bs.de (8.14.2/8.13.8) with ESMTP id nAAMMf1x011399 for ; Tue, 10 Nov 2009 23:22:42 +0100 (envelope-from l.melzer@tu-bs.de) Received: from aludose.lan (dslb-092-077-158-233.pools.arcor-ip.net [92.77.158.233]) (using TLSv1 with cipher AES128-SHA (128/128 bits)) (No client certificate requested) by rzcomm23 (Postfix) with ESMTP id 78C563A1E for ; Tue, 10 Nov 2009 23:22:41 +0100 (CET) Content-Type: text/plain; charset=us-ascii; format=flowed; delsp=yes Mime-Version: 1.0 (Apple Message framework v1076) Subject: Re: POST/PUTing binary Attachments to external Handler From: Lennart Melzer In-Reply-To: Date: Tue, 10 Nov 2009 23:22:40 +0100 Content-Transfer-Encoding: 7bit Message-Id: <85C9D81F-E5FF-4C78-8CA1-9B5A9AB027CD@tu-bs.de> References: <3F9C582D-AAA4-42F5-84A5-43AAB11AA394@tu-bs.de> <6E55DC33-1BBD-4C47-ADDC-81ECDE9933A2@tu-bs.de> To: user@couchdb.apache.org X-Mailer: Apple Mail (2.1076) X-Virus-Checked: Checked by ClamAV on apache.org I just looked through the error logs and the code a bit more. I think this passage describes best what seems to happen (though I don't know why) So the stracktrace shows that the mochiweb passes the request to couch_httpd:handle_request where it seems to try to call send_json (whysoever). It all fails when it tries to encode the binary data as a json string. This all seems to happen before couch_httpd_external.erl stuff gets called, which might be able to handle binary data correctly. Here's the log snippet: crasher: initial call: mochiweb_socket_server:acceptor_loop/1 pid: <0.1059.0> registered_name: [] exception exit: {ucs,{bad_utf8_character_code}} in function xmerl_ucs:from_utf8/1 in call from mochijson2:json_encode_string/2 in call from mochijson2:'-json_encode_proplist/2-fun-0-'/3 in call from lists:foldl/3 in call from mochijson2:json_encode_proplist/2 in call from couch_httpd:send_json/4 in call from couch_httpd:handle_request/5 in call from mochiweb_http:headers/5 Anyone out that knows more about the internals of couchdb than I do? I would be grateful for any advice (gotta learn some erlang programming soonish). Greetings, Lennart On Nov 10, 2009, at 12:13 AM, Paul Davis wrote: > On Mon, Nov 9, 2009 at 12:15 PM, Lennart Melzer > wrote: >> I am running Revision 832477 of the couchdb trunk >> On Nov 9, 2009, at 6:09 PM, Paul Davis wrote: >> >>> On Mon, Nov 9, 2009 at 11:54 AM, Lennart Melzer >> bs.de> wrote: >>>> >>>> Right now, posting or putting binary data to an external handler >>>> fails, >>>> since the data is parsed as a UTF-8 String and not treated as >>>> binary. The >>>> external handler never gets to do its work, so this might be an >>>> issue >>>> with >>>> the handling of data sent to an external handler. Am I misusing the >>>> external-handler interface? >>>> >>>> Error snippet: >>>> [error] [<0.95.0>] {error_report,<0.30.0>, >>>> {<0.95.0>,std_error, >>>> {mochiweb_socket_server,235, >>>> {child_error,{ucs,{bad_utf8_character_code}}}}}} >>>> >>>> Greetings, >>>> >>>> Lennart >>>> >>> >>> Lennart, >>> >>> What version of CouchDB are you on? I seem to remember a patch for >>> this going into trunk at some point. Not sure if that was pre/post >>> 0.10 though. >>> >>> Paul Davis >> >> > > Lennart, > > Hmm, looking through the svn log I'm not seeing a commit that mentions > body or posts. I swear I remember something like that coming through > at one point. Benoit, didn't you have something to do with that? > > Paul Davis