From 1066bb1a0b7aa4ceab004592610d813252f6538f Mon Sep 17 00:00:00 2001 From: Oliver Schmidt Date: Sun, 1 Nov 2015 15:34:09 +0100 Subject: [PATCH] Client requested close takes precedence over server initiated close. When the client has already called webclient_close() it doesn't expect to have webclient_datahandler(NULL, 0) called just because the connection was closed by the server "at the same time". Rather it expects to always have webclient_closed() called. Calling webclient_datahandler(NULL, 0) instead of webclient_closed() means that the web browser shows "Done" in the status line instead of "Stopped". So the user is mislead to think that he has already seen all of the page. Note: webclient_close() is called by the client during newdata() so the already existing check for WEBCLIENT_STATE_CLOSE further above doesn't help. --- apps/webbrowser/webclient.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/apps/webbrowser/webclient.c b/apps/webbrowser/webclient.c index 5d2ce0254..f8f63d413 100644 --- a/apps/webbrowser/webclient.c +++ b/apps/webbrowser/webclient.c @@ -479,6 +479,11 @@ webclient_appcall(void *state) if(uip_closed()) { tcp_markconn(uip_conn, NULL); + /* Client requested close takes precedence over server initiated close. */ + if(s.state == WEBCLIENT_STATE_CLOSE) { + webclient_closed(); + return; + } switch(s.httpflag) { case HTTPFLAG_HTTPS: /* Send some info to the user. */