using PUT method with parameters
Hans Hübner
hans.huebner at gmail.com
Wed Jul 17 06:54:20 UTC 2013
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" <pete_wood at runbox.com>:
> 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: <https://mailman.common-lisp.net/pipermail/drakma-devel/attachments/20130717/249f7eb6/attachment.html>
More information about the Drakma-devel
mailing list