Click here to Skip to main content
15,885,760 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 89.9K   2.5K   47  
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


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