mirror of
https://github.com/warmcat/libwebsockets.git
synced 2025-03-16 00:00:07 +01:00
LWS_ILLEGAL_HTTP_CONTENT_LEN implies connection:close
If no content-length is coming, we just can't do http/1.1 keep-alive.
This commit is contained in:
parent
d1ca974b9f
commit
f256fdea05
1 changed files with 11 additions and 3 deletions
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue