From f90af35e9c563bd4f865d8d47a7ae357191494db Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Timo=20Ter=C3=A4s?= <timo.teras@iki.fi>
Date: Wed, 3 Jan 2018 10:01:08 +0200
Subject: [PATCH] libfetch: add option to set "Cache-Control: no-cache"

ref #8161
---
 libfetch/http.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/libfetch/http.c b/libfetch/http.c
index d66fcc63..638c9a86 100644
--- a/libfetch/http.c
+++ b/libfetch/http.c
@@ -836,7 +836,7 @@ http_request(struct url *URL, const char *op, struct url_stat *us,
 {
 	conn_t *conn;
 	struct url *url, *new;
-	int chunked, direct, if_modified_since, need_auth, noredirect;
+	int chunked, direct, if_modified_since, need_auth, noredirect, nocache;
 	int keep_alive, verbose, cached;
 	int e, i, n, val;
 	off_t offset, clength, length, size;
@@ -848,6 +848,7 @@ http_request(struct url *URL, const char *op, struct url_stat *us,
 
 	direct = CHECK_FLAG('d');
 	noredirect = CHECK_FLAG('A');
+	nocache = CHECK_FLAG('C');
 	verbose = CHECK_FLAG('v');
 	if_modified_since = CHECK_FLAG('i');
 	keep_alive = 0;
@@ -917,6 +918,8 @@ http_request(struct url *URL, const char *op, struct url_stat *us,
 			    op, url->doc);
 		}
 
+		if (nocache)
+			http_cmd(conn, "Cache-Control: no-cache\r\n");
 		if (if_modified_since && url->last_modified > 0)
 			set_if_modified_since(conn, url->last_modified);
 
-- 
GitLab