I notice one difference into the header with <img src="/~img24"> and <a href="/~img24">click</a> and URL
http://127.0.0.1/~img24internal request:
<img src="/~img24"> GET /~img24 HTTP/1.1
> Accept: */*
> Referer:
http://127.0.0.1/link request:
<a href="/~img24">click</a>> GET /~img24 HTTP/1.1
> Accept: image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, application/x-shockwave-flash, application/vnd.ms-excel, application/vnd.ms-powerpoint, application/msword, application/xaml+xml, application/vnd.ms-xpsdocument, application/x-ms-xbap, application/x-ms-application, */*
> Referer:
http://127.0.0.1/URL request:
http://127.0.0.1/~img24> GET /~style.css HTTP/1.1
> Accept: */*
there is no referer defined here.
this allow some permissions for sections
[mysection|no log|no url|no link]
with '
no url' a user can't access to the section by
http://.../~mysectionwith '
no link' a user can't access to the section by
<a href="http://.../~mysection"></a>but other <balise src=/~mysection> or <link href=/~mysection> are always allowed
I found the answer to what I wanted to set up in term of protection for sections, I shall propose a modification of the code in this direction
please wait before posting the next build, thanks!
Posted on: 13 April 2009, 02:33:08
classelib.pas
TtplSection = record
name, txt: string;
nolog, nourl, nolink: boolean; //mod by mars
end;
.....
cur_section:=chop('|', s);
base.nolog:=ansiPos('no log', s) > 0;
base.nourl:=ansiPos('no url', s) > 0;
base.nolink:=ansiPos('no link', s) > 0; // there may be several section names separated by =
main.pas
// NB: section [] is not accessible, because of the s>'' test
section:=getsection(s);
if assigned(section)
and not(
section.nolink and (conn.getHeader('referer')>'') and not(conn.getHeader('accept')='*/*')
or
section.nourl and (conn.getHeader('referer')='')
) then // it has to exist and be accessible
begin
getPage(s, data, f, me());
exit;
end;
finally free end;
tested with section [style.css|no link|no url] .