Class: Calligraphy::Rails::WebDavRequestsController

Inherits:
ActionController::Base
  • Object
show all
Defined in:
lib/calligraphy/rails/web_dav_requests_controller.rb

Instance Method Summary collapse

Instance Method Details

#invoke_methodObject

Entry-point for all WebDAV requests. Handles checking and validating preconditions, directing of requests to the proper WebDAV action method, and composing responses to send back to the client.



10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/calligraphy/rails/web_dav_requests_controller.rb', line 10

def invoke_method
  method = request.request_method.downcase

  if check_preconditions
    if method == 'head'
      status = get head: true
    elsif Calligraphy.allowed_http_methods.include? method
      set_resource_client_nonce(method) if Calligraphy.enable_digest_authentication

      status, body = send method
    else
      status = :method_not_allowed
    end

    send_response status: status, body: body
  else
    send_response status: :precondition_failed
  end
end