mirror of
https://github.com/owntone/owntone-server.git
synced 2025-11-28 05:04:16 -05:00
[httpd/jsonapi] Add cache control headers to some json api endpoints
Adds utility functions to httpd.c for checking the request headers for either an "If-None-Match" or an "If-Not-Modified-Since" headers. If the header value is found and it matches the current value for the requested resource, we return early with a http response code 403 (Not Modified). If the request header value is not present or does not match we add the current ETag/Last-Modified values to the response headers and process the request normally.
This commit is contained in:
@@ -4,6 +4,7 @@
|
||||
|
||||
#include <stdbool.h>
|
||||
#include <regex.h>
|
||||
#include <time.h>
|
||||
#include <event2/http.h>
|
||||
#include <event2/buffer.h>
|
||||
#include <event2/keyvalq_struct.h>
|
||||
@@ -100,6 +101,12 @@ httpd_request_parse(struct evhttp_request *req, struct httpd_uri_parsed *uri_par
|
||||
void
|
||||
httpd_stream_file(struct evhttp_request *req, int id);
|
||||
|
||||
bool
|
||||
httpd_request_not_modified_since(struct evhttp_request *req, const time_t *mtime);
|
||||
|
||||
bool
|
||||
httpd_request_etag_matches(struct evhttp_request *req, const char *etag);
|
||||
|
||||
/*
|
||||
* Gzips an evbuffer
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user