[drakma-devel] Supported HTTP methods

Edi Weitz edi at agharta.de
Wed Sep 6 19:17:59 UTC 2006


Hi Ralf!

On Wed, 06 Sep 2006 16:41:35 +0200, Ralf Mattes <rm at seid-online.de> wrote:

> first, to Edi: thanks for such a nice library!

You're welcome... :)

> I just stumbled across an error in the http-request function:
>  
> DRAKMA-USER <- (http-request "http://www.zeit.de" :method :trace)
>
> Don't know how to handle method :TRACE.
>    [Condition of type SIMPLE-ERROR]
>
> Restarts:
>   0: [ABORT-REQUEST] Abort handling SLIME request.
>   1: [TERMINATE-THREAD] Terminate this thread (#<THREAD
> "repl-thread" {AC7D291}>)
>
> triggered by this code in request.lisp:
>
>  (unless (member method '(:get :head :post :put) :test #'eq)
>     (error "Don't know how to handle method ~S." method))
>
> shouldn't the library allow all methods from HTTP/1.1?

It's OK with me, I just didn't need them until now.

> Changing the code into:
>
>   (unless (member method
> '(:get :head :post :put :delete :options :trace) :test #'eq)
>     (error "Don't know how to handle method ~S." method))
>
> fixes this bugglet. BTW, it might be a good idea to add the methods
> needed for WebDAV as well -- at least there seems to be no reason
> for not adding them. Some of them would need to be added to case
> dispatch on method that sets the request contents (request.lisp,
> line 344 ff.).
>
> One more remark about the 'OPTIONS' method. The standard introduces
> a 'magic' request URI to query server options (as opposed to options
> for a particular resource) - the request line should look like this:
>
>  OPTIONS * HTTP/1.1
>  Host: my.cool.server
>
> I couldn't find a way to have puri:parse-uri generate a uri whose
> uri-path is "*" so i modified http-request to accept an method
> :options* (see attached patch).

The patch is OK as far as I can see, but as with 99% of the patches I
get, the patch for the doc strings and the documentation is missing.
Adding half a dozen lines of code is the easy part... :)

I'll add that if I find the time, but probably not today.

Thanks,
Edi.



More information about the Drakma-devel mailing list