rejetto forum

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - danny

Pages: 1 2 3 4 5 6 ... 16
46
Programmers corner / Re: Template/events for QOS or traffic shaping.
« on: April 08, 2021, 02:59:25 PM »
Is it possible to do something like?:
{.if|{.current connections|ip=%ip%.} > 9.}|{: busy excuse + animated recheck :}|{: do file list :}.}

Edit:  The flaw with {.if|{.%connections% > 39.}|{: busy excuse + javascript recheck timer :}|{: do file list :}.} is DDOS, because 1 abuser can hinder All users.  However, instead of global connections, if it were changed to connections-per-ip then the flaw is gone.

47
Beta / 2 login targets
« on: April 08, 2021, 10:49:30 AM »
How do I alter this form to:  refresh same page if url is not /~login? 

Edit; answer was:
Code: [Select]
location.replace({.if|{.match|*~login|%url%.}|{:document.referrer:}|{:"%encoded-folder%":}.})

48
Kudos to Mars for the new [max contemp downloads] (hfs > menu > limits > simultaneous downloads) redirection macro scripts; so it is sure to serve up valid files.  The most useful HFS limits setting is:  Max simultaneous downloads from single address.  Try it at 2.

Kudos to NaitLee for the new [not found] redirection macro scripts; so it is sure to serve up valid files (especially, right-click+save-as).

The update was 'under the hood'--it looks the same to users. 

49
Programmers corner / Re: Template/events for QOS or traffic shaping.
« on: April 06, 2021, 10:22:47 PM »
... I came across %url% which is the link of the loaded file that allows to deduce the original path
Thanks!!!  That works very well for the [max contemp downloads] section.


I found out that the approach doesn't apply to [overload] section because can't redirect when beyond the set connections limit.   
So, here is the other option for preventing right click + save as corrupt file (if connections limits are used): 
Code: [Select]
[overload]
{.if|{.{.calc|{.get ini|max-connections.}.}<>0.}|{:{.set ini|max-connections=-1.}:}.}{.disconnect.}{.add to log|%ip% %user% disconnected at %connections% connections.}
I've axed the Max connections limit so that 1 abuser can't knock out All users.  And, then the remaining possibility is that an individual went over Max connections from single address limit, got disconnected and then their ip got logged.   No corrupt downloads. 


Edit:  Can test-drive with the latest Stripes template. 

50
Programmers corner / Re: Template/events for QOS or traffic shaping.
« on: April 05, 2021, 03:43:59 PM »
The idea goes something like this:

[max contemp downloads]
{.add header|Cache-Control: no-cache, max-age=0.}{.set|#frompath|%encoded-folder%.}{.redirect|/~server%20is%20busy.}

[server is busy|public]
{.set|backpath|{.^#frompath.}.}<!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={.^backpath.}"><TITLE>Busy</TITLE><link rel="icon" href="data:,"></head><body bgcolor="black" text="white" alink="white" link="white" vlink="white"><center><h2><br>Server is busy.</h2>Returning to previous page...</center></body></html>

Doesn't work as expected, because the url is only /

51
Programmers corner / Re: Template/events for QOS or traffic shaping.
« on: April 04, 2021, 11:19:43 PM »
under normal conditions if a download is interrupted the server sends the client a response with Not served: 503 - Overload, this is what should be reproduced instead of performing a sudden disconnection, perhaps a special section with a macro add header...
Some unexpected results:
Attempts to send those types of headers goes to Status=thinking, unresponsive console ui, stuck. 
Problem:  header does not reach client
Exception:  sending a header that hfs and client don't recognize, reaches the client (but a meaningful header does not)



P.S.  For preventing the "corrupt file generator" effect, (right-click+save-as with download limit set), it looks like the redirect macro is a working solution, because it changes the saved filename to section name with .htm extension (a proper file albeit not the one you clicked).  This could provide better opportunity for downloading the correct file (instead of a corrupt file).   Also new custom section name can be a message [server is busy], which would then look like user tried to download "server is busy.htm".    Very clanky, but workable.   

...creating variables {.set | # var1.} in the sections of the template to reuse them in the event as {. ^ var1.}
For the error redirect macro, I need to set global-variable to %encoded-folder% (or url) Before to redirection to [server is busy].  I need it to remember the original location. 
is this correct?   {.set|%encoded-folder%|#frompath.}
Upon arrival at [server is busy] I need to copy the global variable to temporary/local variable (no#) instantly (so that other user probably doesn't change it).  What is the macro to copy #frompath to frompath variable? 
For that, should I use %encoded-folder% or %item-url% ?
At [server is busy] I intend to display a nice message and redirect-after-seconds to frompath variable so that the user is not on an island. 

52
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: 
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? 

53
...HFS 2.3 Beta Build # 284...
Up to date security begins at HFS #299; so, perhaps an update. 
If you didn't want basic auth (login by url) then use newer HFS2.4.  http://rejetto.com/forum/index.php?topic=13060.msg1064012#msg1064012
If you want a custom template to run on HFS2.4 there is help http://rejetto.com/forum/index.php?topic=13326.msg1065975#msg1065975

54
Everything else / Re: permission
« on: March 30, 2021, 04:36:10 AM »
Thanks Mars! 

Good to know that the feature was already built-in. 

55
For now I have stopped the http.sys service. By editing the windows registry.  HKEY_Local_Machien\System\CurrentControlSet\Services\HTTP  changed value os start to 4 <reboot>

This is not an ideal workaround. The http service is stopped, so now you can't run IIS.  I wasn't planning on using Internet Information Server, so it's good enough for me.  Now i can switch hfs to use port 80  :)
That's some good results. 
Previously, I had suggested changing the http.sys service to ipv6-only (no listeners on ipv4 addresses) to clear ipv4 port 80. . . and still allow more modern microsoft things to use http.sys on ipv6.

56
Everything else / Re: permission
« on: March 28, 2021, 07:59:13 PM »
fail to erase is default rights for virtual file system, and this can be repurposed as fail to delete + fail to download, simply by making download action check for delete rights (if no delete rights then no download). 

Here's Naitlee's white.tpl modified with
[+special:alias|cache]
admz={.if|{.get|can delete.}|{:<a href="%item-name%">%item-name%</a>:}|{:%item-name%:}.}

and the file list uses {.admz.} instead of href clickable links. 

But, you'd also need events file http://rejetto.com/wiki/index.php?title=HFS:_Event_scripts
press altF6 to edit events file, and put this in
[download]
{.if|{.get|!can delete.}|{:{.disconnect.}:}.}

Edit:
upnotdown_for_HFS2.4RC.tpl is modified white.tpl
upnotdown2_for_HFS2.4RC.tpl is modified stripes.tpl

57
...i get error 404 the requested resource is not found...
Good news!  That is a response from an HTTP server. 
Maybe you need content at webroot, or replace the VFS?

58
When i check the PID in taskmanager it turns out it is my FTP server (Wing FTP server) is allready using that port.
In the wing admin panel, the port settings are located at Domains / mydomain / WebLink Manager / settings / Listeners  And, there you can modify the wing's http listener to use port 8080.

P.S. 
Filezilla FTP server can do FTPS (FTP over TLS) And the more modern SFTP secure connections, free. 

59
netsh http add iplisten ipaddress=192.168.2.180
I believe that the article wanted you to 'distract' http.sys by changing it to ipv6-only (thus ipv4 port 80 is clear). 
netsh http delete iplisten ipaddress=192.168.2.180
netsh http add iplisten ipaddress=::
netsh http show iplisten
Be sure there is no ipv4 address on that list.
netsh http show servicestate view=requestq verbose=yes

netstat -o -n -a | findstr 0.0:80
The last column of each row is the process ID, PID, which can be matched to a PID number in Task Manager details tab (and find out what has hogged the port).

P.S.  Here is the really simple firewall that I use:  https://tinywall.pados.hu/download.php  It is a whitelist type, which reduces data costs.

60
When you can't get access to a port in windows, then a different piece of software is already using that port. 

It is probably http.sys
http://web.archive.org/web/20160126063606/http://www.mikeplate.com/2011/11/06/stop-http-sys-from-listening-on-port-80-in-windows/

Pages: 1 2 3 4 5 6 ... 16