Hi Silvio, thanks for answering,
> Could you show what error and how the buffer was assigned?
The error is that the downloaded binary file from the MHD server with the MHD_RESPMEM_PERSISTENT option is corrupt:
- Same size as the original
- The initial bytes are ok
- but from a certain point file contents are set to '0'. The free(buffer) seems to impact the content downloaded in the http response, I do not how because free() is after the MHD_destroy_response()
- Buffer is correctly downloaded when using the MHD_RESPMEM_MUST_COPY option but I wanted to minimize the memory impacts
The buffer is allocated by the MHD server with malloc, simplifying:
unsigned char* buffer = (unsigned char*)malloc(dataSize);
memcpy(buffer, data, dataSize);