fix for someone sending weird URI requests periodically

This commit is contained in:
Kyle Drake 2014-12-25 19:43:23 -06:00
parent 75a8975941
commit fa6158ba02

View file

@ -8,5 +8,15 @@ end
get '/blog/:article' do |article| get '/blog/:article' do |article|
expires 500, :public, :must_revalidate expires 500, :public, :must_revalidate
attempted = false
begin
return Net::HTTP.get_response(URI("http://blog.neocities.org/#{article}.html")).body return Net::HTTP.get_response(URI("http://blog.neocities.org/#{article}.html")).body
rescue => e
raise e if attempted
attempted = true
article = article.match(/^[a-zA-Z0-9-]+/).to_s
retry
end
end end