Go Back   FlashFXP Forums > >

Programming Need help with C/C++/Delphi? Ask here and make us all laugh.

Closed Thread
 
Thread Tools Rate Thread Display Modes
Old 08-04-2005, 05:53 PM   #1
darkone
Disabled
FlashFXP Registered User
ioFTPD Administrator
 
darkone's Avatar
 
Join Date: Dec 2001
Posts: 2,230
Default I've gone mad

Seriously... I think I can not be considered to be sane anymore after writing single HEADER file for 4hours straight. Now I just need to write code to fill (and free) all those headers... uhh-huh Hopefully I have decent http service, that can handle PHPs, running within few days

Code:
typedef enum
{
	HTTP_VER_UNKNOWN	= 0,
    HTTP_VER_1_0,
	HTTP_VER_1_1

} HTTP_VER;

typedef enum
{
    HTTP_RC_CMD	= 0,
	HTTP_RC_FILENAME,
	HTTP_RC_ARGUMENTS,
	HTTP_RC_VERSION,
	HTTP_RC_END,
	HTTP_RC_CNT
};

typedef enum
{
	HTTP_CMD_UNKNOWN	= 0,
	HTTP_CMD_GET,
	HTTP_CMD_PUT,
	HTTP_CMD_POST,
	HTTP_CMD_HEAD,

} HTTP_CMD;

typedef enum
{
	HTTP_CONN_CLOSE			= 0,
	HTTP_CONN_KEEP_ALIVE
} HTTP_CONN;

typedef enum
{
	HTTP_CS_MEMORY	= 0,
	HTTP_CS_FILE

} HTTP_CONTENT_STORE;


typedef struct _HTTP_REQUEST_COMMAND
{
	LPSTR			szCommandLine;						/* original command line */
	PCHAR			pToken[HTTP_RC_CNT];				/* pointers to command line */
	LPWSTR			wszFilename;						/* filename on filesystem */
	HTTP_CMD		Command;							/* command in binary */
	HTTP_VER		Version;							/* version */

} HTTP_REQUEST_COMMAND, * LPHTTP_REQUEST_COMMAND;

typedef struct _HTTP_HEADER_LINE
{
	LPSTR						szVariable;		/* ???: variable of header*/
	LPSTR						szValue;		/* value of variable */
	struct _HTTP_HEADER_LINE	*lpNext;		/* pointer to next variable */
    
} HTTP_HEADER_LINE, *LPHTTP_HEADER_LINE;

typedef struct _HTTP_REQUEST_HEADER
{
	LPCSTR				szHostname;			/* hostname: */
	LPCSTR				szCookies;			/* cookies: */
	LPCSTR				szModified;			/* last-modified: */
	LPCSTR				szETag;				/* etag: */
	LPCSTR				szPragma;			/* pragma: */
	HTTP_CONN			ConnectionType;		/* connection: */
	UINT64				iContentLength;		/* content-length: */
	LPHTTP_HEADER_LINE	lpHeaderLineList;	/* all headers are stored here, do not free() any of above vars directly! */

} HTTP_REQUEST_HEADER, * LPHTTP_REQUEST_HEADER;

typedef struct _HTTP_REQUEST_CONTENT
{
	HTTP_CONTENT_STORE	StoreType;				/* memory/file */
	union {
		struct {
			PBYTE		pBuffer;				/* buffer */
		};
		struct {
			LPWSTR				wszFilename;	/* filename */
			LPUNIFIED_HANDLE	lpHandle;		/* file handle */
		};
	};

} HTTP_REQUEST_CONTENT, * LPHTTP_REQUEST_CONTENT;


typedef struct _HTTP_REPLY_COMMAND_RESPONSE
{
	HTTP_VER			Version;		/* http version */
	ULONG				lReplyCode;		/* http reply code */
	LPSTR				szReplyMessage;	/* http reply message */
    
} HTTP_REPLY_COMMAND_RESPONSE, * LPHTTP_REPLY_COMMAND_RESPONSE;

typedef struct _HTTP_REPLY_HEADER
{
	BUFFER				HeaderContent;	/* http reply header contents */

} HTTP_REPLY_HEADER;

typedef struct _HTTP_REPLY_CONTENT_DATA
{
	HTTP_CONTENT_STORE		StoreType;	/* memory/file */
	UINT64					iLength;	/* length of content */
	union {
		PBYTE				pBuffer;	/* source buffer */
		LPUNIFIED_HANDLE	lpHandle;	/* source stream handle */
	};

} HTTP_REPLY_CONTENT_DATA, * LPHTTP_REPLY_CONTENT_DATA;

typedef struct _HTTP_REPLY_CONTENT
{
	LPHTTP_REPLY_CONTENT_DATA	lpData;	/* http reply content */

} HTTP_REPLY_CONTENT, * LPHTTP_REPLY_CONTENT;

typedef struct _HTTP_REQUEST
{
	HTTP_REQUEST_COMMAND	Command;	/* Http request command */
	HTTP_REQUEST_HEADER		Header;		/* Http request header */
	HTTP_REQUEST_CONTENT	Content;	/* Http request content */

} HTTP_REQUEST, * LPHTTP_REQUEST;


typedef struct _HTTP_REPLY
{
	HTTP_REPLY_COMMAND_RESPONSE	Response;	/* Http command response */
	HTTP_REPLY_HEADER			Header;		/* Http reply header */
	HTTP_REPLY_CONTENT			Content;	/* Http reply content */

} HTTP_REPLY, * LPHTTP_REPLY;


typedef struct _HTTP_CONTEXT
{
	HTTP_REQUEST	Request;			/* Http-request content */
	HTTP_REPLY		Reply;				/* Http-reply content */

} HTTP_CONTEXT, * LPHTTP_CONTEXT;
darkone is offline  
Old 08-10-2005, 09:08 PM   #2
SnypeTEST
Senior Member
ioFTPD Scripter
 
Join Date: Feb 2003
Posts: 458
Default

if only header files gave head...
SnypeTEST is offline  
Old 08-11-2005, 12:30 AM   #3
tuff
Senior Member
FlashFXP Registered User
ioFTPD Scripter
 
Join Date: Jan 2003
Posts: 277
Default

seriously, you thing we didnt know you were mad years ago? :P
__________________
#iotools #ioftpd (both on efnet)
tuff is offline  
Old 12-04-2005, 05:37 AM   #4
Wrez
Junior Member
 
Wrez's Avatar
 
Join Date: Dec 2005
Posts: 26
Default

lol u ppl do too much coding
Wrez is offline  
Closed Thread

Tags
content, http, reply, struct, typedef

Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -5. The time now is 09:21 AM.

Parts of this site powered by vBulletin Mods & Addons from DragonByte Technologies Ltd. (Details)