[354] Close http files even on bad clients.
Thanks to jbwdevries. Bug: https://github.com/eclipse/mosquitto/issues/354
This commit is contained in:
parent
7f66bf1f65
commit
8171a975ae
@ -3,6 +3,8 @@ Broker:
|
||||
- maximum_connections now applies to websockets listeners. Closes #271.
|
||||
- Allow bridges to use TLS with IPv6.
|
||||
- Don't error on zero length persistence files. Closes #316.
|
||||
- For http only websockets clients, close files served over http in all cases
|
||||
when the client disconnects. Closes #354.
|
||||
|
||||
Client library:
|
||||
- Clients can now use TLS with IPv6.
|
||||
|
@ -521,6 +521,7 @@ static int callback_http(struct libwebsocket_context *context,
|
||||
(unsigned int)filestat.st_size);
|
||||
if(libwebsocket_write(wsi, buf, buflen, LWS_WRITE_HTTP) < 0){
|
||||
fclose(u->fptr);
|
||||
u->fptr = NULL;
|
||||
return -1;
|
||||
}
|
||||
libwebsocket_callback_on_writable(context, wsi);
|
||||
@ -546,6 +547,7 @@ static int callback_http(struct libwebsocket_context *context,
|
||||
buflen = fread(buf, 1, sizeof(buf), u->fptr);
|
||||
if(buflen < 1){
|
||||
fclose(u->fptr);
|
||||
u->fptr = NULL;
|
||||
return -1;
|
||||
}
|
||||
wlen = libwebsocket_write(wsi, buf, buflen, LWS_WRITE_HTTP);
|
||||
@ -566,6 +568,15 @@ static int callback_http(struct libwebsocket_context *context,
|
||||
}else{
|
||||
return -1;
|
||||
}
|
||||
|
||||
case LWS_CALLBACK_CLOSED:
|
||||
case LWS_CALLBACK_CLOSED_HTTP:
|
||||
case LWS_CALLBACK_HTTP_FILE_COMPLETION:
|
||||
if(u && u->fptr){
|
||||
fclose(u->fptr);
|
||||
u->fptr = NULL;
|
||||
}
|
||||
break;
|
||||
#endif
|
||||
|
||||
default:
|
||||
|
Loading…
Reference in New Issue
Block a user