mirror of
https://github.com/warmcat/libwebsockets.git
synced 2025-03-30 00:00:16 +01:00
lws_serve_http_file: skip adding cache control if h1 other_headers do it
This commit is contained in:
parent
da444d04d1
commit
ed00704566
1 changed files with 8 additions and 3 deletions
|
@ -2195,9 +2195,14 @@ lws_serve_http_file(struct lws *wsi, const char *file, const char *content_type,
|
|||
}
|
||||
}
|
||||
|
||||
if (lws_add_http_header_by_token(wsi, WSI_TOKEN_HTTP_CACHE_CONTROL,
|
||||
(unsigned char *)cc, cclen, &p, end))
|
||||
return -1;
|
||||
/* Only add cache control if its not specified by any other_headers. */
|
||||
if (!other_headers ||
|
||||
(!strstr(other_headers, "cache-control") &&
|
||||
!strstr(other_headers, "Cache-Control"))) {
|
||||
if (lws_add_http_header_by_token(wsi, WSI_TOKEN_HTTP_CACHE_CONTROL,
|
||||
(unsigned char *)cc, cclen, &p, end))
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (other_headers) {
|
||||
if ((end - p) < other_headers_len)
|
||||
|
|
Loading…
Add table
Reference in a new issue