Server 0.0.1
HTTP/REST server implementation

src/http/parser/p_body.c

Go to the documentation of this file.
00001 
00023 #include <stdlib.h>
00024 #include <sys/types.h>
00025 
00026 #include "http/header.h"
00027 #include "http/message.h"
00028 #include "http/parser.h"
00029 #include "cbuf.h"
00030 
00031 #include "commons.h"
00032 
00033 size_t
00034 httpParserBody(HttpParser this, const char * buf, size_t nbuf)
00035 {
00036         size_t      len     = 0;
00037         HttpMessage current = this->current;
00038 
00039         if (current->dbody < current->nbody) {
00040                 len = MIN(current->nbody - current->dbody, nbuf);
00041 
00042                 memcpy(current->body, buf, len);
00043 
00044                 current->dbody += len;
00045         }
00046 
00047         return len;
00048 }
00049 
00050 // vim: set ts=4 sw=4:
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Defines