Skip to content

Commit

Permalink
Add new default mimetypes for png, js and ico to the internal webserv…
Browse files Browse the repository at this point in the history
…er. Also allows file names with hyphen (-) on them (#378)
  • Loading branch information
frozenblit committed Feb 27, 2021
1 parent 7337874 commit fdafb11
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 1 deletion.
2 changes: 2 additions & 0 deletions docs/docs.polserver.com/pol100/corechanges.xml
Expand Up @@ -8,6 +8,8 @@
<entry>
<date>02-27-2021</date>
<author>Nando:</author>
<change type="Added">Default mimetypes for .png, .js and .ico in the internal webserver</change>
<change type="Added">Allow URLs/filenames with a hyphen (-) in the internal webserver</change>
<change type="Fixed">Crash in SendPacket(), packet.SendPacket() and DisconnectClient() when the client was not yet logged in. Mostly affects packet hooks.</change>
</entry>
<entry>
Expand Down
2 changes: 2 additions & 0 deletions pol-core/doc/core-changes.txt
@@ -1,5 +1,7 @@
-- POL100 --
02-27-2021 Nando:
Added: Default mimetypes for .png, .js and .ico in the internal webserver
Added: Allow URLs/filenames with a hyphen (-) in the internal webserver
Fixed: Crash in SendPacket(), packet.SendPacket() and DisconnectClient() when the client was not yet logged in. Mostly affects packet hooks.
02-27-2021 Turley, Kevin:
Added: os::GetEnvironmentVariable(name:="")
Expand Down
5 changes: 4 additions & 1 deletion pol-core/pol/polwww.cpp
Expand Up @@ -80,6 +80,9 @@ void load_mime_config( void )
gamestate.mime_types["jpg"] = "image/jpeg";
gamestate.mime_types["jpeg"] = "image/jpeg";
gamestate.mime_types["gif"] = "image/gif";
gamestate.mime_types["png"] = "image/png";
gamestate.mime_types["js"] = "text/javascript";
gamestate.mime_types["ico"] = "image/x-icon";
return;
}

Expand Down Expand Up @@ -312,7 +315,7 @@ bool legal_pagename( const std::string& page )
for ( const char* t = page.c_str(); *t; ++t )
{
char ch = *t;
if ( isalnum( ch ) || ( ch == '/' ) || ( ch == '_' ) )
if ( isalnum( ch ) || ( ch == '/' ) || ( ch == '_' ) || (ch == '-') )
{
continue;
}
Expand Down

0 comments on commit fdafb11

Please sign in to comment.