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
#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

About the Author

David Hubbard

United States United States
No Biography provided

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