# File lib/puppet/file_serving/indirection_hooks.rb, line 15
15:   def select_terminus(request)
16:     # We rely on the request's parsing of the URI.
17: 
18:     # Short-circuit to :file if it's a fully-qualified path or specifies a 'file' protocol.
19:     return PROTOCOL_MAP["file"] if request.key =~ /^#{::File::SEPARATOR}/
20:     return PROTOCOL_MAP["file"] if request.protocol == "file"
21: 
22:     # We're heading over the wire the protocol is 'puppet' and we've got a server name or we're not named 'apply' or 'puppet'
23:     if request.protocol == "puppet" and (request.server or !["puppet","apply"].include?(Puppet.settings[:name]))
24:       return PROTOCOL_MAP["puppet"]
25:     end
26: 
27:     if request.protocol and PROTOCOL_MAP[request.protocol].nil?
28:       raise(ArgumentError, "URI protocol '#{request.protocol}' is not currently supported for file serving")
29:     end
30: 
31:     # If we're still here, we're using the file_server or modules.
32:     :file_server
33:   end