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(HttpRequestProcess_H)
#define HttpRequestProcess_H

#include "HttpRequest.h"
#include "HttpResponse.h"

#include <string>
using namespace std;

class HttpRequestProcess
{
	HttpRequest		_request;				// stores processed request info
	HttpResponse	_resp;
	long			_processState;			// state of processing 
	string			_buffer;				// buffer to process
	long			_length;				// length of buffer
	string			_line;					// current process line

public:

	HttpRequestProcess ();
	HttpRequestProcess ( LPTSTR buffer, long length );

	virtual ~HttpRequestProcess ();

	// create/release methods
	bool create  ( LPTSTR buffer, long length );
	void release ();

	// methods
	bool process		( LPTSTR buffer, long length );
	bool process		();
	bool getLine		( int & index );
	void processLine	();
	void addToBody		( int nBytes, int index );
	bool bodySent		();

	// access methods for http buffer
	HttpResponse & getResponse ()
	{
		return _resp;
	}

	string getBody ()
	{
		return _resp.getBody();
	}

	void getString ( string & set )
	{
		_resp.getString(set);
	}

	LPTSTR data ()
	{
		return (LPTSTR) _resp.c_str();
	}

	LPCTSTR c_str () 
	{
		return _resp.c_str();
	}

	long size ()
	{
		return _resp.size();
	}


};

#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

About the Author

David Hubbard

United States United States
No Biography provided

| Advertise | Privacy | Mobile
Web02 | 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