1
0
Fork 0
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:
Alexander Bruines 2018-10-15 05:05:39 +08:00 committed by Andy Green
parent da444d04d1
commit ed00704566

View file

@ -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)