What is this temporary storage in file server sample code?
Posted: Thu Oct 10, 2019 1:46 am
I encountered a problem when I was expanding the file server sample code to handle form POST. In the POST handler, I need to open a response page in html and print it to client as a response to the form data posted.
So what I did was to first borrow code from the get handler that opens a file and send the file content one chunk at a time. The critical thing is that there exists a temp storage that the sample code used to store the file chunk. See below:
This line causes reboot. I suppose temp storage access issue. So for those more familiar with this file server sample code, where is this storage and which function created it, inside some library code? Thanks.
So what I did was to first borrow code from the get handler that opens a file and send the file content one chunk at a time. The critical thing is that there exists a temp storage that the sample code used to store the file chunk. See below:
- // Retrieve the pointer to scratch buffer for temporary storage
- char *chunk = ((struct file_server_data *)req->user_ctx)->scratch;