CS Source WebServer

CS Source WebServer (internally known as SourceWeb) is a HalfLife 2 Server plugin (specifically for CounterStrike Source) which runs a simple multithreaded HTTP web server under your SRCDS process.

It is optimized to ensure it does not take CPU power away from SRCDS and adds very little overhead to your server. You have the ability to restrict bandwidth to each connection and use the server to supply HTTP based source content (maps etc).

As of version 2, it also supports limited serverside scripting. By limited, I mean that is is right now restricted to PERL and PHP support. It is for example quite capable of running PHPBB3 which means you could, if you wanted to, host a WEB forum under SRCDS!

Download:

Download CS Source WebServer v2.0.0   (Mirror)

ActivePerl (For PERL CGI Support)
PHP (For PHP CGI Support)

Installation:

Unpack the zip file to your server folder (for example \CStrike)
Edit the server configuration to load the plugin in the normal way.

Don't forget you have to tell SRCDS to load the plugin I do this by editing Valve.rc and adding the following text to the file: plugin_load ..\cstrike\addons\SourceWeb

Add the following CVARS to your autoexec or server config file:

CVAR Value Description
sw_address http://myserver:myport Physical address of the web server
sw_kpersecond number Limit in KB/Sec for each HTTP connection
sw_basewebpath ".\SourceWeb" Folder (relative to the CStrike folder for the ROOT web folder
sw_webport number Port to run the web server on (default is CS Server port + 25)
sw_allowfolderbrowse 0 or 1 Allow clients to browse folders where there is no default HTML file
sw_log 0, 1, 2 Set the log level: 0 = none, 1 = error, 2 = all
sw_showteams 0 or 1 Show or hide the team column in the player list (Overrides the default which is based on the detected gametype)
sw_team1text "spectator" The text to show for Team 1 (spectators in CSS)
sw_team2text "terrorist" The text to show for Team 2 (T's in CSS)
sw_team3text "counter terrorist" The text to show for Team 3 (CT's in CSS)
sw_defaulthtmlfile "<filename.htm>"

The default filename to open on the web server (if no file is specified in the URL).
If blank or invalid, it looks for "default.htm, default.html, index.htm, index.html" as before.

Although the server is intended as a basic HTML provider (it does NOT support server side scripting such as ASP/PHP/Perl etc) there are some special html tags which can be inserted into the HTML code which are decoded server side before the content is delivered to the client.

In general, you can place a value from SourceWeb or the server by using the <SOURCEWEB> tag. The valid tags are as follows:

TAG Description
<SOURCEWEB cvar [variable]> Display any server CVAR, for example: <SOURCEWEB cvar hostname>
<SOURCEWEB uptime> Display server uptime
<SOURCEWEB playercount> Display number of players on server
<SOURCEWEB currentmap> Display the current map being played
<SOURCEWEB nextmap> Display the next map (in the mapcycle)
<SOURCEWEB timeleft> Display the time left on the current map
<SOURCEWEB playerlist align=center width=75% cellSpacing=1 cellpadding=1 border=1> Inserts a list of players, as a table using the table properties in the tag.

You can also add an image or link based on the SOURCEWEB tags, but in this instance, instead of using <> you should enclose the value in % %'s

For example: To add an image of the current map: <img src="mappics/%SOURCEWEB currentmap%.jpg>


CSS Style sheets:

As of version 1.9, extra player list CSS styles have been added. See the four styles in styles.css.
Obviously you can modify these to change the way the table looks.

These allow you to change the row styles in the player list table. If they do not exist, you may be in trouble or it may just not set the style like before (I didnt check!).

 

Multi-homed Servers (Multiple IP's):

As of version 1.9.5, CS Source WebServer supports multi-homed SRCDS servers. That is, if you have multiple IP addresses on your server and run multiple SRCDS servers on the same port but different IP's, CS Source WebServer will now pay attention to the IP that SCRDS is using and only listen on that IP (rather than all of them).

This effectivly means you can leave SRCDS running on the default port (SRCDS port +25) and each SRCDS instance will host CS Source WebServer which will listen for incomming connections ONLY on the IP that SRCDS is listening for games on.


Configuring CSS to download via HTTP:

Edit your server config and use the following CVARS

sw_address <web server address:port>
sw_basewebpath <folder where the content is stored (relative to WWW root path>

And copy all your custom maps and resources to the specified folder

 

Configuring CGI Scripting:

In version 2 (the first to support CGI) you do not need to do much to configure CGI. Simply install ActivePerl or PHP (or both) and CS Source WebServer should pickup the location of the CGI processors and make use of them for .pl and .php script files respectivly.
In future versions, I will add the ability to specify your own CGI handlers for each file type that you want to process.

 

CS Source WebServer is copyright (c) 2005-2008 Highresolution Enterprises.
Thanks to Ryan Hoyt for updated CSSource map images and help with testing CS Source WebServer.
For support/suggestions register and post (or leave me a PM) on my
forums