Browse files

Add support of the 'OPTIONS' method when WebDav is enabled

  • Loading branch information...
1 parent 05aa4f0 commit 8e0ac54ee5f4559a5d1ffa01ce1ce89bd919a60b @capflam capflam committed Jun 13, 2012
Showing with 7 additions and 3 deletions.
  1. +3 −3 src/yaws.erl
  2. +4 −0 src/yaws_server.erl
View
6 src/yaws.erl
@@ -1158,9 +1158,9 @@ make_allow_header(Options) ->
[] ->
HasDav = ?sc_has_dav(get(sc)),
["Allow: GET, POST, OPTIONS, HEAD",
- if HasDav == true -> ", PUT, PROPFIND, MKCOL, MOVE, COPY\r\n";
- true -> "\r\n"
- end];
+ if HasDav == true -> ", PUT, DELETE, PROPFIND, MKCOL, MOVE, COPY";
+ true -> ""
+ end, "\r\n"];
_ ->
["Allow: ",
lists:foldl(fun(M, "") -> atom_to_list(M);
View
4 src/yaws_server.erl
@@ -2296,6 +2296,8 @@ handle_ut(CliSock, ARG, UT = #urltype{type = dav}, N) ->
SC=get(sc),
Next =
if
+ Req#http_request.method == 'OPTIONS' ->
+ options;
Req#http_request.method == 'PUT' ->
fun(A) -> yaws_dav:put(SC, A) end;
Req#http_request.method == 'DELETE' ->
@@ -2322,6 +2324,8 @@ handle_ut(CliSock, ARG, UT = #urltype{type = dav}, N) ->
case Next of
error ->
handle_ut(CliSock, ARG, #urltype{type = error}, N);
+ options ->
+ deliver_options(CliSock, Req, []);
{regular, Finfo} ->
handle_ut(CliSock, ARG, UT#urltype{type = regular,
finfo = Finfo}, N);

0 comments on commit 8e0ac54

Please sign in to comment.