But I am just handling arrived data when *upload_data_size > 0. Here is the code:
else if(strcmp(method, "POST") == 0)
{
ST_PER_THREAD_DATA* pstThreadData = *ptr;
if( pstThreadData == NULL)
{
ST_PER_THREAD_DATA * cThreadData = (ST_PER_THREAD_DATA*) malloc(sizeof(ST_PER_THREAD_DATA));
cThreadData->nThreadID = nThID;
cThreadData->strData[0]='\0';
*ptr = cThreadData;
return MHD_YES;
}
if(*upload_data_size > 0)
{
printf("Before strcpy (%s) (%s) (%d)\n",pstThreadData->strData,upload_data,*upload_data_size);
strncpy(pstThreadData->strData,upload_data,*upload_data_size);
printf("After strcpy (%s) (%s) (%d)\n",pstThreadData->strData,upload_data,*upload_data_size);
*upload_data_size = 0;
return MHD_YES;
//After strcpy ({"key98"}) ({"key98"}) (9)
}
else
{
//END OF POST DATA GATHERING
printf("In the end of post we have (%s) (%d) \n",pstThreadData->strData, strlen(pstThreadData->strData));
HandleClientPost(pstThreadData->strData))
//In the end of post we have ({"key98"}) (10)
...
Please, is there anything wrong with the (testing) code?
Thank you