couchdb-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dave Cottlehuber <d...@muse.net.nz>
Subject modifying headers inside lists after calling GetRow()
Date Fri, 27 Apr 2012 13:49:51 GMT
Currently in lists, calls to getRow() flushes HTTP headers immediately.

Caleb's put forward a patch for this [1] which enables you to defer
sending headers until the first chunk of data is returned via send().

People are using the ability to modify & set headers to do stuff like return
HTTP error status after looking at row content, or redirecting elsewhere.
But they want to do this after the list has inspected the content [2]. It's
a popular request.

However I'm not sure if this patch is abusing lists too far. Thoughts?

The intent of lists/shows as I understand it was to be able to extend output
past basic JSON - e.g. wrapping the view output as XML,SVG, or turning
it directly
into an HTML structure for low-end browsers and search engines.

The patch above in principle would allow you to do any processing you like,
including emulating a full reduce, with potential performance degradation, or
any other data munging. But then you can already do that today, just you
can't modify the headers based on row content.

My thinking is that the functionality is useful, and that the concern around
performance etc is already present. So if there's not a better solution, and it
doesn't break on bigcouch integration, I would support it going in, and abusing
lists a little more.

[1]: https://github.com/apache/couchdb/pull/18
[2]: https://issues.apache.org/jira/browse/COUCHDB-430 and 514, 764, 1299

A+
Dave

Mime
View raw message