HttpResponseParser/http_response_parser.h
int http_parse_response_body(HttpResponse_t *h,char *request)
{
    int maxsize = 4096,in = 0,pos;
    char *buffer = (char*)calloc(maxsize,sizeof(char));

    if (buffer == NULL)
        return (0);

    pos = strpos(request,"\r\n\r\n",0);
    pos += 4;

    while (request[pos] != '\0')
    {
        if (in>=maxsize){
            maxsize += 512;
            buffer = (char*)realloc(buffer,sizeof(char) * maxsize);
            
            if (buffer == NULL)
                return (0);
        }
        
        buffer[in] = request[pos];
        in++;
        pos++;
    }

    h->body = malloc(sizeof(char) * in+1);

    if (h->body == NULL)
        return (0);

    strcpy(h->body,buffer);

    free(buffer);

    return (1);
}
////////////////////////////////////////////////////////
// function for parse body in HTTP response
///////////////////////////////////////////////////////
function for parse body in HTTP response
function for parse body in HTTP response
int http_parse_response_body(HttpResponse_t *h,char *request)
{
    int maxsize = 4096,in = 0,pos;
    char *buffer = (char*)calloc(maxsize,sizeof(char));
    if (buffer == NULL)
        return (0);
    pos = strpos(request,"\r\n\r\n",0);
    pos += 4;
    while (request[pos] != '\0')
    {
        if (in>=maxsize){
            maxsize += 512;
            buffer = (char*)realloc(buffer,sizeof(char) * maxsize);
            if (buffer == NULL)
                return (0);
        }
        buffer[in] = request[pos];
        in++;
        pos++;
    }
    h->body = malloc(sizeof(char) * in+1);
    if (h->body == NULL)
        return (0);
    strcpy(h->body,buffer);
    free(buffer);
    return (1);
}
int http_parse_response_body ( HttpResponse_t * h , char * request ) { int maxsize = 4096 , in = 0 , pos ; char * buffer = ( char * ) calloc ( maxsize , sizeof ( char ) ) ; if ( buffer == NULL ) return ( 0 ) ; pos = strpos ( request , " \r \n \r \n " , 0 ) ; pos += 4 ; while ( request [ pos ] != ' \0 ' ) { if ( in >= maxsize ) { maxsize += 512 ; buffer = ( char * ) realloc ( buffer , sizeof ( char ) * maxsize ) ; if ( buffer == NULL ) return ( 0 ) ; } buffer [ in ] = request [ pos ] ; in ++ ; pos ++ ; } h -> body = malloc ( sizeof ( char ) * in + 1 ) ; if ( h -> body == NULL ) return ( 0 ) ; strcpy ( h -> body , buffer ) ; free ( buffer ) ; return ( 1 ) ; }
function for parse body in HTTP response
function for parse body in HTTP response