From hans.huebner at gmail.com Wed Jul 17 06:54:20 2013 From: hans.huebner at gmail.com (=?ISO-8859-1?Q?Hans_H=FCbner?=) Date: Wed, 17 Jul 2013 08:54:20 +0200 Subject: using PUT method with parameters In-Reply-To: References: Message-ID: Peter, I am unsure whether the change that you propose really solves the problem that you have. First off, it seems that DRAKMA restricts the use of file upload parameters to POST requests in the WHEN form that you pasted. I do not think that is the right thing, as the HTTP standard does not restrict the use of request bodies to specific methods. The only method that is specified to never have a request body is TRACE. Thus, I would change the condition to check for TRACE, instead of whitelisting PUT. But, and that is why I am not sure whether you are looking at the real problem, in request.lisp, the processing of file upload parameters is explicitly conditionalized to POST requests in the following form, so even if we changed the condition as you proposed, no file uploads would be processed for PUT requests. Before moving on with patches (which I am totally open to), I would like to know whether you really try to upload files in your PUT requests. If so, the change must be bigger to cover the following (and any additional) conditional that explicitly check for the POST method. I am currently on vacation, so any release will have to wait until the end of July. If you want to make it happen quickly then, please send a github pull request with the complete change and don't forget to check and possibly update the documentation. Thanks, -Hans Am 17.07.2013 08:19 schrieb "Peter Wood" : > Hi > > Using Drakma-1.3.2 (via quicklisp) and Sbcl-1.1.9 on Linux (Debian Wheezy): > > I believe it is allowed to send parameters with a PUT request, just as > with a POST request, but Drakma only allows POST with parameters. > > In request.lisp, changing this > > (when (and file-parameters-p (not (eq method :post))) > (parameter-error "Don't know how to handle parameters in ~S, as this is > not a POST request." > > To this > > (when (and file-parameters-p (not (member method '(:post :put)))) > (parameter-error "Don't know how to handle parameters in ~S, as this is > not a POST or PUT request." > > Allows PUT parameters. > > I need this change for drakma to work with an common lisp interface to the > paymill payment service api: https://www.paymill.com/ > I would like to release the the paymill-api, but if Drakma won't let me > use parameters in a put request, I will have to ship a forked version of it > with the api. > > Regards > Peter > > (ps. Just to be clear: I'm not talking about form-data - that IS only > allowed with POST.) > > > > > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From pete_wood at runbox.com Wed Jul 17 06:16:44 2013 From: pete_wood at runbox.com (Peter Wood) Date: Wed, 17 Jul 2013 08:16:44 +0200 (CEST) Subject: using PUT method with parameters Message-ID: Hi Using Drakma-1.3.2 (via quicklisp) and Sbcl-1.1.9 on Linux (Debian Wheezy): I believe it is allowed to send parameters with a PUT request, just as with a POST request, but Drakma only allows POST with parameters. In request.lisp, changing this (when (and file-parameters-p (not (eq method :post))) (parameter-error "Don't know how to handle parameters in ~S, as this is not a POST request." To this (when (and file-parameters-p (not (member method '(:post :put)))) (parameter-error "Don't know how to handle parameters in ~S, as this is not a POST or PUT request." Allows PUT parameters. I need this change for drakma to work with an common lisp interface to the paymill payment service api: https://www.paymill.com/ I would like to release the the paymill-api, but if Drakma won't let me use parameters in a put request, I will have to ship a forked version of it with the api. Regards Peter (ps. Just to be clear: I'm not talking about form-data - that IS only allowed with POST.) From edi at agharta.de Wed Jul 17 08:42:36 2013 From: edi at agharta.de (Edi Weitz) Date: Wed, 17 Jul 2013 10:42:36 +0200 Subject: using PUT method with parameters In-Reply-To: References: Message-ID: I'm also on vacation, so just a quick response: On Wed, Jul 17, 2013 at 8:54 AM, Hans H?bner wrote: > First off, it seems that DRAKMA restricts the use of file upload parameters > to POST requests in the WHEN form that you pasted. I do not think that is > the right thing, as the HTTP standard does not restrict the use of request > bodies to specific methods. I think you're mixing up two things - request bodies and parameters. Drakma doesn't disallow request bodies - that's what CONTENT is for. But Drakma simply doesn't know what to do with file parameters if you're not sending a POST request as they only make sense with form data. I don't think the patch is useful. Peter, why are you not using :CONTENT? Cheers, Edi. From pete_wood at runbox.com Wed Jul 17 14:39:56 2013 From: pete_wood at runbox.com (Peter Wood) Date: Wed, 17 Jul 2013 16:39:56 +0200 (CEST) Subject: using PUT method with parameters In-Reply-To: Message-ID: On Wed, 17 Jul 2013 10:42:36 +0200, Edi Weitz wrote: > > Peter, why are you not using :CONTENT? > Because I had not read the documentation carefully enough. :content works fine for what I need to do. Thanks. > Cheers, > Edi. Regards, Peter From hans.huebner at gmail.com Wed Jul 17 08:50:15 2013 From: hans.huebner at gmail.com (=?ISO-8859-1?Q?Hans_H=FCbner?=) Date: Wed, 17 Jul 2013 10:50:15 +0200 Subject: using PUT method with parameters In-Reply-To: References: Message-ID: Hi Edi, while file uploads only make sense with form data, I could see how one would encounter an API that uses PUT with form data. I have not seen such an API myself, but I see no reason not to support such APIs. Do you? -Hans Am 17.07.2013 10:42 schrieb "Edi Weitz" : > I'm also on vacation, so just a quick response: > > On Wed, Jul 17, 2013 at 8:54 AM, Hans H?bner > wrote: > > First off, it seems that DRAKMA restricts the use of file upload > parameters > > to POST requests in the WHEN form that you pasted. I do not think that > is > > the right thing, as the HTTP standard does not restrict the use of > request > > bodies to specific methods. > > I think you're mixing up two things - request bodies and parameters. > Drakma doesn't disallow request bodies - that's what CONTENT is for. > But Drakma simply doesn't know what to do with file parameters if > you're not sending a POST request as they only make sense with form > data. > > I don't think the patch is useful. > > Peter, why are you not using :CONTENT? > > Cheers, > Edi. > -------------- next part -------------- An HTML attachment was scrubbed... URL: From edi at agharta.de Wed Jul 17 14:00:35 2013 From: edi at agharta.de (Edi Weitz) Date: Wed, 17 Jul 2013 16:00:35 +0200 Subject: using PUT method with parameters In-Reply-To: References: Message-ID: RFC 2616 says that 'the "multipart/form-data" type has been specifically defined for carrying form data suitable for processing via the POST request method,' so I don't think there's an immediate need to support this content type for other request methods. I'd say we should cross this bridge when we come to it - or rather let those who need it build it... :) On Wed, Jul 17, 2013 at 10:50 AM, Hans H?bner wrote: > Hi Edi, > > while file uploads only make sense with form data, I could see how one would > encounter an API that uses PUT with form data. I have not seen such an API > myself, but I see no reason not to support such APIs. Do you? > > -Hans > > Am 17.07.2013 10:42 schrieb "Edi Weitz" : > >> I'm also on vacation, so just a quick response: >> >> On Wed, Jul 17, 2013 at 8:54 AM, Hans H?bner >> wrote: >> > First off, it seems that DRAKMA restricts the use of file upload >> > parameters >> > to POST requests in the WHEN form that you pasted. I do not think that >> > is >> > the right thing, as the HTTP standard does not restrict the use of >> > request >> > bodies to specific methods. >> >> I think you're mixing up two things - request bodies and parameters. >> Drakma doesn't disallow request bodies - that's what CONTENT is for. >> But Drakma simply doesn't know what to do with file parameters if >> you're not sending a POST request as they only make sense with form >> data. >> >> I don't think the patch is useful. >> >> Peter, why are you not using :CONTENT? >> >> Cheers, >> Edi.