Class: Gumdrop::Server

Inherits:
Sinatra::Base
  • Object
show all
Defined in:
lib/gumdrop/server.rb

Instance Method Summary collapse

Instance Method Details

#get_content_path(file_path, site) ⇒ Object



59
60
61
62
63
64
65
66
67
68
69
70
# File 'lib/gumdrop/server.rb', line 59

def get_content_path(file_path, site)
  keys= [
    file_path,
    "#{file_path}.html",
    "#{file_path}/index.html"
  ]
  if file_path == ""
    "index.html"
  else
    keys.detect {|k| site.node_tree.has_key?(k) }
  end
end

#handle_proxy(params, env) ⇒ Object



72
73
74
75
76
77
78
79
80
# File 'lib/gumdrop/server.rb', line 72

def handle_proxy(params, env)
  proxy_to= params[:splat][0]
  proxy_parts= proxy_to.split('/')
  host= proxy_parts.shift
  path_info= "/#{proxy_parts.join('/')}"
  #puts "HOST: #{host}  PATH_INFO: #{path_info}"
  opts={ :to=>host, :path_info=>path_info  }
  Gumdrop.handle_proxy opts, proxy_to, env
end