Re: Allow overridden request methods

2009-05-14 Thread Brian Candler
On Thu, May 14, 2009 at 06:45:28AM -0500, Jared Scheel wrote:
 That's a great point, DELETE does often get ignored. I like the idea
 of having a reserved property in json, but it still relies on your
 ability to push json to couchdb.

So, you want to be able to replace a PUT with a POST, in some part of the
API where the body is neither JSON nor a HTML FORM upload.

The only example I can think of is using PUT to upload an attachment, and I
thought there was already a POST multipart/form-data alternative for that.

What else have I forgotten?


Re: Allow overridden request methods

2009-05-14 Thread Brian Candler
On Thu, May 14, 2009 at 07:08:21AM -0500, Jared Scheel wrote:
 Hmm, didn't think about that. I guess you will need to have some kind
 of request body anyways. Do you think that the request method should
 be set in the data though, or should it be set in the header, since
 the method/header defines how the data should be interpreted? I know
 that's just splitting hairs, but there was some concern about keeping
 the api as clean as possible.

I think the whole point is to support minimal HTTP clients. If they don't
support PUT or DELETE, there's a good chance they don't support custom HTTP
headers either.


Re: Allow overridden request methods

2009-05-14 Thread Mikeal Rogers
Does anyone have an example of an HTTP client that doesn't support  
changing or adding headers?


I certainly can't think of any. Limiting request methods is one thing  
but not allowing you to modify headers is pretty crippling.


-Mikeal

On May 14, 2009, at May 14, 20096:29 AM, Brian Candler wrote:


On Thu, May 14, 2009 at 07:08:21AM -0500, Jared Scheel wrote:

Hmm, didn't think about that. I guess you will need to have some kind
of request body anyways. Do you think that the request method should
be set in the data though, or should it be set in the header, since
the method/header defines how the data should be interpreted? I know
that's just splitting hairs, but there was some concern about keeping
the api as clean as possible.


I think the whole point is to support minimal HTTP clients. If they  
don't
support PUT or DELETE, there's a good chance they don't support  
custom HTTP

headers either.




Re: Allow overridden request methods

2009-05-14 Thread Brian Candler
On Thu, May 14, 2009 at 07:23:50AM -0700, Mikeal Rogers wrote:
 Does anyone have an example of an HTTP client that doesn't support  
 changing or adding headers?

I was thinking of a web browser, with Javascript disabled, submitting a
FORM.

But the other point is right - you can have a FORM which POSTS to
_bulk_docs.


Re: Re: Allow overridden request methods

2009-05-14 Thread jared3d
Sorry guys, I'm really new to couchdb, but it seems like _bulk_docs is  
side-stepping the issue by using something in a way it wasn't really  
intended to be used. Shouldn't there be some fairly simple and decoupled  
way to set the proper request method if you are limited by your client? It  
seems easy to say if your client doesn't support a request method, simply  
POST the request and set the x-http-method-override header to the real  
request method you want to use. This way to don't have to change anything  
else in your process, you just have to add the appropriate header.


Thanks!
-Jared

On May 14, 2009 3:24pm, Brian Candler b.cand...@pobox.com wrote:

On Thu, May 14, 2009 at 07:23:50AM -0700, Mikeal Rogers wrote:



 Does anyone have an example of an HTTP client that doesn't support



 changing or adding headers?





I was thinking of a web browser, with Javascript disabled, submitting a



.





But the other point is right - you can have a FORM which POSTS to



_bulk_docs.




Re: Allow overridden request methods

2009-05-13 Thread Jan Lehnardt


On 13 May 2009, at 06:29, Jared Scheel wrote:


Hello all,
I recently looked into utilizing couchdb in a Flash application when I
came across a frustrating limitation: flash only allows GET and POST
methods. Apparently, this kind of limitation is more common that you
would expect in certain clients. Unfortunately, this makes using
couchdb rather difficult. Here's a great post about the problem:
http://www.mail-archive.com/sling-...@incubator.apache.org/msg00355.html 
.

What would be the possibility of allowing request methods to be
overridden with the X-HTTP-Method-Override header? This would allow
the request to be made with POST, but the method that couchdb receives
to be whatever value you attach to the X-HTTP-Method-Override header.


The upcoming update handlers (Jason? :) might be a good place to put  
this.


Cheers
Jan
--



Re: Allow overridden request methods

2009-05-13 Thread Jan Lehnardt


On 13 May 2009, at 18:43, Jared Scheel wrote:


Sorry for responding to my original message instead of a reply in the
thread, but I seem to be having some issues with the mailing list.
Oliver, you are right, I could use a javascript wrapper for flash. The
problem with that is that it introduces a second dependency to
interact with the REST interface.


It adds a second API and complexity to CouchDB to support
non-standard clients. I.e: If you don't speak HTTP, you can't
talk to CouchDB.



Sometimes you won't have access to
the javascript external interface with flash. Also, by adding support
for this header, it doesn't just benefit flash, but any client that is
restricted (Silverlight for example).


I'd rather not fix corporate bastardizations of open standards. If they
can't get their shit together, it's their fault that their customers  
suffer.



Cheers
Jan
--
Punkrock!



Thanks!
-Jared

On Tue, May 12, 2009 at 11:29 PM, Jared Scheel jare...@gmail.com  
wrote:

Hello all,
I recently looked into utilizing couchdb in a Flash application  
when I

came across a frustrating limitation: flash only allows GET and POST
methods. Apparently, this kind of limitation is more common that you
would expect in certain clients. Unfortunately, this makes using
couchdb rather difficult. Here's a great post about the problem:
http://www.mail-archive.com/sling-...@incubator.apache.org/msg00355.html 
.

What would be the possibility of allowing request methods to be
overridden with the X-HTTP-Method-Override header? This would allow
the request to be made with POST, but the method that couchdb  
receives

to be whatever value you attach to the X-HTTP-Method-Override header.

Thanks!
-Jared







Re: Allow overridden request methods

2009-05-13 Thread Mikeal Rogers


On May 13, 2009, at May 13, 20099:58 AM, Jan Lehnardt wrote:



On 13 May 2009, at 18:43, Jared Scheel wrote:


Sorry for responding to my original message instead of a reply in the
thread, but I seem to be having some issues with the mailing list.
Oliver, you are right, I could use a javascript wrapper for flash.  
The

problem with that is that it introduces a second dependency to
interact with the REST interface.


It adds a second API and complexity to CouchDB to support
non-standard clients. I.e: If you don't speak HTTP, you can't
talk to CouchDB.


In nearly every REST API I've written in the last 5 years I've checked  
for x-http-method-override and just changed the request method in the  
request before it hits the rest of the application logic.


Not too long ago, Safari didn't support PUT and everyone, especially  
Google, got on the x-http-method-override bandwagon. In fact, I  
believe all of their APIs still support x-http-method-override.


This silly limitation is a lot more common than you would think and  
it's usually done under some kind of security pretense. Sure, this  
particular time around it's Flash, which I certainly couldn't care  
less about, but I think as more clients start using CouchDB you're  
going to see this come up more and more.


I think it's unfair to characterize these clients as not supporting  
HTTP when in reality they support a sandboxed HTTP API which  
unnecessarily limits their usage.


-Mikeal


Re: Allow overridden request methods

2009-05-13 Thread Jared Scheel
Darn it, still not getting this thread from the list. Well, anyways, I
don't think it's adding any API complexity, it's just an override for
the request method, it would be completely transparent. Like Mikeal
said, you just have to check it once and change the request if an
override is present. Mikeal, I didn't know Safari had that limitation
in the past, that's wild!

-Jared

On Wed, May 13, 2009 at 11:43 AM, Jared Scheel jare...@gmail.com wrote:
 Sorry for responding to my original message instead of a reply in the
 thread, but I seem to be having some issues with the mailing list.
 Oliver, you are right, I could use a javascript wrapper for flash. The
 problem with that is that it introduces a second dependency to
 interact with the REST interface. Sometimes you won't have access to
 the javascript external interface with flash. Also, by adding support
 for this header, it doesn't just benefit flash, but any client that is
 restricted (Silverlight for example).

 Thanks!
 -Jared

 On Tue, May 12, 2009 at 11:29 PM, Jared Scheel jare...@gmail.com wrote:
 Hello all,
 I recently looked into utilizing couchdb in a Flash application when I
 came across a frustrating limitation: flash only allows GET and POST
 methods. Apparently, this kind of limitation is more common that you
 would expect in certain clients. Unfortunately, this makes using
 couchdb rather difficult. Here's a great post about the problem:
 http://www.mail-archive.com/sling-...@incubator.apache.org/msg00355.html.
 What would be the possibility of allowing request methods to be
 overridden with the X-HTTP-Method-Override header? This would allow
 the request to be made with POST, but the method that couchdb receives
 to be whatever value you attach to the X-HTTP-Method-Override header.

 Thanks!
 -Jared