1
0
Fork 0
mirror of git://git.psyced.org/git/psyced synced 2024-08-15 03:25:10 +00:00

fake redirection by iframe...

This commit is contained in:
psyc://loupsycedyglgamf.onion/~lynX 2020-10-23 13:22:39 +02:00
parent 5c859e6fef
commit 0a7f208a72
6 changed files with 114 additions and 35 deletions

View file

@ -24,18 +24,16 @@ varargs http_error(string prot, int code, string comment, string html) {
P2(("hterror(%O,%O,%O,%O) in %O\n", prot,code,comment,html, ME))
#if defined(T)
// use the textdb if available
out = psyctext( T("_PAGES_error",
"<html><title id='code'>[_code]</title>\n"
"<body><h1 id='comment'>[_comment]</h1></body></html>\n"),
out = psyctext( T("_PAGES_error", "<title>Error [_code]</title><body><h1 id='code'>[_code]</h1><div id='comment'>[_comment]</div>"),
([ "_comment": comment, "_code": code ]) );
#else
// use some hardcoded defaults
out = "<body text=white bgcolor=black link=green vlink=green>\n";
out = "<body text='white' bgcolor='black' link='green' vlink='green'>\n";
if (html) out = sprintf("<title>%s</title>\n%s%s", comment, out, html);
else out = sprintf("\
<title>error %d</title>\n\
<title>Error %d</title>\n\
%s\n\
<table width=\"100%%\" height=\"90%%\"><tr><th><h1><br>\n\n\
<table width=\"100%%\" height=\"90%%\"><tr><th><h1><br/>\n\n\
%s\n\n\
</h1></th></tr></table>\n\
",

View file

@ -95,12 +95,19 @@ varargs string htredirect(string prot, string target, string comment, int perman
printf("%s %d %s\n%s", HTTP_SVERS,
permanent ? R_MOVED : R_FOUND, comment, htheaders());
}
// this page might actually be visible
// if content-disposition: attachment is given
// or redirects are otherwise intercepted by plugin
// so a proper _PAGES form could be appropriate
printf("\
Location: %s\n%s\
\n\
<a href=\"%s\">%s</a>.\n\
",
target, extra, target, comment);
<title>%s</title>\n\
<body bgcolor='black' text='white' link='red' vlink='red'>\n\
%s\n",
// exposing the link to end-user may not be intended:
// <a href=\"%s\">%s</a>.
target, extra, comment, comment);
return 0;
}