Can Lighttpd set "connection.kbytes-per-second" depends on the hour of the day? Such as peak and offpeak -


is possible set "connection.kbytes-per-second" depends on hour of day in lighttpd?

such between 7pm-11pm limit 250kb/s, 1am-5am limit 500kb/s etc?

thanks!

sorry delay, answer - lua script:

-- if don't find our "supersecretstring" in request uri, if string.find(lighty.env["request.uri"], "supersecretstring") == nil     local hour = os.date("%h")     -- account whether or not there query variables     if string.find(lighty.env["request.uri"], "?") == nil         lighty.env["request.uri"] = lighty.env["request.uri"] .. "?supersecretstring=" .. hour     else         lighty.env["request.uri"] = lighty.env["request.uri"] .. "&supersecretstring=" .. hour     end     -- restart request, script run again, return nil.     return lighty.restart_request  end  -- continue request, above if have ran. return nil 

and configuration file:

server.modules( ..., mod_magnet, ...)  # match hours 00 through 19 $http["querystring"] =~ ".*supersecretstring=[0,1][0-9]" {     connection.kbytes-per-second = 200 } # match 20 through 23 $http["querystring"] =~ ".*supersecretstring=2[0-3]" {     connection.kbytes-per-second = 100 }  magnet.attract-raw-url-to = ( "<path lua script file>" ) 

in case isn't obvious, if knew "supersecretstring" they'd able short circuit this, never leaves server.

i feel should possible set connection speed inside lua script, couldn't figure out how to.

hope helps.


Comments

Popular posts from this blog

javascript - Count length of each class -

What design pattern is this code in Javascript? -

hadoop - Restrict secondarynamenode to be installed and run on any other node in the cluster -