|
Server 0.0.1
HTTP/REST server implementation
|
00001 00023 #include <stdlib.h> 00024 #include <sys/types.h> 00025 #include <stdarg.h> 00026 00027 #include "class.h" 00028 #include "stream.h" 00029 00030 #include "http/parser.h" 00031 #include "http/message/queue.h" 00032 #include "http/request.h" 00033 #include "http/response.h" 00034 #include "cbuf.h" 00035 00036 #include "utils/memory.h" 00037 00038 00039 static 00040 int 00041 httpParserCtor(void * _this, va_list * params) 00042 { 00043 HttpParser this = _this; 00044 00045 this->buffer = va_arg(* params, Cbuf); 00046 00047 if (NULL == this->buffer) { 00048 return -1; 00049 } 00050 00051 this->queue = new(HttpMessageQueue); 00052 00053 return 0; 00054 } 00055 00056 static 00057 void 00058 httpParserDtor(void * _this) 00059 { 00060 HttpParser this = _this; 00061 00062 delete(this->queue); 00063 00064 if (TRUE == this->ourLock) 00065 cbufRelease(this->buffer); 00066 00067 FREE(this->incomplete); 00068 delete(this->current); 00069 } 00070 00071 INIT_IFACE(Class, httpParserCtor, httpParserDtor, NULL); 00072 INIT_IFACE(StreamReader, httpParserParse); 00073 CREATE_CLASS(HttpParser, NULL, IFACE(Class), IFACE(StreamReader)); 00074 00075 // vim: set ts=4 sw=4: