# 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 'puppet'
23:         if request.protocol == "puppet" and (request.server or Puppet.settings[:name] != "puppet")
24:             return PROTOCOL_MAP["puppet"]
25:         end
26: 
27:         if request.protocol and PROTOCOL_MAP[request.protocol].nil?
28:             raise(ArgumentError, "URI protocol '%s' is not currently supported for file serving" % request.protocol)
29:         end
30: 
31:         # If we're still here, we're using the file_server or modules.
32:         return :file_server
33:     end