httpd_dirlist.c: In function 'httpd_dirlist':
Error: httpd_dirlist.c:199:40: error: '%s' directive output may be truncated writing up to 255 bytes into a region of size 128 [-Werror=format-truncation=]
199 | snprintf(path, CONFIG_NAME_MAX, "%s/%s",
| ^~
httpd_dirlist.c:199:7: note: 'snprintf' output between 2 and 385 bytes into a destination of size 128
199 | snprintf(path, CONFIG_NAME_MAX, "%s/%s",
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
200 | file->path, dent->d_name);
| ~~~~~~~~~~~~~~~~~~~~~~~~~
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Gregory Nutt is has submitted the SGA
Sebastien Lorquet has submitted the ICLA
as a result we can migrate the licenses to Apache.
Signed-off-by: Alin Jerpelea <alin.jerpelea@sony.com>
Gregory Nutt is the copyright holder for those files and he has submitted the
SGA as a result we can migrate the licenses to Apache.
Signed-off-by: Alin Jerpelea <alin.jerpelea@sony.com>
1.Remove void cast for function because many place ignore the returned value witout cast
2.Replace void cast for variable with UNUSED macro
Change-Id: Ie644129a563244a6397036789c4c3ea83c4e9b09
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
netutils/webserver: Add web server info based on uname()
Signed-off-by: Masayuki Ishikawa <Masayuki.Ishikawa@jp.sony.com>
Approved-by: Gregory Nutt <gnutt@nuttx.org>
apps/examples/webserver: Fix to compile with CONFIG_NETUTILS_HTTPD_SENDFILE=y
Also, in this PR, some configs such as CONFIG_NETUTILS_HTTPDFILESTATS
can be selected by menuconfig.
Signed-off-by: Masayuki Ishikawa <Masayuki.Ishikawa@jp.sony.com>
Approved-by: Gregory Nutt <gnutt@nuttx.org>
The patch provided in issue 135, which adds support for HTTP Chunked Encoding, covers all paths in the webserver app except CGI callbacks. As a result, if a page being served happens to use CGI, it could generate stream content that does not comply with HTTP Chunked Encoding.
The patch attached amends the webserver app's CGI callbacks to use the HTTP Chunked Encoding sender function instead of using send() directly.
The webserver/httpd app is currently broken when script support is enabled (CONFIG_NETUTILS_HTTPD_SCRIPT_DISABLE). The root cause has been tracked down to the "Content-length" not being available ahead of time in this case (length of -1 passed to send_headers() ). On the other hand, the server closing the socket does not result in FIN being sent to the browser either (FIN not supported by NuttX yet).
Simple solution: Add support for HTTP Chunked Encoding to webserver/httpd (attached patch).
The attached patch is simple. It adds a configuration option to enable chunked encoding. When enabled, the implementation will auto-detect the cases where content length is not available ahead of time, and will automatically engage chunked encoding transfers.
Without this patch, the browser/client hangs forever, as it is expecting more data. With this patch, the browser displays the content.