Server 0.0.1
HTTP/REST server implementation

src/http/parser/new_message.c

Go to the documentation of this file.
00001 
00023 #include "http/parser.h"
00024 
00025 #include "utils/http.h"
00026 
00027 void
00028 httpParserNewMessage(
00029                 HttpParser   this,
00030                 const char * line,
00031                 const char * lend)
00032 {
00033         const char * part1, * part2, * part3;
00034         size_t       len1, len2, len3;
00035 
00036         part1 = line;
00037         part2 = memchr(line, ' ', lend - line);
00038 
00039         if (NULL == part2) return;
00040 
00041         len1 = part2 - part1;
00042         for (; *part2 == ' ' && *part2 != 0; part2++);
00043 
00044         part3 = memchr(part2, ' ', lend - part2);
00045 
00046         if (NULL == part3) return;
00047 
00048         len2 = part3 - part2;
00049         for (; *part3 == ' ' && *part3 != 0; part3++);
00050 
00051         len3 = lend - part3;
00052 
00053         this->current = httpGetMessage(part1, len1, part2, len2, part3, len3);
00054 }
00055 
00056 // vim: set ts=4 sw=4:
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Defines