incubator-couchdb-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Alexander Shorin <kxe...@gmail.com>
Subject About how CouchDB have processing requests
Date Mon, 02 May 2011 16:53:42 GMT
Hi all,

I just wants to understand some things before creating new issue,
because this could be not an issue at all.

All render function handles req argument which is represents request
object that have been perfectly described at couch_httpd_external.erl
[1] and couch_httpd.erl [2]
But several questions are have to be occurred:
1. For GET requests body field hold "undefined" string. That's a
little confusing, because for DELETE method this fields holds empty
string value. Why not null value or empty string as others does?
I've seen that this have been fixed @57b9a824 [3], but only for
"application/x-www-form-urlencoded" Content-Type, right?

2. For any request methods not in ["GET", "HEAD", "POST", "PUT",
"DELETE", "COPY", "TRACE", "OPTIONS"] list method field holds list of
bytes instead of method name as string. That's a little unexpected
behavior.
Reasons to use custom request methods? Hmm...I see no one if only I'm
developing some kind of webdav service as extension for couchdb or
something similar.

Tested by:
curl -X UNKNOWN http://localhost:5984/test/_design/temp/_show/test/ |
grep -oP "\"method\":\[.*?\]"

against show function:
function(doc, req){
  return {json: req}
}

and result would be:
"method":[85,78,75,78,79,87,78]

Is this correct behavior?

3.  Seems to be there is no way to pass request with query contained
multiple keys e.g.
db/_design/_show/test?a=1&a=2
nor
db/_design/_show/test?a[]=1&a[]=2
to have expected
{
 "a": ["1", "2"]
}
query / form value, not just {"a": "2"}
Same technique is wide used with php and AFAIK, others (at least
python frameworks: django, pylons) provides same behavior. That's very
useful especially to work with a lot of checkboxes.
Is this normal behavior or just multiple query keys had not been planned?


P.S. CouchDB 1.0.2 release, I've failed to test same things against
trunk, but source code / commit log haven't said anything about new
behavior.
P.S.S. Sorry for a lot of mistakes in my English(:

[1] https://github.com/apache/couchdb/blob/trunk/src/couchdb/couch_httpd_external.erl#L57
[2] https://github.com/apache/couchdb/blob/trunk/src/couchdb/couch_httpd.erl#L177
[3] https://github.com/apache/couchdb/commit/57b9a824e441fa42da28415dfd8877b7a0ea3f08#src/couchdb/couch_httpd_external.erl

------------------
,,,^..^,,,

Mime
View raw message