Permalink
Browse files

force webrick to return text/html mime type for urls without extensio…

  • Loading branch information...
1 parent 31d395e commit 85a5b66212e81c025440b622798f3337bba30be7 @darwin committed Sep 20, 2010
Showing with 14 additions and 0 deletions.
  1. +14 −0 bin/jekyll
View
@@ -163,6 +163,20 @@ if options['server']
require 'webrick'
include WEBrick
+ # force webrick to return text/html mime type for urls without extensions (if not told otherwise)
+ module WEBrick
+ module HTTPUtils
+ alias_method :original_mime_type, :mime_type
+ module_function :original_mime_type
+ def mime_type(filename, mime_tab)
+ mime = original_mime_type(filename, mime_tab)
+ return "text/html" if mime == "application/octet-stream" and File.extname(filename)==""
+ mime
+ end
+ module_function :mime_type
+ end
+ end
+
FileUtils.mkdir_p(destination)
unless options['mime']

0 comments on commit 85a5b66

Please sign in to comment.