http.c
size_t http_write_callback(void *contents, size_t size, size_t nmemb, void *userp)
{
    http_info_t *http_req = (http_info_t *)userp;
    size_t chunk_size = (nmemb*size)+1;       //+1 to hold the NULL at the end
    size_t inptr = http_req->rx_msglen;
        char *rx_msg;

    if( (inptr + chunk_size) > http_req->rx_msglen ) 
        http_req->rx_msg = realloc(http_req->rx_msg, inptr+chunk_size);

    memcpy(&(http_req->rx_msg[inptr]), contents, chunk_size);
    http_req->rx_msg[chunk_size] = 0x00;
//printf("JIM4: %s\n",http_req->rx_msg);

    return (http_req->rx_msglen = (inptr+chunk_size)-1);  //don't include trailing NULL in length
}
//
// This is setup so userp points to the callers http_info_t structure, this contains the
// pointer to the data buffer and buffer length.
//
// buff_len always points to the end of the current buffer data
//
This is setup so userp points to the callers http_info_t structure, this contains the
pointer to the data buffer and buffer length.

buff_len always points to the end of the current buffer data
This is setup so userp points to the callers http_info_t structure this contains the pointer to the data buffer and buffer length . buff_len always points to the end of the current buffer data
size_t http_write_callback(void *contents, size_t size, size_t nmemb, void *userp)
{
    http_info_t *http_req = (http_info_t *)userp;
    size_t chunk_size = (nmemb*size)+1;       
    size_t inptr = http_req->rx_msglen;
        char *rx_msg;
    if( (inptr + chunk_size) > http_req->rx_msglen ) 
        http_req->rx_msg = realloc(http_req->rx_msg, inptr+chunk_size);
    memcpy(&(http_req->rx_msg[inptr]), contents, chunk_size);
    http_req->rx_msg[chunk_size] = 0x00;
    return (http_req->rx_msglen = (inptr+chunk_size)-1);  
}
size_t http_write_callback ( void * contents , size_t size , size_t nmemb , void * userp ) { http_info_t * http_req = ( http_info_t * ) userp ; size_t chunk_size = ( nmemb * size ) + 1 ; size_t inptr = http_req -> rx_msglen ; char * rx_msg ; if ( ( inptr + chunk_size ) > http_req -> rx_msglen ) http_req -> rx_msg = realloc ( http_req -> rx_msg , inptr + chunk_size ) ; memcpy ( & ( http_req -> rx_msg [ inptr ] ) , contents , chunk_size ) ; http_req -> rx_msg [ chunk_size ] = 0x00 ; return ( http_req -> rx_msglen = ( inptr + chunk_size ) - 1 ) ; }
This is setup so userp points to the callers http_info_t structure, this contains the
pointer to the data buffer and buffer length.
This is setup so userp points to the callers http_info_t structure this contains the pointer to the data buffer and buffer length .
//+1 to hold the NULL at the end //printf("JIM4: %s\n",http_req->rx_msg); //don't include trailing NULL in length