From: Claes W. <kl...@ta...> - 2006-09-10 21:35:53
|
Chris Newcombe wrote: > I'm using Yaws to implement a REST API for a service (i.e. an appmod). > The API must accept data via the body of a 'PUT' method. > ok > In yaws-1.64 (and in the current CVS tree), 'PUT' does not appear to > handle body content at all, Well PUT isn't used, For a normal webserver PUT doesn't make sense. > The following patch seems to fix the problem for me. Please could > someone review/include it? The fix just removes the call to handle_request(). It also breaks the almost working DAV implementation by Tobbe Tornquist and Martin Bjorklund. DAV use both of the PUT and DELETE methods. > > % diff -C 3 yaws_server.erl-before yaws_server.erl > *** yaws_server.erl-before 2006-09-10 07:53:18.000000000 -0700 > --- yaws_server.erl 2006-09-10 07:54:04.000000000 -0700 > *************** > *** 1217,1230 **** > ?format_record(Head, headers)]), > SC=get(sc), > ok = yaws:setopts(CliSock, [{packet, raw}, binary], is_ssl(SC#sconf.ssl)), > ! PPS = SC#sconf.partial_post_size, > ! CT = > ! case yaws:lowercase(Head#headers.content_type) of > ! "multipart/form-data"++_ -> multipart; > ! _ -> urlencoded > ! end, > ! ARG = make_arg(CliSock, Head, Req, undefined), > ! handle_request(CliSock, ARG, p). > > > 'DELETE'(CliSock, Req, Head) -> > --- 1217,1223 ---- > ?format_record(Head, headers)]), > SC=get(sc), > ok = yaws:setopts(CliSock, [{packet, raw}, binary], is_ssl(SC#sconf.ssl)), > ! body_method(CliSock, Req, Head). > > > 'DELETE'(CliSock, Req, Head) -> So sorry, can't take it. A proper fix has to do more..... /klacke -- Claes Wikstrom -- Caps lock is nowhere and http://www.tail-f.com -- everything is under control cellphone: +46 70 2097763 |