-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Ensure that requests ending with a slash and without try looking for …
…an index.html file. And prevent malicious directory traversing
- Loading branch information
Showing
5 changed files
with
35 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,15 @@ | ||
# Useful file methods | ||
class FileHandler | ||
def self.media_type(filename) | ||
extension = ::File.extname(filename) | ||
|
||
Rack::Mime.mime_type(extension) | ||
end | ||
|
||
def self.file_info(path) | ||
info = { | ||
:body => ::File.read(path), | ||
:time => ::File.mtime(path).httpdate | ||
body: ::File.read(path), | ||
time: ::File.mtime(path).httpdate | ||
} | ||
|
||
info | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Deep page |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters