On 03/11/2017 03:39 PM, Vitaliy T wrote: > Still there is an issue with re-open a file. Patch applied below to avoid it.
Thanks, Fixed as suggested in 1855c73c..59268ccf. > Offtopic: > Are there plans to "say" libmicrohttpd to "clear" network buffers when > something goes wrong and we are ready to send a response? The HTTP protocol requires us to read everything at that time (we did send 100 continue), and so MHD requires you to explicitly toss all the data. Which is really comparatively cheap, so shouldn't be a big deal. > Currently, my fears about reading the whole request was confirmed > (in case of largepost.c the answer_to_connection() function will be > called as many times as needed). Yes. If you want to avoid this, a better method would be to not have the filename inside the POST upload data (as is done in the example), but instead in the URL or some other place in the HTTP header. Then, you can check upon the *first* call of "answer_to_connection", and immediately send an error code back if there is a serious problem detectable at that time. If the client uses "Expect: 100 continue", this will avoid the upload of the entire HTTP payload.
signature.asc
Description: OpenPGP digital signature