Click here to Skip to main content
Click here to Skip to main content
Add your own
alternative version

STL WebServer

, 8 May 2000
A set of classes written in STL that implement a web server
#if !defined(HttpServerInfo_H)
#define HttpServerInfo_H

#include "HttpRequest.h"
#include "HttpServerStats.h"
#include "HttpUtil.h"

#include <string>
using namespace std;

///////////////////////////////////////////////////////////////////////////////////////
// HttpServerInfo
//
// Purpose:		http server information


class HttpServerInfo :
	public HttpServerStats
{
protected:

	string					_strTitleBase;
	string					_strRoot;
	string					_strServer;
	TimeStamp				_timeStarted;
	long					_port;
	int						_server;
	bool					_bListIcon;
	bool					_bAllowListing;

public:

	HttpServerInfo ( long port = PORT_HTTP );
	virtual ~HttpServerInfo ();

	// create/release resources
	bool create		( string & server, string & directory );
	void release	();

	// access methods
	string & getTitleBase ()
	{
		return _strTitleBase;
	}

	string	getRoot ()
	{
		return _strRoot;
	}

	string getServer ()
	{
		return _strServer;
	}


	TimeStamp & getTimeStarted ()
	{
		return _timeStarted;
	}

	long getPort ()
	{
		return _port;
	}

	int	getServerIndex ()
	{
		return _server;
	}

	bool getListIcon ()
	{
		return _bListIcon;
	}

	bool getAllowListing ()
	{
		return _bAllowListing;
	}

	// utility methods
	bool	urlToPath		( string & strFile );
	bool	pathToUrl		( string & strFile );
	string	stripLast		( string & strPath );
	bool	find			( HttpRequest & request, string & strFile );
	bool	checkDefault	( HttpRequest & request, LPTSTR uList, bool bExecute );
	bool	isSeverApp		( HttpRequest & request );
	bool	checkExt		( HttpRequest & request, 
		                      const string & strExt, string & strAvail, 
							  DWORD dwType );



	// operators
	void operator = ( const HttpServerInfo & info )
	{
		_strTitleBase = info._strTitleBase;
		_strRoot = info._strRoot;
		_strServer = info._strServer;
		_timeStarted = info._timeStarted;
		_port = info._port;
		_server = info._server;
		_bListIcon = info._bListIcon;
		_bAllowListing = info._bAllowListing;
	}

};


#endif

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here

Share

About the Author

David Hubbard

United States United States
No Biography provided

| Advertise | Privacy | Mobile
Web02 | 2.8.140821.2 | Last Updated 9 May 2000
Article Copyright 2000 by David Hubbard
Everything else Copyright © CodeProject, 1999-2014
Terms of Service
Layout: fixed | fluid