[drakma-devel] Supported HTTP methods

Ralf Mattes rm at seid-online.de
Wed Sep 6 14:41:35 UTC 2006


Hello list,

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

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?

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).

Cheers, Ralf Mattes

 
 

-------------- next part --------------
A non-text attachment was scrubbed...
Name: request.patch
Type: text/x-patch
Size: 1194 bytes
Desc: not available
URL: <https://mailman.common-lisp.net/pipermail/drakma-devel/attachments/20060906/80f964e2/attachment.bin>


More information about the Drakma-devel mailing list