From ad439fa65f397a4bc8bedc3176526212d8e578ee Mon Sep 17 00:00:00 2001 From: Massimo Melina Date: Mon, 27 Jul 2020 11:39:09 +0200 Subject: [PATCH] fix: some headers were not customizable with {.add header.} --- main.pas | 10 +++++----- todo.txt | 1 + 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/main.pas b/main.pas index f494c26..83a0d05 100644 --- a/main.pas +++ b/main.pas @@ -1,4 +1,4 @@ -{ +{ Copyright (C) 2002-2020 Massimo Melina (www.rejetto.com) This file is part of HFS ~ HTTP File Server. @@ -3627,7 +3627,7 @@ diffTpl:=Ttpl.create(); folder.lock(); try buildTime:=now(); - cd.conn.addHeader('Cache-Control: no-cache, no-store, must-revalidate, max-age=-1'); + cd.conn.setHeaderIfNone('Cache-Control: no-cache, no-store, must-revalidate, max-age=-1'); recur:=shouldRecur(cd); baseurl:=protoColon()+getSafeHost(cd)+folder.url(TRUE); @@ -4006,9 +4006,9 @@ if result then conn.reply.mode:=HRM_NOT_MODIFIED; exit; end; -conn.addHeader('ETag: '+UTF8encode(etag)); +conn.setHeaderIfNone('ETag: '+UTF8encode(etag)); if ts > '' then - conn.addHeader('Last-Modified: '+UTF8encode(ts)); + conn.setHeaderIfNone('Last-Modified: '+UTF8encode(ts)); end; // notModified function notModified(conn:ThttpConn; f:string):boolean; overload; @@ -4940,7 +4940,7 @@ var var s:ansistring; begin s:=ansistring(HSlib.encodeURL(data.lastFN)); - conn.addHeader( ansistring('Content-Disposition: '+if_(attach, 'attachment; ') + conn.setHeaderIfNone( ansistring('Content-Disposition: '+if_(attach, 'attachment; ') +'filename*=UTF-8'''''+s+'; filename='+s)); end; diff --git a/todo.txt b/todo.txt index f5cf4d7..9e61eb2 100644 --- a/todo.txt +++ b/todo.txt @@ -29,6 +29,7 @@ document: {.if|var} document: {.exec|out|timeout|exitcode.} document: [+section] document: {.set item|diff template.} +document: {.add header|overwrite=0.} document: {.calc| ][ } document: single line diff templates (file path) document: {.disconnection reason|if=XXX.}