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.
NxWidgets improvements
* NxWidgets: fix garbage returned when CCycleButton::getValue() is called after removeAllOptions().
It's a bit questionable whether returning 0 here is reasonable or
if it would be better to assert(). But either is better than reading
into random memory and returning a garbage value.
* NXWidgets CScrollingPanel: Don't draw outside the widget area.
The port->move() function doesn't support clipping the
copied area to the client area, so we have to manually
calculate the part that can be moved without going outside
the widget.
* CNxString: Add string + operator and ::format() function
* CNumericEdit: Add option to include unit name after the value
* NxWidgets: CNxWidget: Make useWidgetStyle() public
Makes it easier to update styles when multiple controls are nested.
* NxWidgets: Add CLabelGrid control for displaying text in grid format.
Approved-by: GregoryN <gnutt@nuttx.org>
system/ping/ping.c and system/ping6/ping6.c: Move all ping preparation work into icmp_ping
system/ping/ping.c and system/ping6/ping6.c: Support -W <timeout> and -s <size> option
system/ping/ping.c and system/ping6/ping6.c: Decouple the output from ping logic
Reviewers note: Reviewing the changes I also see that these file did not follow the NuttX codings standard. I ran all files through nuttx/tools/indent.sh, manually reviewed all files for coding style issues. I also changed occurrences of non-standard types u8_t, u16_t, and u32_t to the standard uint8_t, uint16_t, and uint32_t.
> cat /dev/ttyCP &
> echo ls >/dev/ttyCP
Can't get the 'ls' result immediately, because 'cat' cmd uses nsh_consolewrite() and that uses fwrite with no fflush. We can get the 'ls' result after type '\n', because nsh will fflush output when get '\n'.