Click here to Skip to main content
15,896,269 members
Articles / Desktop Programming / MFC

STL WebServer

Rate me:
Please Sign up or sign in to vote.
4.89/5 (5 votes)
8 May 2000 90.3K   2.5K   47  
A set of classes written in STL that implement a web server
#include "stdafx.h"
#include "HttpRequest.h"

//////////////////////////////////////////////////////////////////////////////////
// HttpRequest

HttpRequest::HttpRequest ( string & version ) :
	HttpBuffer(),
	
	_version(version),
	_headers()

{
	create();	
}


HttpRequest::~HttpRequest ()
{
	release();
}


// create/release

bool HttpRequest::create ()
{
	// create buffer
	HttpBuffer::create();

	// set defaults
	_url = "";
	_path = "";
	_pathInfo = "";
	_pathTranslated = "";
	_method = "";
	_args = "";
	_host = "";
	_version = "1.0";
	_execute = idAppNoExecute;
	_status = idHttpOk;
	_attributes = 0;
	_processState = REQ_DONE;
	_headers.clear();
	_length = 0;
	
	return true;
}


bool HttpRequest::create ( long request, string & file )
{
	addMethod( request, file );

	return true;
}





void HttpRequest::release ()
{
	// release buffer
	HttpBuffer::release();

	// release resources
	_url.erase();
	_path.erase();
	_pathInfo.erase();
	_pathTranslated.erase();
	_method.erase();
	_args.erase();
	_host.erase();
	_version.erase();
	_execute = idAppNoExecute;
	_status = idHttpOk;
	_attributes = 0;
	_processState = REQ_DONE;
	_headers.clear();
	_length = 0;
}


// operators
void HttpRequest::operator = ( const HttpRequest & request )
{
	// get request state except for
	// its contents
	_url = request._url;
	_path = request._path;
	_pathInfo = request._pathInfo;
	_pathTranslated = request._pathTranslated;
	_method = request._method;
	_args = request._args;
	_host = request._host;
	_version = request._version;
	_execute = request._execute;
	_status = request._status;
	_attributes = request._attributes;
	_processState = request._processState;
	_length = 0;

}

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


Written By
United States United States
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions