static void uh_file_data(struct client *cl, struct path_info *pi, int fd)
{
/* test preconditions */
- if (!uh_file_if_modified_since(cl, &pi->stat) ||
- !uh_file_if_match(cl, &pi->stat) ||
- !uh_file_if_range(cl, &pi->stat) ||
- !uh_file_if_unmodified_since(cl, &pi->stat) ||
- !uh_file_if_none_match(cl, &pi->stat)) {
+ if (!cl->dispatch.no_cache &&
+ (!uh_file_if_modified_since(cl, &pi->stat) ||
+ !uh_file_if_match(cl, &pi->stat) ||
+ !uh_file_if_range(cl, &pi->stat) ||
+ !uh_file_if_unmodified_since(cl, &pi->stat) ||
+ !uh_file_if_none_match(cl, &pi->stat))) {
ustream_printf(cl->us, "\r\n");
uh_request_done(cl);
close(fd);
blobmsg_get_string(tb[1]));
}
+static void
+handle_no_cache(struct json_script_ctx *ctx, struct blob_attr *data)
+{
+ struct client *cl = cur_client;
+
+ cl->dispatch.no_cache = true;
+}
+
static void
handle_command(struct json_script_ctx *ctx, const char *name,
struct blob_attr *data, struct blob_attr *vars)
{ "redirect", handle_redirect },
{ "rewrite", handle_set_uri },
{ "add-header", handle_add_header },
+ { "no-cache", handle_no_cache },
};
int i;