Return-Path: X-Original-To: apmail-couchdb-user-archive@www.apache.org Delivered-To: apmail-couchdb-user-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 7F389D8AA for ; Mon, 24 Dec 2012 19:29:45 +0000 (UTC) Received: (qmail 69507 invoked by uid 500); 24 Dec 2012 19:29:44 -0000 Delivered-To: apmail-couchdb-user-archive@couchdb.apache.org Received: (qmail 69466 invoked by uid 500); 24 Dec 2012 19:29:44 -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 69457 invoked by uid 99); 24 Dec 2012 19:29:44 -0000 Received: from minotaur.apache.org (HELO minotaur.apache.org) (140.211.11.9) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 24 Dec 2012 19:29:44 +0000 Received: from localhost (HELO mail-vb0-f42.google.com) (127.0.0.1) (smtp-auth username rnewson, mechanism plain) by minotaur.apache.org (qpsmtpd/0.29) with ESMTP; Mon, 24 Dec 2012 19:29:43 +0000 Received: by mail-vb0-f42.google.com with SMTP id fa15so7706447vbb.15 for ; Mon, 24 Dec 2012 11:29:42 -0800 (PST) MIME-Version: 1.0 Received: by 10.220.153.80 with SMTP id j16mr33841405vcw.21.1356377382729; Mon, 24 Dec 2012 11:29:42 -0800 (PST) Received: by 10.52.68.209 with HTTP; Mon, 24 Dec 2012 11:29:42 -0800 (PST) In-Reply-To: References: <1356376027.49218.yext-apple-iphone@web181706.mail.ne1.yahoo.com> Date: Mon, 24 Dec 2012 19:29:42 +0000 Message-ID: Subject: Re: Documented API does not work. From: Robert Newson To: "user@couchdb.apache.org" Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable HTTP 1.0 vs HTTP 1.1 for CouchDB 1.2.0; =E2=9E=9C ~ curl -sv0 localhost:5984/db1/_all_docs * About to connect() to localhost port 5984 (#0) * Trying ::1... Connection refused * Trying 127.0.0.1... connected * Connected to localhost (127.0.0.1) port 5984 (#0) > GET /db1/_all_docs HTTP/1.0 > User-Agent: curl/7.21.4 (universal-apple-darwin11.0) libcurl/7.21.4 OpenS= SL/0.9.8r zlib/1.2.5 > Host: localhost:5984 > Accept: */* > * HTTP 1.0, assume close after body < HTTP/1.0 200 OK < Server: CouchDB/1.3.0a-aaee1ec-git (Erlang OTP/R15B03) < ETag: "DWT0Y2U5NG13MTYI5ZOOP5LOA" < Date: Mon, 24 Dec 2012 19:28:33 GMT < Content-Type: text/plain; charset=3Dutf-8 < Cache-Control: must-revalidate < {"total_rows":1,"offset":0,"rows":[ {"id":"doc1","key":"doc1","value":{"rev":"1-967a00dff5e02add41819138abb3284= d"}} ]} * Closing connection #0 =E2=9E=9C ~ curl -sv localhost:5984/db1/_all_docs * About to connect() to localhost port 5984 (#0) * Trying ::1... Connection refused * Trying 127.0.0.1... connected * Connected to localhost (127.0.0.1) port 5984 (#0) > GET /db1/_all_docs HTTP/1.1 > User-Agent: curl/7.21.4 (universal-apple-darwin11.0) libcurl/7.21.4 OpenS= SL/0.9.8r zlib/1.2.5 > Host: localhost:5984 > Accept: */* > < HTTP/1.1 200 OK < Transfer-Encoding: chunked < Server: CouchDB/1.3.0a-aaee1ec-git (Erlang OTP/R15B03) < ETag: "DWT0Y2U5NG13MTYI5ZOOP5LOA" < Date: Mon, 24 Dec 2012 19:28:37 GMT < Content-Type: text/plain; charset=3Dutf-8 < Cache-Control: must-revalidate < {"total_rows":1,"offset":0,"rows":[ {"id":"doc1","key":"doc1","value":{"rev":"1-967a00dff5e02add41819138abb3284= d"}} ]} * Connection #0 to host localhost left intact * Closing connection #0 On 24 December 2012 19:25, Robert Newson wrote: > it works just fine if you send a correct request. all_docs is sent in > chunked mode which is new in http 1.1, though calling http 1.1 is > obviously quite silly. > > Try using curl or any other competent http library and you'll be be all s= et. > > B. > > On 24 December 2012 19:07, Scott wrote: >> Thanks. But what about not being able to read '_all_docs' ? >> >> 'Sent from my iPhone'... Not someone else's. >> >> On Dec 24, 2012, at 12:38 PM, Robert Newson wrote: >> >> A typo in the wiki, I'll fix it. All HTTP request lines start with a /. >> >> B. >> >> On 24 December 2012 18:19, Scott Weber wrote: >> I am trying to read the DB using a program to communication through sock= ets. >> And it is not working as documented. I have a small test database calle= d >> 'basic' >> >> My reference point is this information >> http://wiki.apache.org/couchdb/HTTP_Document_API#all_docs >> >> First off, this causes a CRASH on the server: >> GET basic/_all_docs HTTP/1.0 >> Accept : */* >> Host : 127.0.0.1:5984 >> UserAgent : MyEditor >> >> >> The crash report is: >> =3DCRASH REPORT=3D=3D=3D=3D 24-Dec-2012::12:04:11 =3D=3D=3D >> crasher: >> initial call: mochiweb_acceptor:init/3 >> pid: <0.1803.0> >> registered_name: [] >> exception error: no function clause matching >> mochiweb:new_request({#Port<0.4833>, >> {'GET',"basic/_all_docs",{1,0}= }, >> [{'Accept',"*/*"}, >> {'Host',"127.0.0.1:5984"}, >> {"Useragent","MyEditor"}]}) >> in function mochiweb_http:headers/5 >> ancestors: [couch_httpd,couch_secondary_services,couch_server_sup, >> <0.35.0>] >> messages: [] >> links: [<0.130.0>,#Port<0.4833>] >> dictionary: [] >> trap_exit: false >> status: running >> heap_size: 987 >> stack_size: 24 >> reductions: 1047 >> neighbours: >> >> Now, I can make it NOT crash, by pre-pending a slash (it took me *hours*= to find >> this one...) >> GET /basic/_all_docs HTTP/1.0 >> Accept : */* >> Host : 127.0.0.1:5984 >> UserAgent : MyEditor >> >> >> However, it does not give me any content length.: >> HTTP/1.0 200 OK >> Server: CouchDB/1.2.0 (Erlang OTP/R14B04) >> ETag: "4UXHG90N70GABNCO2D91E21GZ" >> Date: Mon, 24 Dec 2012 18:08:45 GMT >> Content-Type: text/plain; charset=3Dutf-8 >> Cache-Control: must-revalidate >> >> >> If I ask for a specific doc from the database, I will get content: >> GET /basic/somedoc HTTP/1.0 >> Accept : */* >> Host : 127.0.0.1:5984 >> UserAgent : MyEditor >> >> And the reply is this, with the body of the document following, as expec= ted. >> HTTP/1.0 200 OK >> Server: CouchDB/1.2.0 (Erlang OTP/R14B04) >> ETag: "3-aaf03052c820e9146ef37cecb23e869d" >> Date: Mon, 24 Dec 2012 18:12:01 GMT >> Content-Type: text/plain; charset=3Dutf-8 >> Content-Length: 167 >> Cache-Control: must-revalidate >> >> Why does it crash when I follow the documented API? >> Why can I not get a list of "_all_docs" ? >> >> I have even removed ALL the headers, and just left the request line. Sa= me >> result.