Recent Posts
PAWN | 18 sec ago
Java | 21 sec ago
None | 32 sec ago
JavaScript | 38 sec ago
PHP | 59 sec ago
None | 1 min ago
None | 1 min ago
None | 1 min ago
None | 1 min ago
None | 1 min ago
Sitereport
Find cool info about any domain on the internet?
visit sitereport
Free Subdomains
Want a pastebin.com sub-domain for your community?
learn more...
What is pastebin?
Pastebin is a website that hosts all your text & code on dedicated servers for easy sharing.
learn more...
Learn a little bit about the new Pastebin.com on our help page. hide message
By pedro mg on the 18th of Nov 2007 04:09:32 AM Download | Raw | Embed | Report
  1. class Static < R '/static/(.+)'
  2.     MIME_TYPES = { '.css' => 'text/css', '.js' => 'text/javascript',
  3.                    '.jpg' => 'image/jpeg', '.png' => 'image/png' }
  4.     def get(file)
  5.       @headers['Content-Type'] = MIME_TYPES[file[('/\.\w+$/')]] || 'text/plain'
  6.       unless file.include?".."
  7.         @headers['X-Sendfile'] = "#{File.expand_path(File.dirname(__FILE__))}/static/#{file}"
  8.       else
  9.         @status = "403"
  10.         "403 - Path Not Found!"
  11.       end
  12.     end
Submit a correction or amendment below. Make A New Post
To highlight particular lines, prefix each line with @h@
Syntax highlighting:
Post expiration:
Post exposure:
Name / Title:
Email: