always read counter.numb (for secret threaded servers)
This commit is contained in:
parent
d24d8bff7f
commit
cea9c0ce5b
2 changed files with 7 additions and 1 deletions
|
@ -1 +0,0 @@
|
||||||
0
|
|
7
myapp.pl
7
myapp.pl
|
@ -19,6 +19,7 @@ app->hook(before_server_start => sub ($server, $app) {
|
||||||
});
|
});
|
||||||
|
|
||||||
get '/' => sub ($c) {
|
get '/' => sub ($c) {
|
||||||
|
update_counter(); # hypnotoad or w/e may run on threads or something. awkward.
|
||||||
make_image(to_number_length($counter++));
|
make_image(to_number_length($counter++));
|
||||||
$c->res->headers->header('Content-Security-Policy' => 'img-src * artemis.venus.place');
|
$c->res->headers->header('Content-Security-Policy' => 'img-src * artemis.venus.place');
|
||||||
$c->res->headers->header('Server' => 'nginx/1.22.1'); # lie :)
|
$c->res->headers->header('Server' => 'nginx/1.22.1'); # lie :)
|
||||||
|
@ -28,6 +29,12 @@ get '/' => sub ($c) {
|
||||||
close $fh;
|
close $fh;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
sub update_counter () {
|
||||||
|
open my $fh, '<', $counter_file;
|
||||||
|
sysread $fh, $counter, 20;
|
||||||
|
close $fh;
|
||||||
|
}
|
||||||
|
|
||||||
sub to_number_length ($counter) {
|
sub to_number_length ($counter) {
|
||||||
while (length $counter lt 6) {
|
while (length $counter lt 6) {
|
||||||
$counter = "0$counter";
|
$counter = "0$counter";
|
||||||
|
|
Loading…
Reference in a new issue