- new helper functions ext2MIMEType(), filename2MIMEType()

- 02_HTTPSRV also serves files from subdirectories
- 02_HTTPSRV sends MIME types

git-svn-id: https://fhem.svn.sourceforge.net/svnroot/fhem/trunk/fhem@1825 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
borisneubert
2012-09-01 17:09:33 +00:00
parent 8babd00c87
commit 4bfd85aa05
3 changed files with 34 additions and 11 deletions

View File

@@ -6,6 +6,34 @@ use strict;
use warnings;
use IO::Socket::INET;
my %ext2MIMEType= qw{
txt text/plain
html text/html
pdf application/pdf
css text/css
jpg image/jpeg
png image/png
gif image/gif
ico image/x-icon
};
my $KNOWNEXTENSIONS= 'txt|html|pdf|css|jpg|png|gif|ico';
sub
ext2MIMEType($) {
my ($ext)= @_;
my $MIMEType= $ext ? $ext2MIMEType{$ext} : "";
return $MIMEType ? $MIMEType : "";
}
sub
filename2MIMEType($) {
my ($filename)= @_;
$filename =~ m/^(.*)\.($KNOWNEXTENSIONS)$/;
return ext2MIMEType($2);
}
##################
sub
urlEncode($) {