rejetto forum

HFS Only one User Agent can Download

ALEX · 3 · 10481

0 Members and 1 Guest are viewing this topic.

Offline ALEX

  • Occasional poster
  • *
    • Posts: 15
    • View Profile
Hello. can somehow configure the program so that only one specific agent can load ?


Offline LeoNeeson

  • Tireless poster
  • ****
    • Posts: 859
  • Status: On hiatus       (sporadically here)
    • View Profile
    • twitter.com/LeoNeeson
Welcome! :)

It's easy, just press "Alt+F6" inside HFS. That will create and open a text file (hfs.events). There add the following:

Quote
[request]
{.if|{.{.header|User-Agent.}!=ALLOWED_USER_AGENT_NAME.}|{:{.disconnect.}:}.}

Replace the text marked in red (ALLOWED_USER_AGENT_NAME), by the user agent you want to allow access, for example, if you only want to allow "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:109.0) Gecko/20100101 Firefox/116.0", you would use this:

Code: [Select]
[request]
{.if|{.{.header|User-Agent.}!=Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:109.0) Gecko/20100101 Firefox/116.0.}|{:{.disconnect.}:}.}

Replace the text marked in green (request), by "download", if you want to allow file listing (to anyone), but block downloads that doesn't match the specified user agent.

Cheers,
Leo.-
HFS in Spanish (HFS en Español) / How to compile HFS (Tutorial)
» Currently taking a break, until HFS v2.4 get his stable version.