With the changes introduced in b1b6275110
it's no longer possible to get ERR_CLSD from netconn_recv_tcp_pbuf_flags
after we've received data because of the NETCONN_NOFIN flag, so remove
handling for this case. Further the NETCONN_EVT_RCVPLUS stays active in
netconn_recv_data_tcp when the NETCONN_NOFIN flag is used
FIN should only be reported once (as '0' for sockets, as 'ERR_CLSD' for
netconns). Before this change, ERR_CLSD was returned forever...
This is the 2nd try. First try (commit ebcae98ae6)
was buggy in that it could drop the FIN if it was read together with data
(reverted in commit ebcae98ae6).
This version fixes this by adding an apiflag and a netconn flag to keep
track of this.
Headers are never included here or else get_http_headers would not
have been called.
As a result, custom files need to set FS_FILE_FLAGS_HEADER_PERSISTENT
in file->flags if file->len is the correct length of the file.
See also patch #9500
Signed-off-by: goldsimon <goldsimon@gmx.de>
clang failed to build:
../../../../lwip/src/include/lwip/tcp.h:180:11: error: parameter 'ERR_OK' not found in the function declaration [-Werror,-Wdocumentation]
* @param ERR_OK if OK, any error if connection should be dropped
^~~~~~
This patch moves in advance httpd_cgi_handler() call, before assigning
variables like hs->file and hs->left.
In this way, CGI handler could prepare the reply data and set the
"file properties", like file->data and file->len. At the exit, hs->file
and hs->left is correctly assigned.
The handler prototype says it can't access file pointer, however it is
simple to obtain it after setting LWIP_HTTPD_FILE_STATE that enables a
"file state" pointer. It is sufficient to assign file->state to file
itself in fs_open_custom().
For example, I have the request GET /login.cgi?user=admin&pwd=admin and
I have to reply with some JSON data. The answer depends on parameters
user and pwd passed in the query string.
The documentation on savannah recommends using only RSA keys, not DSA.
(reference http://savannah.gnu.org/maintenance/SshAccess/)
Thus update the doc/savannah.txt to us RSA instead.
Signed-off-by: Axel Lin <axel.lin@ingics.com>
Acked-by: Simon Goldschmidt <goldsimon@gmx.de>
This hook is called from tcp_input() for all kinds of input pcbs when
selected to receive a pbuf (LISTEN, TIME_WAIT, rest). I can parse or
drop an rx pbuf.
Signed-off-by: goldsimon <goldsimon@gmx.de>
This introduces the concept of ext (external/extended) arguments per
tcp_pcb (also for listening pcbs) to store more data than just one
"void *arg" per pcb. The "arg" is for use to applications, whereas
the ext_args may be used by frameworks and leave "arg" untouched.
In addition to a void pointer, callbacks are added to help frameworks
migrate arguments from listen pcb to connection pcb and to free args
when the pcb is freed.
Signed-off-by: goldsimon <goldsimon@gmx.de>
This should make it easier to add debugging messages or other hooks
to the point where tcp pcbs are deallocated.
Signed-off-by: goldsimon <goldsimon@gmx.de>
LWIP_HOOK_SOCKETS_SETSOCKOPT() and LWIP_HOOK_SOCKETS_GETSOCKOPT()
are introduced to implement additional socket options. The hooks
are always called first and report back if they handled the option
or not.
Signed-off-by: goldsimon <goldsimon@gmx.de>
tcp_rst, tcp_send_empty_ack, tcp_keepalive and tcp_zero_window_probe
all execute the same instructions to send a segment pbuf.
Combined into tcp_output_control_segment().
This file has been a mess regarding the order of the functions.
By moving them around, they can be grouped into functions taking
part in normal data transmission (via unsent/unacked) and control
segments (which are allocated, directly sent and freed).
Signed-off-by: goldsimon <goldsimon@gmx.de>