fix: some headers were not customizable with {.add header.}

This commit is contained in:
Massimo Melina 2020-07-27 11:39:09 +02:00
parent 2d131f2c5f
commit ad439fa65f
2 changed files with 6 additions and 5 deletions

View File

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

View File

@ -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.}