Page 1 of 1

What is this temporary storage in file server sample code?

Posted: Thu Oct 10, 2019 1:46 am
by zliudr
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:
  1.     // Retrieve the pointer to scratch buffer for temporary storage
  2.     char *chunk = ((struct file_server_data *)req->user_ctx)->scratch;
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.