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.
ico
Oliver Schmidt 2015-11-01 15:34:09 +01:00
parent 185be73014
commit 1066bb1a0b
1 changed files with 5 additions and 0 deletions

View File

@ -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. */