Il 27/02/2018 06:39, Simon Goldschmidt ha scritto:
Giuseppe Modugno wrote:
#ifndef HTTP_IS_DATA_VOLATILE
#if LWIP_HTTPD_SSI
/* Copy for SSI files, no copy for non-SSI files */
#define HTTP_IS_DATA_VOLATILE(hs) ((hs)->ssi ? TCP_WRITE_FLAG_COPY : 0)
#else /* LWIP_HTTPD_SSI */
/** Default: don't copy if the data is sent from file-system directly */
#define HTTP_IS_DATA_VOLATILE(hs) (((hs->file != NULL) && (hs->handle != NULL) &&
(hs->file == \
(const char*)hs->handle->data +
hs->handle->len - hs->left)) \
? 0 : TCP_WRITE_FLAG_COPY)
#endif /* LWIP_HTTPD_SSI */
#endif
You're looking at an "old" version of the file. git master has this since last
may:
I was looking at the last stable release 2.0.3 that was released in Sep
2017.
#ifndef HTTP_IS_DATA_VOLATILE
/** tcp_write does not have to copy data when sent from rom-file-system
directly */
#define HTTP_IS_DATA_VOLATILE(hs) (HTTP_IS_DYNAMIC_FILE(hs) ?
TCP_WRITE_FLAG_COPY : 0)
#endif
IMHO data must be copied not only for "dynamic file", but also for some
custom files.
For example, with this new definition, it seems to me that the example
in genfiles_example.c is wrong. Indeed the "generated file" would be
considered "not volatile" (because it isn't dynamic in httpd sense), so
the content would not be copied during tcp_write(). The dynamic buffer
freed in fs_close_custom(), when the content could be pending yet.
Maybe genfiles_example.c should be compiled with another definition of
HTTP_IS_DATA_VOLATILE(). I suggest:
#define HTTP_IS_DATA_VOLATILE(hs) ( (hs)->is_custom-file ?
TCP_WRITE_FLAG_COPY : 0 )
_______________________________________________
lwip-users mailing list
lwip-users@nongnu.org
https://lists.nongnu.org/mailman/listinfo/lwip-users