An xmlrpc test project
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

50 lines
1.1 KiB

#ifndef __HTTP_REQUEST_H__
#define __HTTP_REQUEST_H__
#define HTTP_REQ_OPTIONS 0
#define HTTP_REQ_GET 1
#define HTTP_REQ_HEAD 2
#define HTTP_REQ_POST 3
#define HTTP_REQ_PUT 4
#define HTTP_REQ_DELETE 5
#define HTTP_REQ_TRACE 6
#define HTTP_REQ_CONNECT 7
extern char httpRequest[8][8];
typedef struct {
char * method;
char * requestUri;
char * httpVersion;
} tRequestLine;
typedef struct {
char * key;
char * value;
} tHttpHeaderLine;
typedef struct {
tRequestLine req;
tHttpHeaderLine * headers;
unsigned int headersCount;
unsigned char bodyLength;
} tHttpHeader;
typedef struct {
tHttpHeader header;
unsigned int length;
char * body;
} tHttpRequest;
int getHttpRequest(char **, unsigned int *, tHttpRequest *);
void freeHttpRequest(tHttpRequest *);
void freeHttpHeader(tHttpHeader *);
unsigned char httpHeaderIsStarted(tHttpHeader *);
int httpHeaderIsComplete(tHttpHeader *);
int httpHeaderGet(char **, unsigned int *, tHttpHeader *);
void httpHeaderParseRequestLine(tHttpHeader *, const char *, unsigned int);
#endif // __HTTP_REQUEST_H__