diff --git a/lib/core/context.c b/lib/core/context.c index 029313b35d3a3ebaab424eecd64c67ce321aa6a1..c4acac57326558dad17d8ca500c6450ba5d1a22e 100644 --- a/lib/core/context.c +++ b/lib/core/context.c @@ -1024,7 +1024,7 @@ lws_create_vhost(struct lws_context *context, return vh; bail1: - lws_vhost_destroy(vh, NULL, NULL); + lws_vhost_destroy(vh); return NULL; diff --git a/lib/roles/http/header.c b/lib/roles/http/header.c index 85921c7e6cbf0af8e7002f720251f78608f3dc7c..2f020f153a9d7b81ff9bcbd9fb255b3a2220af89 100644 --- a/lib/roles/http/header.c +++ b/lib/roles/http/header.c @@ -149,9 +149,17 @@ lws_add_http_common_headers(struct lws *wsi, unsigned int code, (int)strlen(content_type), p, end)) return 1; - if (content_len != LWS_ILLEGAL_HTTP_CONTENT_LEN && - lws_add_http_header_content_length(wsi, content_len, p, end)) - return 1; + if (content_len != LWS_ILLEGAL_HTTP_CONTENT_LEN) { + if (lws_add_http_header_content_length(wsi, content_len, p, end)) + return 1; + } else { + if (lws_add_http_header_by_token(wsi, WSI_TOKEN_CONNECTION, + (unsigned char *)"close", 5, + p, end)) + return 1; + + wsi->http.connection_type = HTTP_CONNECTION_CLOSE; + } return 0; }