46
Programmers corner / Re: Template/events for QOS or traffic shaping.
« on: April 03, 2021, 03:07:18 AM »
@Mars
Would also like to streamline error handler for sections [overload] and [max contemp downloads].
Currently, I have:
This is bulky/verbose and partially successful. Main trouble is when in overdo condition, file downloaded consists of error page internally. It would be nice to Stop the download without filling the requested file internals with contents of error page.
Causing the client to stop a download requires either server-side redirect or disconnect, macros. So, these pages need to start with if download then disconnect; but, how to?
Would also like to streamline error handler for sections [overload] and [max contemp downloads].
Currently, I have:
Code: [Select]
[overload]
{.if not|%user%|{:{.if|{.%url% = /.}|{:{.disconnect.}:}.}:}.}{.add header|Cache-Control: no-cache, max-age=0.}<!DOCTYPE html><html><head><meta http-equiv="content-type" content="text/html; charset=UTF-8"><meta name="viewport" content="width=device-width, initial-scale=1"><META HTTP-EQUIV="Refresh" CONTENT="3;URL=./"><TITLE>Overload</TITLE><link rel="icon" href="data:,"></head><body bgcolor="black" text="white" alink="white" link="white" vlink="white"><center><h2><br>High traffic mode engaged.</h2>Returning to previous page after overload has cleared.</center></body>{.disconnect|{.current downloads|ip|file=this.}.}{.if|{.{.current downloads|ip=%ip%|file=this.} > 1.} |{: {.disconnection reason|knackered.} :}/if.}
[max contemp downloads]
{.add header|Cache-Control: no-cache, max-age=0.}<!DOCTYPE html><html><head><meta http-equiv="content-type" content="text/html; charset=UTF-8"><meta name="viewport" content="width=device-width, initial-scale=1"><META HTTP-EQUIV="Refresh" CONTENT="3;URL=./"><TITLE>Downloads</TITLE><link rel="icon" href="data:,"></head><body bgcolor="black" text="white" alink="white" link="white" vlink="white"><center><h2><br>There are ongoing downloads.</h2>More available <i>after</i> current downloads finish.</center></body>{.disconnect|{.current downloads|ip|file=this.}.}
This is bulky/verbose and partially successful. Main trouble is when in overdo condition, file downloaded consists of error page internally. It would be nice to Stop the download without filling the requested file internals with contents of error page.
Causing the client to stop a download requires either server-side redirect or disconnect, macros. So, these pages need to start with if download then disconnect; but, how to?