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.
In yaws-1.64 (and in the current CVS tree), 'PUT' does not appear to
handle body content at all, although there is some apparently
incomplete code that hints at an intention to do so.
I'm new to yaws, but this seems like a clear bug to me, as compiling
yaws_server.erl gives the following warnings.
./yaws_server.erl:1220: Warning: variable 'PPS' is unused
./yaws_server.erl:1221: Warning: variable 'CT' is unused
The following patch seems to fix the problem for me. Please could
someone review/include it?
Many thanks,
Chris Newcombe
% 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) ->
|